From b72a217fcc9f8bb47788c2068093579ac893301c Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Thu, 16 Sep 2021 14:04:56 +0300 Subject: xdg-toplevel: refactor configure/state flow Previously, `wlr_xdg_toplevel` didn't follow the usual "current state + pending state" pattern and instead had confusingly named `client_pending` and `server_pending`. This commit removes them, and instead introduces `wlr_xdg_toplevel.scheduled` to store the properties that are yet to be sent to a client, and `wlr_xdg_toplevel.requested` to store the properties that a client has requested. They have different types to emphasize that they aren't actual states. --- include/wlr/types/wlr_xdg_shell.h | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index f80c6685..2ca7e203 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -105,10 +105,16 @@ struct wlr_xdg_toplevel_state { uint32_t width, height; uint32_t max_width, max_height; uint32_t min_width, min_height; +}; + +struct wlr_xdg_toplevel_configure { + bool maximized, fullscreen, resizing, activated; + uint32_t tiled; // enum wlr_edges + uint32_t width, height; +}; - // Since the fullscreen request may be made before the toplevel's surface - // is mapped, this is used to store the requested fullscreen output (if - // any) for wlr_xdg_toplevel::client_pending. +struct wlr_xdg_toplevel_requested { + bool maximized, minimized, fullscreen; struct wlr_output *fullscreen_output; struct wl_listener fullscreen_output_destroy; }; @@ -121,10 +127,15 @@ struct wlr_xdg_toplevel { struct wlr_xdg_surface *parent; struct wl_listener parent_unmap; - struct wlr_xdg_toplevel_state client_pending; - struct wlr_xdg_toplevel_state server_pending; - struct wlr_xdg_toplevel_state last_acked; - struct wlr_xdg_toplevel_state current; + struct wlr_xdg_toplevel_state current, pending; + + // Properties to be sent to the client in the next configure event. + struct wlr_xdg_toplevel_configure scheduled; + + // Properties that the client has requested. Intended to be checked + // by the compositor on surface map and handled accordingly + // (e.g. a client might want to start already in a fullscreen state). + struct wlr_xdg_toplevel_requested requested; char *title; char *app_id; @@ -147,7 +158,7 @@ struct wlr_xdg_surface_configure { struct wl_list link; // wlr_xdg_surface::configure_list uint32_t serial; - struct wlr_xdg_toplevel_state *toplevel_state; + struct wlr_xdg_toplevel_configure *toplevel_configure; }; /** -- cgit v1.2.3