diff options
author | Hideyuki Nagase <hideyukn@microsoft.com> | 2022-03-10 12:34:17 -0600 |
---|---|---|
committer | Derek Foreman <derek.foreman@collabora.com> | 2022-06-22 09:57:25 -0500 |
commit | d902088bfc9678bbd4a57eec64703869fe28d9db (patch) | |
tree | 23a975541030fa2ebe4e5679738aeb456c3cfe5c /xwayland | |
parent | cc69dc447ee9a9fd2fa6894e583fd66c21e958c4 (diff) |
xwayland: support minimizing
Allow minimizing xwayland windows.
Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/window-manager.c | 33 | ||||
-rw-r--r-- | xwayland/xwayland-internal-interface.h | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index ff9eddf7..c75e0102 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -1057,6 +1057,9 @@ weston_wm_window_create_frame(struct weston_wm_window *window) if (window->decorate & MWM_DECOR_MAXIMIZE) buttons |= FRAME_BUTTON_MAXIMIZE; + if (window->decorate & MWM_DECOR_MINIMIZE) + buttons |= FRAME_BUTTON_MINIMIZE; + window->frame = frame_create(window->wm->theme, window->width, window->height, buttons, window->name, NULL); @@ -1804,6 +1807,27 @@ weston_wm_window_handle_state(struct weston_wm_window *window, } static void +weston_wm_window_handle_iconic_state(struct weston_wm_window *window, + xcb_client_message_event_t *client_message) +{ + struct weston_wm *wm = window->wm; + const struct weston_desktop_xwayland_interface *xwayland_interface = + wm->server->compositor->xwayland_interface; + uint32_t iconic_state; + + if (!window->shsurf) + return; + + iconic_state = client_message->data.data32[0]; + + if (iconic_state == ICCCM_ICONIC_STATE) { + window->saved_height = window->height; + window->saved_width = window->width; + xwayland_interface->set_minimized(window->shsurf); + } +} + +static void surface_destroy(struct wl_listener *listener, void *data) { struct weston_wm_window *window = @@ -1880,6 +1904,8 @@ weston_wm_handle_client_message(struct weston_wm *wm, weston_wm_window_handle_state(window, client_message); else if (client_message->type == wm->atom.wl_surface_id) weston_wm_window_handle_surface_id(window, client_message); + else if (client_message->type == wm->atom.wm_change_state) + weston_wm_window_handle_iconic_state(window, client_message); } enum cursor_type { @@ -2163,6 +2189,13 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event) } frame_status_clear(window->frame, FRAME_STATUS_MAXIMIZE); } + + if (frame_status(window->frame) & FRAME_STATUS_MINIMIZE) { + window->saved_width = window->width; + window->saved_height = window->height; + xwayland_interface->set_minimized(window->shsurf); + frame_status_clear(window->frame, FRAME_STATUS_MINIMIZE); + } } static void diff --git a/xwayland/xwayland-internal-interface.h b/xwayland/xwayland-internal-interface.h index c7dfd19b..a97d13bc 100644 --- a/xwayland/xwayland-internal-interface.h +++ b/xwayland/xwayland-internal-interface.h @@ -59,6 +59,7 @@ struct weston_desktop_xwayland_interface { int32_t x, int32_t y, int32_t width, int32_t height); void (*set_maximized)(struct weston_desktop_xwayland_surface *shsurf); + void (*set_minimized)(struct weston_desktop_xwayland_surface *shsurf); void (*set_pid)(struct weston_desktop_xwayland_surface *shsurf, pid_t pid); }; |