summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2016-10-11 16:53:48 -0400
committerWilliam Hua <william.hua@canonical.com>2017-01-05 17:57:36 -0500
commitdcda372c15f5c6585331bb9bbd2b27f5d13b30e6 (patch)
tree0df63a0d5a8f02f6a7628207ceac2cf0da1112f9
parent440e80c832b8ef2fd3d8a73993c9fa8ba6192fa2 (diff)
downloadgtk+-dcda372c15f5c6585331bb9bbd2b27f5d13b30e6.tar.gz
mir: connect to content-hub
https://bugzilla.gnome.org/show_bug.cgi?id=775732
-rw-r--r--configure.ac2
-rw-r--r--gdk/mir/gdkmirdisplay.c42
2 files changed, 43 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 02dbd491fc..a521843eae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -470,7 +470,7 @@ else
AM_CONDITIONAL(USE_WAYLAND, false)
fi
-MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version"
+MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version libcontent-hub-glib"
if test "$enable_mir_backend" = "maybe" ; then
PKG_CHECK_EXISTS($MIR_DEPENDENCIES, [have_mir_deps=yes], [have_mir_deps=no])
AC_MSG_CHECKING([for MIR_DEPENDENCIES])
diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c
index 0e37794afe..389c7e6e8d 100644
--- a/gdk/mir/gdkmirdisplay.c
+++ b/gdk/mir/gdkmirdisplay.c
@@ -24,6 +24,8 @@
#include "gdkmir.h"
#include "gdkmir-private.h"
+#include <com/ubuntu/content/glib/content-hub-glib.h>
+
#define GDK_TYPE_DISPLAY_MIR (gdk_mir_display_get_type ())
#define GDK_MIR_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MIR, GdkMirDisplay))
#define GDK_MIR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_MIR, GdkMirDisplayClass))
@@ -61,6 +63,9 @@ typedef struct GdkMirDisplay
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_surfaceless_context : 1;
+
+ ContentHubService *content_service;
+ ContentHubHandler *content_handler;
} GdkMirDisplay;
typedef struct GdkMirDisplayClass
@@ -160,6 +165,7 @@ _gdk_mir_display_open (const gchar *display_name)
MirConnection *connection;
MirPixelFormat sw_pixel_format, hw_pixel_format;
GdkMirDisplay *display;
+ GDBusConnection *session;
//g_printerr ("gdk_mir_display_open\n");
@@ -195,6 +201,39 @@ _gdk_mir_display_open (const gchar *display_name)
display->sw_pixel_format = sw_pixel_format;
display->hw_pixel_format = hw_pixel_format;
+ session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+
+ display->content_service = content_hub_service_proxy_new_sync (
+ session,
+ G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES,
+ "com.ubuntu.content.dbus.Service",
+ "/",
+ NULL,
+ NULL);
+
+ display->content_handler = content_hub_handler_skeleton_new ();
+
+ g_dbus_interface_skeleton_export (
+ G_DBUS_INTERFACE_SKELETON (display->content_handler),
+ session,
+ "/org/gnome/gtk/content/handler",
+ NULL);
+
+ g_object_unref (session);
+
+ content_hub_service_call_register_import_export_handler_sync (
+ display->content_service,
+ g_application_get_application_id (g_application_get_default ()),
+ "/org/gnome/gtk/content/handler",
+ NULL,
+ NULL);
+
+ content_hub_service_call_handler_active_sync (
+ display->content_service,
+ g_application_get_application_id (g_application_get_default ()),
+ NULL,
+ NULL);
+
g_signal_emit_by_name (display, "opened");
return GDK_DISPLAY (display);
@@ -230,6 +269,9 @@ gdk_mir_display_dispose (GObject *object)
{
GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
+ g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (display->content_handler));
+ g_clear_object (&display->content_handler);
+ g_clear_object (&display->content_service);
g_clear_object (&display->screen);
g_clear_object (&display->keymap);
g_clear_pointer (&display->event_source, g_source_unref);