From a5770fdc71b78e20f2e0c56e86e0f750194f6ee4 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Fri, 1 Oct 2021 16:31:49 +0300 Subject: [PATCH 1/2] xdg-shell: fix notes for wlr_xdg_toplevel.requested The requested properties can be read by compositors on any relevant event (set_maximized, set_fullscreen etc), not just surface map. Reading `minimized` only makes sense on surface map, as the compositor can't handle set_minimized events before that. --- include/wlr/types/wlr_xdg_shell.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 2ca7e203f9..239ec67655 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -114,6 +114,9 @@ struct wlr_xdg_toplevel_configure { }; struct wlr_xdg_toplevel_requested { + // Note that the client has no means to unset minimization + // of a surface, so `minimized` can only be set to `true` and + // is supposed to be read on surface map. bool maximized, minimized, fullscreen; struct wlr_output *fullscreen_output; struct wl_listener fullscreen_output_destroy; @@ -133,8 +136,7 @@ struct wlr_xdg_toplevel { 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). + // by the compositor and handled accordingly. struct wlr_xdg_toplevel_requested requested; char *title; From 7832482ee982a4e18ad5e9529eb672daa8478b4a Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Fri, 1 Oct 2021 16:29:12 +0300 Subject: [PATCH 2/2] xdg-shell: drop wlr_xdg_toplevel_set_fullscreen_event Instead, compositors can read relevant values from wlr_xdg_toplevel.requested. --- include/wlr/types/wlr_xdg_shell.h | 6 ------ types/xdg_shell/wlr_xdg_toplevel.c | 16 ++-------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 239ec67655..b0693750c9 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -242,12 +242,6 @@ struct wlr_xdg_toplevel_resize_event { uint32_t edges; }; -struct wlr_xdg_toplevel_set_fullscreen_event { - struct wlr_xdg_surface *surface; - bool fullscreen; - struct wlr_output *output; -}; - struct wlr_xdg_toplevel_show_window_menu_event { struct wlr_xdg_surface *surface; struct wlr_seat_client *seat; diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index b5a7239b0e..0a31294d01 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -378,13 +378,7 @@ static void xdg_toplevel_handle_set_fullscreen(struct wl_client *client, store_fullscreen_requested(surface, true, output); - struct wlr_xdg_toplevel_set_fullscreen_event event = { - .surface = surface, - .fullscreen = true, - .output = output, - }; - - wlr_signal_emit_safe(&surface->toplevel->events.request_fullscreen, &event); + wlr_signal_emit_safe(&surface->toplevel->events.request_fullscreen, surface); wlr_xdg_surface_schedule_configure(surface); } @@ -395,13 +389,7 @@ static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client, store_fullscreen_requested(surface, false, NULL); - struct wlr_xdg_toplevel_set_fullscreen_event event = { - .surface = surface, - .fullscreen = false, - .output = NULL, - }; - - wlr_signal_emit_safe(&surface->toplevel->events.request_fullscreen, &event); + wlr_signal_emit_safe(&surface->toplevel->events.request_fullscreen, surface); wlr_xdg_surface_schedule_configure(surface); }