[gtk+/wip/attente/mir-content-hub: 2/4] mir: watch for pasteboard changes



commit 7bc3426c571f2ccb012dd781e123841cea048422
Author: William Hua <william hua canonical com>
Date:   Sat Oct 15 22:19:59 2016 +0200

    mir: watch for pasteboard changes

 gdk/mir/gdkmirdisplay.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c
index bf79465..12a4581 100644
--- a/gdk/mir/gdkmirdisplay.c
+++ b/gdk/mir/gdkmirdisplay.c
@@ -62,6 +62,7 @@ typedef struct GdkMirDisplay
 
   ContentHubService *content_service;
   ContentHubHandler *content_handler;
+  GVariant *paste_data;
 } GdkMirDisplay;
 
 typedef struct GdkMirDisplayClass
@@ -107,6 +108,13 @@ static void get_pixel_formats (MirConnection *, MirPixelFormat *sw, MirPixelForm
 
 G_DEFINE_TYPE (GdkMirDisplay, gdk_mir_display, GDK_TYPE_DISPLAY)
 
+static void
+pasteboard_changed_cb (GdkMirDisplay *display,
+                       gpointer       user_data)
+{
+  g_clear_pointer (&display->paste_data, g_variant_unref);
+}
+
 GdkDisplay *
 _gdk_mir_display_open (const gchar *display_name)
 {
@@ -156,6 +164,12 @@ _gdk_mir_display_open (const gchar *display_name)
     NULL,
     NULL);
 
+  g_signal_connect_swapped (
+    display->content_service,
+    "pasteboard-changed",
+    G_CALLBACK (pasteboard_changed_cb),
+    display);
+
   display->content_handler = content_hub_handler_skeleton_new ();
 
   g_dbus_interface_skeleton_export (
@@ -214,6 +228,7 @@ gdk_mir_display_dispose (GObject *object)
 {
   GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
 
+  g_clear_pointer (&display->paste_data, g_variant_unref);
   g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (display->content_handler));
   g_clear_object (&display->content_handler);
   g_clear_object (&display->content_service);


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