[PATCH] wmaker: fix wire frame drawing when snapping

Skip to first unread message

david.m...@gmail.com

unread,
Mar 27, 2026, 5:29:29 PM (10 days ago) Mar 27
to Window Maker Development
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)
--
2.43.0
0001-wmaker-fix-wire-frame-drawing-when-snapping.patch
Reply all
Reply to author
Forward
0 new messages