[mutter/wayland] window: Support pinging Wayland surfaces as well



commit 6d639ac528570c6d88c1cf9049e1d237d46fe0f6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Nov 21 14:20:52 2013 -0500

    window: Support pinging Wayland surfaces as well

 src/core/window.c                  |    8 +++++---
 src/wayland/meta-wayland-surface.c |   18 ++++++++++++++++++
 src/wayland/meta-wayland-surface.h |    3 +++
 3 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 532ae0c..622168a 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -12169,7 +12169,9 @@ meta_window_ping (MetaWindow        *window,
   meta_topic (META_DEBUG_PING,
               "Sending ping with timestamp %u to window %s\n",
               timestamp, window->desc);
-  meta_window_send_icccm_message (window,
-                                  display->atom__NET_WM_PING,
-                                  timestamp);
+
+  if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
+    meta_window_send_icccm_message (window, display->atom__NET_WM_PING, timestamp);
+  else
+    meta_wayland_surface_ping (window->surface, timestamp);
 }
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 71e3512..597ee03 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -566,6 +566,10 @@ xdg_surface_pong (struct wl_client *client,
                   struct wl_resource *resource,
                   guint32 serial)
 {
+  MetaWaylandSurfaceExtension *xdg_surface = wl_resource_get_user_data (resource);
+  MetaWaylandSurface *surface = wl_container_of (xdg_surface, surface, xdg_surface);
+
+  meta_window_pong (surface->window, serial);
 }
 
 static gboolean
@@ -769,6 +773,10 @@ xdg_popup_pong (struct wl_client *client,
                 struct wl_resource *resource,
                 uint32_t serial)
 {
+  MetaWaylandSurfaceExtension *xdg_popup = wl_resource_get_user_data (resource);
+  MetaWaylandSurface *surface = wl_container_of (xdg_popup, surface, xdg_popup);
+
+  meta_window_pong (surface->window, serial);
 }
 
 static const struct xdg_popup_interface meta_wayland_xdg_popup_interface = {
@@ -940,3 +948,13 @@ meta_wayland_surface_focused_unset (MetaWaylandSurface *surface)
   if (surface->xdg_surface.resource)
     xdg_surface_send_focused_unset (surface->xdg_surface.resource);
 }
+
+void
+meta_wayland_surface_ping (MetaWaylandSurface *surface,
+                           guint32             timestamp)
+{
+  if (surface->xdg_surface.resource)
+    xdg_surface_send_ping (surface->xdg_surface.resource, timestamp);
+  else if (surface->xdg_popup.resource)
+    xdg_popup_send_ping (surface->xdg_popup.resource, timestamp);
+}
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index 3d043cd..25b4939 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -102,4 +102,7 @@ void                meta_wayland_surface_configure_notify (MetaWaylandSurface *s
 void                meta_wayland_surface_focused_set (MetaWaylandSurface *surface);
 void                meta_wayland_surface_focused_unset (MetaWaylandSurface *surface);
 
+void                meta_wayland_surface_ping (MetaWaylandSurface *surface,
+                                               guint32             serial);
+
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]