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.
This commit is contained in:
parent
72d972a719
commit
a32ad9a11e
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue