[gtk+] wayland: Make GdkWaylandDisplay public



commit 2b9f0b48174cb29ccd445a40e80c01fb1bb04782
Author: Jan Arne Petersen <jpetersen openismus com>
Date:   Sat Jan 19 23:43:27 2013 +0100

    wayland: Make GdkWaylandDisplay public
    
    Allows to access Wayland specific display information like wl_display
    etc.
    
    Add gdk_wayland_display_get_wl_display for getting the Wayland
    wl_display.

 gdk/wayland/Makefile.am          |    4 ++
 gdk/wayland/gdkdisplay-wayland.c |   70 +++++++++++++++++++++++++++++++++++---
 gdk/wayland/gdkdisplay-wayland.h |   12 ------
 gdk/wayland/gdkprivate-wayland.h |    1 +
 gdk/wayland/gdkwayland.h         |    4 ++
 gdk/wayland/gdkwaylanddisplay.h  |   53 ++++++++++++++++++++++++++++
 6 files changed, 127 insertions(+), 17 deletions(-)
---
diff --git a/gdk/wayland/Makefile.am b/gdk/wayland/Makefile.am
index 0169593..5033397 100644
--- a/gdk/wayland/Makefile.am
+++ b/gdk/wayland/Makefile.am
@@ -2,6 +2,7 @@
 include $(top_srcdir)/Makefile.decl
 
 libgdkincludedir = $(includedir)/gtk-3.0/gdk
+libgdkwaylandincludedir = $(includedir)/gtk-3.0/gdk/wayland
 
 AM_CPPFLAGS =					\
 	-DG_LOG_DOMAIN=\"Gdk\"			\
@@ -36,4 +37,7 @@ libgdk_wayland_la_SOURCES =			\
 libgdkinclude_HEADERS =				\
 	gdkwayland.h
 
+libgdkwaylandinclude_HEADERS = 			\
+	gdkwaylanddisplay.h
+
 -include $(top_srcdir)/git.mk
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 45e5d5a..dceb8e8 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -36,7 +36,7 @@
 
 static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display);
 
-G_DEFINE_TYPE (GdkWaylandDisplay, _gdk_wayland_display, GDK_TYPE_DISPLAY)
+G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
 
 static void
 gdk_input_init (GdkDisplay *display)
@@ -212,7 +212,7 @@ gdk_wayland_display_dispose (GObject *object)
       display_wayland->event_source = NULL;
     }
 
-  G_OBJECT_CLASS (_gdk_wayland_display_parent_class)->dispose (object);
+  G_OBJECT_CLASS (gdk_wayland_display_parent_class)->dispose (object);
 }
 
 static void
@@ -231,7 +231,7 @@ gdk_wayland_display_finalize (GObject *object)
 
   g_free (display_wayland->startup_notification_id);
 
-  G_OBJECT_CLASS (_gdk_wayland_display_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gdk_wayland_display_parent_class)->finalize (object);
 }
 
 static const gchar *
@@ -519,7 +519,7 @@ gdk_wayland_display_pop_error_trap (GdkDisplay *display,
 }
 
 static void
-_gdk_wayland_display_class_init (GdkWaylandDisplayClass * class)
+gdk_wayland_display_class_init (GdkWaylandDisplayClass * class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class);
@@ -574,7 +574,7 @@ _gdk_wayland_display_class_init (GdkWaylandDisplayClass * class)
 }
 
 static void
-_gdk_wayland_display_init (GdkWaylandDisplay *display)
+gdk_wayland_display_init (GdkWaylandDisplay *display)
 {
   _gdk_wayland_display_manager_add_display (gdk_display_manager_get (),
 					    GDK_DISPLAY (display));
@@ -612,3 +612,63 @@ _gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display,
   if (serial > wayland_display->serial)
     wayland_display->serial = serial;
 }
+
+/**
+ * gdk_wayland_display_get_wl_display
+ * @display: (type GdkWaylandDisplay): a #GdkDisplay
+ *
+ * Returns the Wayland wl_display of a #GdkDisplay
+ *
+ * Returns: (transfer none): a Wayland wl_display
+ *
+ * Since: 3.8
+ */
+struct wl_display *
+gdk_wayland_display_get_wl_display(GdkDisplay *display)
+{
+  GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
+
+  g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL);
+
+  return wayland_display->wl_display;
+}
+
+/**
+ * gdk_wayland_display_get_wl_compositor
+ * @display: (type GdkWaylandDisplay): a #GdkDisplay
+ *
+ * Returns the Wayland global singleton compositor of a #GdkDisplay
+ *
+ * Returns: (transfer none): a Wayland wl_compositor
+ *
+ * Since: 3.8
+ */
+struct wl_compositor *
+gdk_wayland_display_get_wl_compositor (GdkDisplay *display)
+{
+  GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
+
+  g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL);
+
+  return wayland_display->compositor;
+}
+
+/**
+ * gdk_wayland_display_get_wl_shell
+ * @display: (type GdkWaylandDisplay): a #GdkDisplay
+ *
+ * Returns the Wayland global singleton shell of a #GdkDisplay
+ *
+ * Returns: (transfer none): a Wayland wl_shell
+ *
+ * Since: 3.8
+ */
+struct wl_shell *
+gdk_wayland_display_get_wl_shell (GdkDisplay *display)
+{
+  GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
+
+  g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL);
+
+  return wayland_display->shell;
+}
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index ae95a17..fc90429 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -37,16 +37,6 @@
 
 G_BEGIN_DECLS
 
