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.
This commit is contained in:
Jan Arne Petersen 2013-01-23 22:20:05 +01:00
parent 2b9f0b4817
commit 01c0dd9182
5 changed files with 101 additions and 5 deletions

View 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;

View 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);

View File

@ -30,6 +30,7 @@
#define __GDKWAYLAND_H_INSIDE__
#include <gdk/wayland/gdkwaylanddisplay.h>
#include <gdk/wayland/gdkwaylandwindow.h>
G_BEGIN_DECLS

View File

@ -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__ */

View 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;
}