]> Pileus Git - ~andy/gtk/commitdiff
wayland: Make GdkWaylandWindow public
authorJan Arne Petersen <jpetersen@openismus.com>
Wed, 23 Jan 2013 21:20:05 +0000 (22:20 +0100)
committerJan Arne Petersen <jpetersen@openismus.com>
Wed, 23 Jan 2013 21:26:27 +0000 (22:26 +0100)
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
gdk/wayland/gdkprivate-wayland.h
gdk/wayland/gdkwayland.h
gdk/wayland/gdkwaylandwindow.h [new file with mode: 0644]
gdk/wayland/gdkwindow-wayland.c

index dceb8e83b4989e4f939e5e44a16d10c4ba0ff5a6..286634c0124065bf5ff7f14a6add3e75bafef6a0 100644 (file)
@@ -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;
index 73810cacdaba0b46291d3ac678dcc2a9934d7ad1..37e52c17c3458e702d0f0da1876ec80bd15c6e4f 100644 (file)
@@ -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);
 
index 2b4b7b247b9c4fd7e4ac3222fa7de7016d11a5a8..39f9741837f4e24f530a67508dd0e9214994444f 100644 (file)
@@ -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 (file)
index 0000000..f0fb552
--- /dev/null
@@ -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__ */
index 088c59cf76a233c2e8f94bb536a6eac3686827d6..e93b4e3352b1297d207f8b92e3332f31e6b666f9 100644 (file)
@@ -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;
+}