From 509398dc256d5105d308a905b4c2a8997ae47021 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 18 Mar 2022 11:42:17 +0200 Subject: [PATCH] desktop-shell: Avoid spurious configure events for xdg-shell activation This is a minor re-work of how we de-activate and activate the surfaces in desktop-shell. As activate() is being used for handling keyboard input events, this basically rectifies that such that activation happens only if the passed surface is different from the currently focused surface. Fixes: #593 Signed-off-by: Marius Vlad --- desktop-shell/shell.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 0afd574d..e4f84ec6 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3678,16 +3678,18 @@ activate(struct desktop_shell *shell, struct weston_view *view, weston_view_activate_input(view, seat, flags); - if (shseat && shseat->focused_surface) { + if (shseat && shseat->focused_surface && + shseat->focused_surface != main_surface) { struct shell_surface *current_focus = get_shell_surface(shseat->focused_surface); assert(current_focus); shell_surface_deactivate(current_focus); } - if (shseat) + if (shseat && shseat->focused_surface != main_surface) { + shell_surface_activate(shsurf); shseat->focused_surface = main_surface; - shell_surface_activate(shsurf); + } state = ensure_focus_state(shell, seat); if (state == NULL)