xdg-shell: Move "ping" and "pong" to xdg_shell, not xdg_surface
Responsivenes is a per-client thing so we move the ping/pong functionality
to xdg_shell. Having this per-window was carries over from the EWMH
protocol, where the WM has no other way to do this. In wayland, the
compositor can directly ping the client that owns the surface.
diff --git a/clients/window.c b/clients/window.c
index 91c1ea0..93aa368 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3844,12 +3844,6 @@
}
static void
-handle_surface_ping(void *data, struct xdg_surface *xdg_surface, uint32_t serial)
-{
- xdg_surface_pong(xdg_surface, serial);
-}
-
-static void
handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
int32_t width, int32_t height)
{
@@ -3910,7 +3904,6 @@
}
static const struct xdg_surface_listener xdg_surface_listener = {
- handle_surface_ping,
handle_surface_configure,
handle_surface_request_set_maximized,
handle_surface_request_unset_maximized,
@@ -4583,12 +4576,6 @@
}
static void
-handle_popup_ping(void *data, struct xdg_popup *xdg_popup, uint32_t serial)
-{
- xdg_popup_pong(xdg_popup, serial);
-}
-
-static void
handle_popup_popup_done(void *data, struct xdg_popup *xdg_popup, uint32_t serial)
{
struct window *window = data;
@@ -4599,7 +4586,6 @@
}
static const struct xdg_popup_listener xdg_popup_listener = {
- handle_popup_ping,
handle_popup_popup_done,
};
@@ -5024,6 +5010,16 @@
};
static void
+xdg_shell_ping(void *data, struct xdg_shell *shell, uint32_t serial)
+{
+ xdg_shell_pong(shell, serial);
+}
+
+static const struct xdg_shell_listener xdg_shell_listener = {
+ xdg_shell_ping,
+};
+
+static void
registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
{
@@ -5055,6 +5051,7 @@
d->xdg_shell = wl_registry_bind(registry, id,
&xdg_shell_interface, 1);
xdg_shell_use_unstable_version(d->xdg_shell, XDG_SHELL_VERSION_CURRENT);
+ xdg_shell_add_listener(d->xdg_shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "text_cursor_position") == 0) {
d->text_cursor_position =
wl_registry_bind(registry, id,