diff options
author | Kirill Primak <vyivel@posteo.net> | 2021-09-16 14:04:56 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-09-21 10:09:09 +0200 |
commit | b72a217fcc9f8bb47788c2068093579ac893301c (patch) | |
tree | c9ce0cef4f3a0a6fdb42c54f3ed1c3df2845fd8a /include/wlr | |
parent | 9579d62a160821a107763325a515d3aee0a1e158 (diff) |
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.
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_xdg_shell.h | 27 |
1 files changed, 19 insertions, 8 deletions
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; }; /** |