wayland: Update to new xdg-shell pinging standards

This commit is contained in:
Jasper St. Pierre
2014-02-16 10:25:22 -05:00
parent fd183f58f6
commit 6845eade49
3 changed files with 40 additions and 64 deletions

View File

@ -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, &gtk_shell_interface, 1);

View File

@ -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,
};

View File

@ -43,7 +43,7 @@
Use this enum to check the protocol version, and it will be updated
automatically.
</description>
<entry name="current" value="1" summary="Always the latest version"/>
<entry name="current" value="2" summary="Always the latest version"/>
</enum>
@ -84,6 +84,28 @@
<arg name="y" type="int"/>
<arg name="flags" type="uint"/>
</request>
<event name="ping">
<description summary="check if the client is alive">
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.
</description>
<arg name="serial" type="uint" summary="pass this to the callback"/>
</event>
<request name="pong">
<description summary="respond to a ping event">
A client must respond to a ping event with a pong request or
the client may be deemed unresponsive.
</description>
<arg name="serial" type="uint" summary="serial of the ping event"/>
</request>
</interface>
<interface name="xdg_surface" version="1">
@ -176,22 +198,6 @@
<arg name="app_id" type="string"/>
</request>
<request name="pong">
<description summary="respond to a ping event">
A client must respond to a ping event with a pong request or
the client may be deemed unresponsive.
</description>
<arg name="serial" type="uint" summary="serial of the ping event"/>
</request>
<event name="ping">
<description summary="ping client">
Ping a client to check if it is receiving events and sending
requests. A client is expected to reply with a pong request.
</description>
<arg name="serial" type="uint"/>
</event>
<request name="move">
<description summary="start an interactive move">
Start a pointer-driven move of the surface.
@ -447,22 +453,6 @@
</description>
</request>
<request name="pong">
<description summary="respond to a ping event">
A client must respond to a ping event with a pong request or
the client may be deemed unresponsive.
</description>
<arg name="serial" type="uint" summary="serial of the ping event"/>
</request>
<event name="ping">
<description summary="ping client">
Ping a client to check if it is receiving events and sending
requests. A client is expected to reply with a pong request.
</description>
<arg name="serial" type="uint"/>
</event>
<event name="popup_done">
<description summary="popup interaction is done">
The popup_done event is sent out when a popup grab is broken,