[gtk+] gdk: Unvfuncify gdk_display_manager_open_display()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Unvfuncify gdk_display_manager_open_display()
- Date: Fri, 19 Apr 2013 20:27:37 +0000 (UTC)
commit a6a4428f2313f345071c98f98468fbcc03b5252c
Author: Benjamin Otte <otte redhat com>
Date: Fri Apr 19 16:17:17 2013 -0400
gdk: Unvfuncify gdk_display_manager_open_display()
This looks like a pretty stupid patch, but it's only a step towards the
ultimate end goal: Get rid of all the displaymanagers.
gdk/broadway/gdkdisplaymanager-broadway.c | 10 ----------
gdk/gdkdisplaymanager.c | 30 ++++++++++++++++++++++++------
gdk/gdkdisplaymanagerprivate.h | 3 ---
gdk/quartz/gdkdisplaymanager-quartz.c | 8 --------
gdk/wayland/gdkdisplaymanager-wayland.c | 10 ----------
gdk/win32/gdkdisplaymanager-win32.c | 9 ---------
gdk/x11/gdkdisplaymanager-x11.c | 10 ----------
7 files changed, 24 insertions(+), 56 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplaymanager-broadway.c b/gdk/broadway/gdkdisplaymanager-broadway.c
index 2ed5b96..66e4717 100644
--- a/gdk/broadway/gdkdisplaymanager-broadway.c
+++ b/gdk/broadway/gdkdisplaymanager-broadway.c
@@ -81,13 +81,6 @@ g_initable_iface_init (GInitableIface *iface)
iface->init = gdk_broadway_display_manager_initable_init;
}
-static GdkDisplay *
-gdk_broadway_display_manager_open_display (GdkDisplayManager *manager,
- const gchar *name)
-{
- return _gdk_broadway_display_open (name);
-}
-
static void
gdk_broadway_display_manager_init (GdkBroadwayDisplayManager *manager)
{
@@ -105,9 +98,6 @@ static void
gdk_broadway_display_manager_class_init (GdkBroadwayDisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_broadway_display_manager_finalize;
-
- manager_class->open_display = gdk_broadway_display_manager_open_display;
}
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index 063aff2..47b3760 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -34,6 +34,7 @@
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
+#include "x11/gdkprivate-x11.h"
#endif
#ifdef GDK_WINDOWING_QUARTZ
@@ -42,18 +43,22 @@
* "generic" GDK source code.
*/
#include "quartz/gdkquartzdisplaymanager.h"
+#include "quartz/gdkprivate-quartz.h"
#endif
#ifdef GDK_WINDOWING_BROADWAY
#include "broadway/gdkbroadwaydisplaymanager.h"
+#include "broadway/gdkprivate-broadway.h"
#endif
#ifdef GDK_WINDOWING_WIN32
#include "win32/gdkwin32.h"
+#include "win32/gdkprivate-win32.h"
#endif
#ifdef GDK_WINDOWING_WAYLAND
#include "wayland/gdkwayland.h"
+#include "wayland/gdkprivate-wayland.h"
#endif
/**
@@ -301,23 +306,24 @@ typedef struct _GdkBackend GdkBackend;
struct _GdkBackend {
const char *name;
GType (* get_backend_type) (void);
+ GdkDisplay * (* open_display) (const char *name);
};
GdkBackend gdk_backends[] = {
#ifdef GDK_WINDOWING_QUARTZ
- { "quartz", gdk_quartz_display_manager_get_type },
+ { "quartz", gdk_quartz_display_manager_get_type, _gdk_quartz_display_open },
#endif
#ifdef GDK_WINDOWING_WIN32
- { "win32", gdk_quartz_display_manager_get_type },
+ { "win32", gdk_win32_display_manager_get_type, _gdk_win32_display_open },
#endif
#ifdef GDK_WINDOWING_X11
- { "x11", gdk_x11_display_manager_get_type },
+ { "x11", gdk_x11_display_manager_get_type, _gdk_x11_display_open },
#endif
#ifdef GDK_WINDOWING_WAYLAND
- { "wayland", gdk_wayland_display_manager_get_type },
+ { "wayland", gdk_wayland_display_manager_get_type, _gdk_wayland_display_open },
#endif
#ifdef GDK_WINDOWING_BROADWAY
- { "broadway", gdk_broadway_display_manager_get_type },
+ { "broadway", gdk_broadway_display_manager_get_type, _gdk_broadway_display_open },
#endif
/* NULL-terminating this array so we can use commas above */
{ NULL, NULL }
@@ -494,7 +500,19 @@ GdkDisplay *
gdk_display_manager_open_display (GdkDisplayManager *manager,
const gchar *name)
{
- return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->open_display (manager, name);
+ guint i;
+
+ for (i = 0; gdk_backends[i].name != NULL; i++)
+ {
+ if (G_OBJECT_TYPE (manager) == gdk_backends[i].get_backend_type ())
+ {
+ return gdk_backends[i].open_display (name);
+ }
+ }
+
+ g_assert_not_reached ();
+
+ return NULL;
}
void
diff --git a/gdk/gdkdisplaymanagerprivate.h b/gdk/gdkdisplaymanagerprivate.h
index 0f6d4b2..5ec3f01 100644
--- a/gdk/gdkdisplaymanagerprivate.h
+++ b/gdk/gdkdisplaymanagerprivate.h
@@ -41,9 +41,6 @@ struct _GdkDisplayManagerClass
{
GObjectClass parent_class;
- GdkDisplay * (*open_display) (GdkDisplayManager *manager,
- const gchar *name);
-
/* signals */
void (*display_opened) (GdkDisplayManager *manager,
GdkDisplay *display);
diff --git a/gdk/quartz/gdkdisplaymanager-quartz.c b/gdk/quartz/gdkdisplaymanager-quartz.c
index 4756cd0..f278ab3 100644
--- a/gdk/quartz/gdkdisplaymanager-quartz.c
+++ b/gdk/quartz/gdkdisplaymanager-quartz.c
@@ -40,13 +40,6 @@ struct _GdkQuartzDisplayManager
G_DEFINE_TYPE (GdkQuartzDisplayManager, gdk_quartz_display_manager, GDK_TYPE_DISPLAY_MANAGER)
-static GdkDisplay *
-gdk_quartz_display_manager_open_display (GdkDisplayManager *manager,
- const gchar *name)
-{
- return _gdk_quartz_display_open (name);
-}
-
static void
gdk_quartz_display_manager_init (GdkQuartzDisplayManager *manager)
{
@@ -79,7 +72,6 @@ gdk_quartz_display_manager_class_init (GdkQuartzDisplayManagerClass *class)
object_class->finalize = gdk_quartz_display_manager_finalize;
- manager_class->open_display = gdk_quartz_display_manager_open_display;
manager_class->atom_intern = _gdk_quartz_display_manager_atom_intern;
manager_class->get_atom_name = _gdk_quartz_display_manager_get_atom_name;
}
diff --git a/gdk/wayland/gdkdisplaymanager-wayland.c b/gdk/wayland/gdkdisplaymanager-wayland.c
index 902ac16..32b2018 100644
--- a/gdk/wayland/gdkdisplaymanager-wayland.c
+++ b/gdk/wayland/gdkdisplaymanager-wayland.c
@@ -88,22 +88,12 @@ gdk_wayland_display_manager_finalize (GObject *object)
G_OBJECT_CLASS (gdk_wayland_display_manager_parent_class)->finalize (object);
}
-static GdkDisplay *
-gdk_wayland_display_manager_open_display (GdkDisplayManager *manager,
- const gchar *name)
-{
- return _gdk_wayland_display_open (name);
-}
-
static void
gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_wayland_display_manager_finalize;
-
- manager_class->open_display = gdk_wayland_display_manager_open_display;
}
static void
diff --git a/gdk/win32/gdkdisplaymanager-win32.c b/gdk/win32/gdkdisplaymanager-win32.c
index 8907dec..0e5f711 100644
--- a/gdk/win32/gdkdisplaymanager-win32.c
+++ b/gdk/win32/gdkdisplaymanager-win32.c
@@ -38,13 +38,6 @@ struct _GdkWin32DisplayManagerClass
G_DEFINE_TYPE (GdkWin32DisplayManager, gdk_win32_display_manager, GDK_TYPE_DISPLAY_MANAGER)
-static GdkDisplay *
-gdk_win32_display_manager_open_display (GdkDisplayManager *manager,
- const gchar *name)
-{
- return _gdk_win32_display_open (name);
-}
-
static void
gdk_win32_display_manager_init (GdkWin32DisplayManager *manager)
{
@@ -69,11 +62,9 @@ static void
gdk_win32_display_manager_class_init (GdkWin32DisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_win32_display_manager_finalize;
- manager_class->open_display = gdk_win32_display_manager_open_display;
#if 0
manager_class->atom_intern = _gdk_win32_display_manager_atom_intern;
manager_class->get_atom_name = _gdk_win32_display_manager_get_atom_name;
diff --git a/gdk/x11/gdkdisplaymanager-x11.c b/gdk/x11/gdkdisplaymanager-x11.c
index 59f270b..5393cad 100644
--- a/gdk/x11/gdkdisplaymanager-x11.c
+++ b/gdk/x11/gdkdisplaymanager-x11.c
@@ -72,13 +72,6 @@ g_initable_iface_init (GInitableIface *iface)
}
-static GdkDisplay *
-gdk_x11_display_manager_open_display (GdkDisplayManager *manager,
- const gchar *name)
-{
- return _gdk_x11_display_open (name);
-}
-
static void
gdk_x11_display_manager_init (GdkX11DisplayManager *manager)
{
@@ -97,9 +90,6 @@ static void
gdk_x11_display_manager_class_init (GdkX11DisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_x11_display_manager_finalize;
-
- manager_class->open_display = gdk_x11_display_manager_open_display;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]