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>
dev
Marius Vlad 3 years ago committed by Daniel Stone
parent b5605ccd26
commit 509398dc25
  1. 8
      desktop-shell/shell.c

@ -3678,16 +3678,18 @@ activate(struct desktop_shell *shell, struct weston_view *view,
weston_view_activate_input(view, seat, flags); 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 = struct shell_surface *current_focus =
get_shell_surface(shseat->focused_surface); get_shell_surface(shseat->focused_surface);
assert(current_focus); assert(current_focus);
shell_surface_deactivate(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; shseat->focused_surface = main_surface;
shell_surface_activate(shsurf); }
state = ensure_focus_state(shell, seat); state = ensure_focus_state(shell, seat);
if (state == NULL) if (state == NULL)

Loading…
Cancel
Save