[mutter] xwayland: Add 'window-associated' signal to role



commit 3a41b0f221de2f25bbf3a09f98a5c2dbaa01c02f
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Apr 1 20:57:19 2016 +0800

    xwayland: Add 'window-associated' signal to role
    
    When the Xwayland wl_surface is created, it may not yet be possible to
    associate it with the corresponding X11 Window. Add a signal to the
    Xwayland role to communicate with any interested parties.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771050

 src/wayland/meta-xwayland.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index b40bbcf..e3ab632 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -34,6 +34,14 @@
 
 #include "compositor/meta-surface-actor-wayland.h"
 
+enum {
+  XWAYLAND_SURFACE_WINDOW_ASSOCIATED,
+
+  XWAYLAND_SURFACE_LAST_SIGNAL
+};
+
+guint xwayland_surface_signals[XWAYLAND_SURFACE_LAST_SIGNAL];
+
 #define META_TYPE_WAYLAND_SURFACE_ROLE_XWAYLAND (meta_wayland_surface_role_xwayland_get_type ())
 G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleXWayland,
                       meta_wayland_surface_role_xwayland,
@@ -66,8 +74,11 @@ associate_window_with_surface (MetaWindow         *window,
       return;
     }
 
-  meta_wayland_surface_set_window (surface, window);
   window->surface = surface;
+  meta_wayland_surface_set_window (surface, window);
+  g_signal_emit (surface->role,
+                 xwayland_surface_signals[XWAYLAND_SURFACE_WINDOW_ASSOCIATED],
+                 0);
 
   meta_compositor_window_surface_changed (display->compositor, window);
 
@@ -652,4 +663,12 @@ meta_wayland_surface_role_xwayland_class_init (MetaWaylandSurfaceRoleXWaylandCla
   surface_role_class->assigned = xwayland_surface_assigned;
   surface_role_class->commit = xwayland_surface_commit;
   surface_role_class->get_toplevel = xwayland_surface_get_toplevel;
+
+  xwayland_surface_signals[XWAYLAND_SURFACE_WINDOW_ASSOCIATED] =
+    g_signal_new ("window-associated",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
 }


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