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.
This commit is contained in:
Benjamin Otte 2013-04-19 16:17:17 -04:00
parent edfaeba32b
commit a6a4428f23
7 changed files with 24 additions and 56 deletions

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -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

View File

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

View File

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