xwm: Fix accidental resizing of windows

If an X window has not been resized yet, and the user clicks (not drags)
on a part of the window frame that can be used to resize, the window
will resize to 512, 512.

This is likely because of the changes in ba82af938 and 2acd2c748
that change resize behaviour but missed updating saved size when the
client's initial configure occurs.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-10-23 07:26:34 -05:00 committed by Marius Vlad
parent 8d85c43355
commit e193a178e8
1 changed files with 14 additions and 8 deletions

View File

@ -214,6 +214,12 @@ static void
xserver_map_shell_surface(struct weston_wm_window *window,
struct weston_surface *surface);
static inline bool
weston_wm_window_is_maximized(struct weston_wm_window *window)
{
return window->maximized_horz && window->maximized_vert;
}
static bool
wm_debug_is_enabled(struct weston_wm *wm)
{
@ -821,10 +827,16 @@ weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *ev
return;
}
if (configure_request->value_mask & XCB_CONFIG_WINDOW_WIDTH)
if (configure_request->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
window->width = configure_request->width;
if (configure_request->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
if (!weston_wm_window_is_maximized(window))
window->saved_width = window->width;
}
if (configure_request->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
window->height = configure_request->height;
if (!weston_wm_window_is_maximized(window))
window->saved_height = window->height;
}
if (window->frame) {
weston_wm_window_set_allow_commits(window, false);
@ -1872,12 +1884,6 @@ weston_wm_window_set_toplevel(struct weston_wm_window *window)
weston_wm_window_configure(window);
}
static inline bool
weston_wm_window_is_maximized(struct weston_wm_window *window)
{
return window->maximized_horz && window->maximized_vert;
}
static void
weston_wm_window_handle_state(struct weston_wm_window *window,
xcb_client_message_event_t *client_message)