-typedef struct _GdkWaylandDisplay GdkWaylandDisplay;
-typedef struct _GdkWaylandDisplayClass GdkWaylandDisplayClass;
-
-#define GDK_TYPE_WAYLAND_DISPLAY              (_gdk_wayland_display_get_type())
-#define GDK_WAYLAND_DISPLAY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DISPLAY, GdkWaylandDisplay))
-#define GDK_WAYLAND_DISPLAY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DISPLAY, GdkWaylandDisplayClass))
-#define GDK_IS_WAYLAND_DISPLAY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DISPLAY))
-#define GDK_IS_WAYLAND_DISPLAY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DISPLAY))
-#define GDK_WAYLAND_DISPLAY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DISPLAY, GdkWaylandDisplayClass))
-
 struct _GdkWaylandDisplay
 {
   GdkDisplay parent_instance;
@@ -87,8 +77,6 @@ struct _GdkWaylandDisplayClass
   GdkDisplayClass parent_class;
 };
 
-GType      _gdk_wayland_display_get_type            (void);
-
 G_END_DECLS
 
 #endif				/* __GDK_WAYLAND_DISPLAY__ */
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 8a3161b..73810ca 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -31,6 +31,7 @@
 
 #include <gdk/gdkcursor.h>
 #include <gdk/gdkprivate.h>
+#include <gdk/wayland/gdkwayland.h>
 #include <gdk/wayland/gdkdisplay-wayland.h>
 
 #include <xkbcommon/xkbcommon.h>
diff --git a/gdk/wayland/gdkwayland.h b/gdk/wayland/gdkwayland.h
index 8464a5f..2b4b7b2 100644
--- a/gdk/wayland/gdkwayland.h
+++ b/gdk/wayland/gdkwayland.h
@@ -27,6 +27,10 @@
 
 #include <gdk/gdk.h>
 
+#define __GDKWAYLAND_H_INSIDE__
+
+#include <gdk/wayland/gdkwaylanddisplay.h>
+
 G_BEGIN_DECLS
 
 typedef struct _GdkWaylandDisplayManager GdkWaylandDisplayManager;
diff --git a/gdk/wayland/gdkwaylanddisplay.h b/gdk/wayland/gdkwaylanddisplay.h
new file mode 100644
index 0000000..336fff3
--- /dev/null
+++ b/gdk/wayland/gdkwaylanddisplay.h
@@ -0,0 +1,53 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2013 Jan Arne Petersen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GDK_WAYLAND_DISPLAY_H__
+#define __GDK_WAYLAND_DISPLAY_H__
+
+#if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwayland.h> can be included directly."
+#endif
+
+#include <gdk/gdk.h>
+
+#include <wayland-client.h>
+
+G_BEGIN_DECLS
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWaylandDisplay GdkWaylandDisplay;
+#else
+typedef GdkDisplay GdkWaylandDisplay;
+#endif
+typedef struct _GdkWaylandDisplayClass GdkWaylandDisplayClass;
+
+#define GDK_TYPE_WAYLAND_DISPLAY              (gdk_wayland_display_get_type())
+#define GDK_WAYLAND_DISPLAY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DISPLAY, GdkWaylandDisplay))
+#define GDK_WAYLAND_DISPLAY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DISPLAY, GdkWaylandDisplayClass))
+#define GDK_IS_WAYLAND_DISPLAY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DISPLAY))
+#define GDK_IS_WAYLAND_DISPLAY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DISPLAY))
+#define GDK_WAYLAND_DISPLAY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DISPLAY, GdkWaylandDisplayClass))
+
+GType                   gdk_wayland_display_get_type            (void);
+
+struct wl_display      *gdk_wayland_display_get_wl_display      (GdkDisplay *display);
+struct wl_compositor   *gdk_wayland_display_get_wl_compositor   (GdkDisplay *display);
+struct wl_shell        *gdk_wayland_display_get_wl_shell        (GdkDisplay *display);
+
+G_END_DECLS
+
+#endif /* __GDK_WAYLAND_DISPLAY_H__ */



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