xdg-shell: Turn "activated" into a state
This drops two events, and makes new window decorations race-free with
an attach in-flight.
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index d7cd9c8..1704b84 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2009,16 +2009,14 @@
shell_surface_lose_keyboard_focus(struct shell_surface *shsurf)
{
if (--shsurf->focus_count == 0)
- if (shell_surface_is_xdg_surface(shsurf))
- xdg_surface_send_deactivated(shsurf->resource);
+ shell_surface_state_changed(shsurf);
}
static void
shell_surface_gain_keyboard_focus(struct shell_surface *shsurf)
{
if (shsurf->focus_count++ == 0)
- if (shell_surface_is_xdg_surface(shsurf))
- xdg_surface_send_activated(shsurf->resource);
+ shell_surface_state_changed(shsurf);
}
static void
@@ -3557,6 +3555,10 @@
s = wl_array_add(&states, sizeof *s);
*s = XDG_SURFACE_STATE_RESIZING;
}
+ if (shsurf->focus_count > 0) {
+ s = wl_array_add(&states, sizeof *s);
+ *s = XDG_SURFACE_STATE_ACTIVATED;
+ }
serial = wl_display_next_serial(shsurf->surface->compositor->wl_display);
xdg_surface_send_configure(shsurf->resource, width, height, &states, serial);