Commit 2b9f0b48 authored by Jan Arne Petersen's avatar Jan Arne Petersen

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.
parent db986ddc
......@@ -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
......@@ -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;
}
......@@ -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__ */
......@@ -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>
......
......@@ -27,6 +27,10 @@
#include <gdk/gdk.h>
#define __GDKWAYLAND_H_INSIDE__
#include <gdk/wayland/gdkwaylanddisplay.h>
G_BEGIN_DECLS
typedef struct _GdkWaylandDisplayManager GdkWaylandDisplayManager;
......
/* 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__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment