From a32ad9a11ee6f56371f9e1a817edcea2393e7c19 Mon Sep 17 00:00:00 2001 From: lkn Date: Thu, 14 May 2026 23:29:07 +0200 Subject: [PATCH] wl_backend: fix button positioning on frame resize wl_window_move for frame_bufs was setting absolute x,y instead of updating rel_x/rel_y and computing absolute position from parent. This caused the close button to stay at its old position when the frame was resized (e.g. on maximize). Fix: set rel_x/rel_y and compute absolute position from parent, matching the logic in wl_frame_configure. --- src/backend/wayland/wl_backend.c | 17 +++++++++++++---- src/framewin.c | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 3c68a90..002ec15 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -4008,8 +4008,6 @@ wl_frame_paint(struct WFrameWindow *fwin) int state = fwin->flags.state; int total_w = fb->width; int total_h = fb->height; - if (total_w > 701 || total_h > 530) - wwarning("frame_paint: 0x%lx %dx%d", (unsigned long)fwin->core->window, total_w, total_h); /* Clear the buffer to transparent black. */ pixman_color_t clear = {0, 0, 0, 0}; /* transparent */ pixman_image_fill_rectangles(PIXMAN_OP_SRC, fb->image, &clear, @@ -5889,9 +5887,20 @@ static void wl_window_move(WNativeWindow win, int x, int y) } struct wl_frame_buf *fb = frame_buf_find(win); if (fb) { - fb->x = x; fb->y = y; + fb->rel_x = x; fb->rel_y = y; + if (fb->parent_id) { + struct wl_frame_buf *parent = frame_buf_find(fb->parent_id); + if (parent) { + fb->x = parent->x + x; + fb->y = parent->y + y; + } else { + fb->x = x; fb->y = y; + } + } else { + fb->x = x; fb->y = y; + } if (fb->scene_buf) - wlr_scene_node_set_position(&fb->scene_buf->node, x, y); + wlr_scene_node_set_position(&fb->scene_buf->node, fb->x, fb->y); /* Move the client surface (toplevel view) that belongs to this frame */ struct wl_toplevel_view *cv; wl_list_for_each(cv, &wl_state.toplevel_list, link) { diff --git a/src/framewin.c b/src/framewin.c index 5425529..4b0911b 100644 --- a/src/framewin.c +++ b/src/framewin.c @@ -982,9 +982,10 @@ static void reconfigure(WFrameWindow * fwin, int x, int y, int width, int height } if (wPreferences.new_style == TS_NEW) { - if (fwin->right_button && fwin->right_button->window) + if (fwin->right_button && fwin->right_button->window) { wm_backend->window_move(fwin->right_button->window, width - fwin->right_button->width + 1, 0); + } } else { if (fwin->right_button && fwin->right_button->window) wm_backend->window_move(fwin->right_button->window,