mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-30 11:03:34 +02:00
wmaker: fix wire frame drawing when snapping
This patch is fixing the wire frame dimension which was computed wrongly when FrameBorderWidth was set and the window snapped top half or bottom half. In such case, drawTransparentFrame was passed the width and height of the screen while it should have used an inner frame size (meaning without frame border). The result bug was that the wire frame width was too large and the right edge displayed out of the monitor head.
This commit is contained in:
committed by
Carlos R. Mafra
parent
329f82f6e7
commit
6c5c3e6181
@@ -457,11 +457,10 @@ static void drawTransparentFrame(WWindow * wwin, int x, int y, int width, int he
|
|||||||
GC gc = wwin->screen_ptr->frame_gc;
|
GC gc = wwin->screen_ptr->frame_gc;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
int bottom = 0;
|
int bottom = 0;
|
||||||
|
int fb = 0;
|
||||||
|
|
||||||
if (HAS_BORDER_WITH_SELECT(wwin)) {
|
if (HAS_BORDER_WITH_SELECT(wwin))
|
||||||
x += wwin->screen_ptr->frame_border_width;
|
fb = wwin->screen_ptr->frame_border_width;
|
||||||
y += wwin->screen_ptr->frame_border_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HAS_TITLEBAR(wwin) && !wwin->flags.shaded) {
|
if (HAS_TITLEBAR(wwin) && !wwin->flags.shaded) {
|
||||||
h = WMFontHeight(wwin->screen_ptr->title_font) + (wPreferences.window_title_clearance +
|
h = WMFontHeight(wwin->screen_ptr->title_font) + (wPreferences.window_title_clearance +
|
||||||
@@ -478,13 +477,13 @@ static void drawTransparentFrame(WWindow * wwin, int x, int y, int width, int he
|
|||||||
(e.g. interactive placement), frame does not point to anything. */
|
(e.g. interactive placement), frame does not point to anything. */
|
||||||
bottom = RESIZEBAR_HEIGHT;
|
bottom = RESIZEBAR_HEIGHT;
|
||||||
}
|
}
|
||||||
XDrawRectangle(dpy, root, gc, x - 1, y - 1, width + 1, height + 1);
|
XDrawRectangle(dpy, root, gc, x, y, width - 1 + 2 * fb, height - 1 + 2 * fb);
|
||||||
|
|
||||||
if (h > 0) {
|
if (h > 0) {
|
||||||
XDrawLine(dpy, root, gc, x, y + h - 1, x + width, y + h - 1);
|
XDrawLine(dpy, root, gc, x, y + fb + h - 1, x + 2 * fb + width, y + fb + h - 1);
|
||||||
}
|
}
|
||||||
if (bottom > 0) {
|
if (bottom > 0) {
|
||||||
XDrawLine(dpy, root, gc, x, y + height - bottom, x + width, y + height - bottom);
|
XDrawLine(dpy, root, gc, x, y + fb + height - bottom, x + 2 * fb + width, y + fb + height - bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1200,7 +1199,7 @@ updateWindowPosition(WWindow * wwin, MoveData * data, Bool doResistance,
|
|||||||
static void draw_snap_frame(WWindow *wwin, int direction)
|
static void draw_snap_frame(WWindow *wwin, int direction)
|
||||||
{
|
{
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
int head, x, y;
|
int head, x, y, fb;
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
WMRect rect;
|
WMRect rect;
|
||||||
|
|
||||||
@@ -1212,6 +1211,7 @@ static void draw_snap_frame(WWindow *wwin, int direction)
|
|||||||
y = rect.pos.y;
|
y = rect.pos.y;
|
||||||
width = rect.size.width;
|
width = rect.size.width;
|
||||||
height = rect.size.height;
|
height = rect.size.height;
|
||||||
|
fb = HAS_BORDER_WITH_SELECT(wwin) ? 2 * wwin->screen_ptr->frame_border_width : 0;
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case SNAP_LEFT:
|
case SNAP_LEFT:
|
||||||
@@ -1258,7 +1258,7 @@ static void draw_snap_frame(WWindow *wwin, int direction)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawTransparentFrame(wwin, x, y, width, height);
|
drawTransparentFrame(wwin, x, y, width - fb, height - fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_snap_direction(WScreen *scr, int x, int y)
|
static int get_snap_direction(WScreen *scr, int x, int y)
|
||||||
|
|||||||
Reference in New Issue
Block a user