From 6c5c3e618125ea4f429ad88d79817d3ede41b119 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Thu, 26 Mar 2026 18:13:42 -0400 Subject: [PATCH] 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. --- src/moveres.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/moveres.c b/src/moveres.c index c7dbf867..e6653e6c 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -457,11 +457,10 @@ static void drawTransparentFrame(WWindow * wwin, int x, int y, int width, int he GC gc = wwin->screen_ptr->frame_gc; int h = 0; int bottom = 0; + int fb = 0; - if (HAS_BORDER_WITH_SELECT(wwin)) { - x += wwin->screen_ptr->frame_border_width; - y += wwin->screen_ptr->frame_border_width; - } + if (HAS_BORDER_WITH_SELECT(wwin)) + fb = wwin->screen_ptr->frame_border_width; if (HAS_TITLEBAR(wwin) && !wwin->flags.shaded) { 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. */ 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) { - 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) { - 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) { WScreen *scr; - int head, x, y; + int head, x, y, fb; unsigned int width, height; WMRect rect; @@ -1212,6 +1211,7 @@ static void draw_snap_frame(WWindow *wwin, int direction) y = rect.pos.y; width = rect.size.width; height = rect.size.height; + fb = HAS_BORDER_WITH_SELECT(wwin) ? 2 * wwin->screen_ptr->frame_border_width : 0; switch (direction) { case SNAP_LEFT: @@ -1258,7 +1258,7 @@ static void draw_snap_frame(WWindow *wwin, int direction) 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)