[gtk+] wayland: Make GdkWaylandWindow public



commit 01c0dd91821ac0eebccf1c0bfc644cde5b41c4a8
Author: Jan Arne Petersen <jpetersen openismus com>
Date:   Wed Jan 23 22:20:05 2013 +0100

    wayland: Make GdkWaylandWindow public
    
    Allows to access Wayland specific window information like wl_surface and
    wl_shell_surface.
    
    Add gdk_wayland_window_get_wl_surface for getting the Wayland wl_surface
    and gdk_wayland_window_get_wl_shell_surface for getting the Wayland
    wl_shell_surface.

 gdk/wayland/gdkdisplay-wayland.c |    2 +-
 gdk/wayland/gdkprivate-wayland.h |    1 -
 gdk/wayland/gdkwayland.h         |    1 +
 gdk/wayland/gdkwaylandwindow.h   |   52 ++++++++++++++++++++++++++++++++++++++
 gdk/wayland/gdkwindow-wayland.c  |   50 ++++++++++++++++++++++++++++++++++--
 5 files changed, 101 insertions(+), 5 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index dceb8e8..286634c 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -527,7 +527,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass * class)
   object_class->dispose = gdk_wayland_display_dispose;
   object_class->finalize = gdk_wayland_display_finalize;
 
-  display_class->window_type = _gdk_wayland_window_get_type ();
+  display_class->window_type = gdk_wayland_window_get_type ();
   display_class->get_name = gdk_wayland_display_get_name;
   display_class->get_n_screens = gdk_wayland_display_get_n_screens;
   display_class->get_screen = gdk_wayland_display_get_screen;
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 73810ca..37e52c1 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -45,7 +45,6 @@
 #define GDK_WINDOW_DISPLAY(win)       (GDK_SCREEN_WAYLAND (GDK_WINDOW_SCREEN (win))->display)
 #define GDK_WINDOW_IS_WAYLAND(win)    (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl))
 
-GType _gdk_wayland_window_get_type    (void);
 void _gdk_wayland_window_add_focus    (GdkWindow *window);
 void _gdk_wayland_window_remove_focus (GdkWindow *window);
 
diff --git a/gdk/wayland/gdkwayland.h b/gdk/wayland/gdkwayland.h
index 2b4b7b2..39f9741 100644
--- a/gdk/wayland/gdkwayland.h
+++ b/gdk/wayland/gdkwayland.h
@@ -30,6 +30,7 @@
 #define __GDKWAYLAND_H_INSIDE__
 
 #include <gdk/wayland/gdkwaylanddisplay.h>
+#include <gdk/wayland/gdkwaylandwindow.h>
 
 G_BEGIN_DECLS
 
diff --git a/gdk/wayland/gdkwaylandwindow.h b/gdk/wayland/gdkwaylandwindow.h
new file mode 100644
index 0000000..f0fb552
--- /dev/null
+++ b/gdk/wayland/gdkwaylandwindow.h
@@ -0,0 +1,52 @@
+/* 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_WINDOW_H__
+#define __GDK_WAYLAND_WINDOW_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 _GdkWaylandWindow GdkWaylandWindow;
+#else
+typedef GdkWindow GdkWaylandWindow;
+#endif
+typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass;
+
+#define GDK_TYPE_WAYLAND_WINDOW              (gdk_wayland_window_get_type())
+#define GDK_WAYLAND_WINDOW(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_WINDOW, GdkWaylandWindow))
+#define GDK_WAYLAND_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_WINDOW, GdkWaylandWindowClass))
+#define GDK_IS_WAYLAND_WINDOW(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_WINDOW))
+#define GDK_IS_WAYLAND_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_WINDOW))
+#define GDK_WAYLAND_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_WINDOW, GdkWaylandWindowClass))
+
+GType                    gdk_wayland_window_get_type             (void);
+
+struct wl_surface       *gdk_wayland_window_get_wl_surface       (GdkWindow *window);
+struct wl_shell_surface *gdk_wayland_window_get_wl_shell_surface (GdkWindow *window);
+
+G_END_DECLS
+
+#endif /* __GDK_WAYLAND_WINDOW_H__ */
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 088c59c..e93b4e3 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -66,15 +66,15 @@ struct _GdkWaylandWindowClass {
   GdkWindowClass parent_class;
 };
 
-G_DEFINE_TYPE (GdkWaylandWindow, _gdk_wayland_window, GDK_TYPE_WINDOW)
+G_DEFINE_TYPE (GdkWaylandWindow, gdk_wayland_window, GDK_TYPE_WINDOW)
 
 static void
-_gdk_wayland_window_class_init (GdkWaylandWindowClass *wayland_window_class)
+gdk_wayland_window_class_init (GdkWaylandWindowClass *wayland_window_class)
 {
 }
 
 static void
-_gdk_wayland_window_init (GdkWaylandWindow *wayland_window)
+gdk_wayland_window_init (GdkWaylandWindow *wayland_window)
 {
 }
 
@@ -1665,3 +1665,47 @@ _gdk_wayland_window_set_device_grabbed (GdkWindow      *window,
   impl->grab_input_seat = seat;
   impl->grab_time = time_;
 }
+
+/**
+ * gdk_wayland_window_get_wl_surface
+ * @window: (type GdkWaylandWindow): a #GdkWindow
+ *
+ * Returns the Wayland surface of a #GdkWindow
+ *
+ * Returns: (transfer none): a Wayland wl_surface
+ *
+ * Since: 3.8
+ */
+struct wl_surface *
+gdk_wayland_window_get_wl_surface (GdkWindow *window)
+{
+  GdkWindowImplWayland *impl;
+
+  g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
+
+  impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+
+  return impl->surface;
+}
+
+/**
+ * gdk_wayland_window_get_wl_shell_surface
+ * @window: (type GdkWaylandWindow): a #GdkWindow
+ *
+ * Returns the Wayland shell surface of a #GdkWindow
+ *
+ * Returns: (transfer none): a Wayland wl_shell_surface
+ *
+ * Since: 3.8
+ */
+struct wl_shell_surface *
+gdk_wayland_window_get_wl_shell_surface (GdkWindow *window)
+{
+  GdkWindowImplWayland *impl;
+
+  g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
+
+  impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+
+  return impl->shell_surface;
+}



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