From bd9a3008014d1063aac75241ff750798cbe5aaee Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 9 Jan 2018 13:19:40 +0100 Subject: window: Defer stack placement without a buffer When closing a window and showing a new one, the new one may not be granted input focus until it gets a buffer on Wayland. If another window is chosen to receive focus and raised on top of stack, the newly mapped window is focused but placed underneath that other window. Meaning that for Wayland surfaces, we need to defer adding the window to the stack until we actually get to show it, once we have a buffer attached. Rather that checking the windowing backend prior to decide if a window is stackable or not, introduce a new vfunc is_stackable() which tells if a window should be added to the stack regardless of the underlying windowing system. Also add meta_window_is_in_stack() API rather than checking the stack position directly (replacing the define WINDOW_IN_STACK only available in stack.c) and remove a window from the stack only if it is present in the stack, so that the test in meta_stack_remote() becomes irrelevant. https://bugzilla.gnome.org/show_bug.cgi?id=780820 --- src/wayland/meta-window-wayland.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/wayland') diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index f3f0e1688..d5d8e21b0 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -543,6 +543,12 @@ meta_window_wayland_shortcuts_inhibited (MetaWindow *window, return meta_wayland_compositor_is_shortcuts_inhibited (compositor, source); } +static gboolean +meta_window_wayland_is_stackable (MetaWindow *window) +{ + return meta_wayland_surface_get_buffer (window->surface) != NULL; +} + static void meta_window_wayland_class_init (MetaWindowWaylandClass *klass) { @@ -562,6 +568,7 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass) window_class->get_client_pid = meta_window_wayland_get_client_pid; window_class->force_restore_shortcuts = meta_window_wayland_force_restore_shortcuts; window_class->shortcuts_inhibited = meta_window_wayland_shortcuts_inhibited; + window_class->is_stackable = meta_window_wayland_is_stackable; } MetaWindow * -- cgit v1.2.1