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 <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2022-03-18 11:42:17 +02:00 committed by Daniel Stone
parent b5605ccd26
commit 509398dc25

View file

@ -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)