From ceb4fcedca30d323a05836b0872bfe773a047ccc Mon Sep 17 00:00:00 2001 From: Consolatis <40171-Consolatis@users.noreply.gitlab.freedesktop.org> Date: Sat, 13 Apr 2024 14:48:59 +0200 Subject: [PATCH] xwm: expose individual axis for _set_maximized() This allows compositors to support both axis individually. To keep existing behavior, compositors can supply the same maximized state for both axis. --- include/wlr/xwayland/xwayland.h | 2 +- xwayland/xwm.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/wlr/xwayland/xwayland.h b/include/wlr/xwayland/xwayland.h index c02f45e3..d656036b 100644 --- a/include/wlr/xwayland/xwayland.h +++ b/include/wlr/xwayland/xwayland.h @@ -261,7 +261,7 @@ void wlr_xwayland_surface_set_minimized(struct wlr_xwayland_surface *surface, bool minimized); void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface, - bool maximized); + bool maximized_horz, bool maximized_vert); void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, bool fullscreen); diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 67b00829..a6851da8 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1392,11 +1392,6 @@ static bool update_state(int action, bool *state) { return changed; } -static bool xsurface_is_maximized( - struct wlr_xwayland_surface *xsurface) { - return xsurface->maximized_horz && xsurface->maximized_vert; -} - static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm, xcb_client_message_event_t *client_message) { struct wlr_xwayland_surface *xsurface = @@ -1409,7 +1404,8 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm, } bool fullscreen = xsurface->fullscreen; - bool maximized = xsurface_is_maximized(xsurface); + bool maximized_vert = xsurface->maximized_vert; + bool maximized_horz = xsurface->maximized_horz; bool minimized = xsurface->minimized; uint32_t action = client_message->data.data32[0]; @@ -1445,7 +1441,9 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm, wl_signal_emit_mutable(&xsurface->events.request_fullscreen, NULL); } - if (maximized != xsurface_is_maximized(xsurface)) { + if (maximized_vert != xsurface->maximized_vert + || maximized_horz != xsurface->maximized_horz) { + wl_signal_emit_mutable(&xsurface->events.request_maximize, NULL); } @@ -2342,9 +2340,9 @@ void wlr_xwayland_surface_set_minimized(struct wlr_xwayland_surface *surface, } void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface, - bool maximized) { - surface->maximized_horz = maximized; - surface->maximized_vert = maximized; + bool maximized_horz, bool maximized_vert) { + surface->maximized_horz = maximized_horz; + surface->maximized_vert = maximized_vert; xsurface_set_net_wm_state(surface); xcb_flush(surface->xwm->xcb_conn); }