[mutter/wayland] xwayland: Split a helper out



commit 9653b79a358230d1c7b1e2d5ca38d93c12f64ca4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Apr 2 10:19:39 2014 -0400

    xwayland: Split a helper out
    
    This will make the next commit, which ports to the new ClientMessage
    API, more understandable.

 src/wayland/meta-xwayland.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 4fcadcf..ada9c26 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -38,18 +38,10 @@
 #include "xserver-server-protocol.h"
 
 static void
-xserver_set_window_id (struct wl_client *client,
-                       struct wl_resource *compositor_resource,
-                       struct wl_resource *surface_resource,
-                       guint32 xid)
+associate_window_with_surface (MetaWindow         *window,
+                               MetaWaylandSurface *surface)
 {
-  MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
-  MetaDisplay *display = meta_get_display ();
-  MetaWindow *window;
-
-  window = meta_display_lookup_x_window (display, xid);
-  if (!window)
-    return;
+  MetaDisplay *display = window->display;
 
   /* If the window has an existing surface, like if we're
    * undecorating or decorating the window, then we need
@@ -64,6 +56,23 @@ xserver_set_window_id (struct wl_client *client,
   meta_compositor_window_surface_changed (display->compositor, window);
 }
 
+static void
+xserver_set_window_id (struct wl_client *client,
+                       struct wl_resource *compositor_resource,
+                       struct wl_resource *surface_resource,
+                       guint32 xid)
+{
+  MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
+  MetaDisplay *display = meta_get_display ();
+  MetaWindow *window;
+
+  window = meta_display_lookup_x_window (display, xid);
+  if (!window)
+    return;
+
+  associate_window_with_surface (window, surface);
+}
+
 static const struct xserver_interface xserver_implementation = {
   xserver_set_window_id
 };


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