From 6845eade491d9ca5159fcaf89a4a90ba3995b7a1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 16 Feb 2014 10:25:22 -0500 Subject: [PATCH] wayland: Update to new xdg-shell pinging standards --- gdk/wayland/gdkdisplay-wayland.c | 17 +++++++++ gdk/wayland/gdkwindow-wayland.c | 31 ----------------- gdk/wayland/protocol/xdg-shell.xml | 56 ++++++++++++------------------ 3 files changed, 40 insertions(+), 64 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index b7de77b3c3..3df219dc02 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -144,6 +144,22 @@ wait_for_roundtrip(GdkWaylandDisplay *display) wl_callback_add_listener(callback, &init_sync_listener, display); } +static void +xdg_shell_ping (void *data, + struct xdg_shell *xdg_shell, + uint32_t serial) +{ + GdkWaylandDisplay *wayland_display = data; + + _gdk_wayland_display_update_serial (wayland_display, serial); + + xdg_shell_pong (xdg_shell, serial); +} + +static const struct xdg_shell_listener xdg_shell_listener = { + xdg_shell_ping, +}; + static void gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) @@ -167,6 +183,7 @@ gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id display_wayland->xdg_shell = wl_registry_bind(display_wayland->wl_registry, id, &xdg_shell_interface, 1); xdg_shell_use_unstable_version(display_wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT); + xdg_shell_add_listener(display_wayland->xdg_shell, &xdg_shell_listener, display_wayland); } else if (strcmp(interface, "gtk_shell") == 0) { display_wayland->gtk_shell = wl_registry_bind(display_wayland->wl_registry, id, >k_shell_interface, 1); diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index ab5953f320..b799803a67 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -923,21 +923,6 @@ gdk_wayland_window_create_surface (GdkWindow *window) &surface_listener, window); } -static void -xdg_surface_ping (void *data, - struct xdg_surface *xdg_surface, - uint32_t serial) -{ - - GdkWindow *window = GDK_WINDOW (data); - GdkWaylandDisplay *wayland_display = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - - _gdk_wayland_display_update_serial (wayland_display, serial); - - xdg_surface_pong (xdg_surface, serial); -} - static void xdg_surface_configure (void *data, struct xdg_surface *xdg_surface, @@ -1024,7 +1009,6 @@ xdg_surface_delete (void *data, } static const struct xdg_surface_listener xdg_surface_listener = { - xdg_surface_ping, xdg_surface_configure, xdg_surface_request_set_fullscreen, xdg_surface_request_unset_fullscreen, @@ -1049,20 +1033,6 @@ gdk_wayland_window_create_xdg_surface (GdkWindow *window) xdg_surface_set_app_id (impl->xdg_surface, gdk_get_program_class ()); } -static void -xdg_popup_ping (void *data, - struct xdg_popup *xdg_popup, - uint32_t serial) -{ - GdkWindow *window = GDK_WINDOW (data); - GdkWaylandDisplay *wayland_display = - GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); - - _gdk_wayland_display_update_serial (wayland_display, serial); - - xdg_popup_pong (xdg_popup, serial); -} - static void xdg_popup_done (void *data, struct xdg_popup *xdg_popup, @@ -1078,7 +1048,6 @@ xdg_popup_done (void *data, } static const struct xdg_popup_listener xdg_popup_listener = { - xdg_popup_ping, xdg_popup_done, }; diff --git a/gdk/wayland/protocol/xdg-shell.xml b/gdk/wayland/protocol/xdg-shell.xml index f0d04aa34a..ef755b720e 100644 --- a/gdk/wayland/protocol/xdg-shell.xml +++ b/gdk/wayland/protocol/xdg-shell.xml @@ -43,7 +43,7 @@ Use this enum to check the protocol version, and it will be updated automatically. - + @@ -84,6 +84,28 @@ + + + + The ping event asks the client if it's still alive. Pass the + serial specified in the event back to the compositor by sending + a "pong" request back with the specified serial. + + Compositors can use this to determine if the client is still + alive. It's unspecified what will happen if the client doesn't + respond to the ping request, or in what timeframe. Clients should + try to respond in a reasonable amount of time. + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. + + + @@ -176,22 +198,6 @@ - - - A client must respond to a ping event with a pong request or - the client may be deemed unresponsive. - - - - - - - Ping a client to check if it is receiving events and sending - requests. A client is expected to reply with a pong request. - - - - Start a pointer-driven move of the surface. @@ -447,22 +453,6 @@ - - - A client must respond to a ping event with a pong request or - the client may be deemed unresponsive. - - - - - - - Ping a client to check if it is receiving events and sending - requests. A client is expected to reply with a pong request. - - - - The popup_done event is sent out when a popup grab is broken,