Use G_DEFINE_TYPE.

2006-04-04  Matthias Clasen  <mclasen@redhat.com>

	* gdk/gdkdisplay.c:
	* gdk/gdkdisplaymanager.c:
	* gdk/gdkdraw.c:
	* gdk/gdkkeys.c:
	* gdk/gdkpixmap.c:
	* gdk/gdkscreen.c:
	* gdk/gdkwindow.c:
	* gdk/x11/gdkcolor-x11.c:
	* gdk/x11/gdkdisplay-x11.c:
	* gdk/x11/gdkdnd-x11.c:
	* gdk/x11/gdkdrawable-x11.c:
	* gdk/x11/gdkgc-x11.c:
	* gdk/x11/gdkimage-x11.c:
	* gdk/x11/gdkinput.c:
	* gdk/x11/gdkpixmap-x11.c:
	* gdk/x11/gdkscreen-x11.c:
	* gdk/x11/gdkwindow-x11.c: Use G_DEFINE_TYPE.

	* gdk/x11/gdkcolor-x11.c:
	* gdk/x11/gdkdnd-x11.c:
	* gdk/x11/gdkimage-x11.c: Use instance private data.
This commit is contained in:
Matthias Clasen 2006-04-04 14:02:03 +00:00 committed by Matthias Clasen
parent 7d49b31a79
commit 10f0736ac7
19 changed files with 162 additions and 562 deletions

View File

@ -1,3 +1,27 @@
2006-04-04 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkdisplay.c:
* gdk/gdkdisplaymanager.c:
* gdk/gdkdraw.c:
* gdk/gdkkeys.c:
* gdk/gdkpixmap.c:
* gdk/gdkscreen.c:
* gdk/gdkwindow.c:
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdisplay-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkdrawable-x11.c:
* gdk/x11/gdkgc-x11.c:
* gdk/x11/gdkimage-x11.c:
* gdk/x11/gdkinput.c:
* gdk/x11/gdkpixmap-x11.c:
* gdk/x11/gdkscreen-x11.c:
* gdk/x11/gdkwindow-x11.c: Use G_DEFINE_TYPE.
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkimage-x11.c: Use instance private data.
2006-04-03 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names.

View File

@ -1,3 +1,27 @@
2006-04-04 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkdisplay.c:
* gdk/gdkdisplaymanager.c:
* gdk/gdkdraw.c:
* gdk/gdkkeys.c:
* gdk/gdkpixmap.c:
* gdk/gdkscreen.c:
* gdk/gdkwindow.c:
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdisplay-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkdrawable-x11.c:
* gdk/x11/gdkgc-x11.c:
* gdk/x11/gdkimage-x11.c:
* gdk/x11/gdkinput.c:
* gdk/x11/gdkpixmap-x11.c:
* gdk/x11/gdkscreen-x11.c:
* gdk/x11/gdkwindow-x11.c: Use G_DEFINE_TYPE.
* gdk/x11/gdkcolor-x11.c:
* gdk/x11/gdkdnd-x11.c:
* gdk/x11/gdkimage-x11.c: Use instance private data.
2006-04-03 Matthias Clasen <mclasen@redhat.com>
* gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names.

View File

@ -35,8 +35,6 @@ enum {
LAST_SIGNAL
};
static void gdk_display_class_init (GdkDisplayClass *class);
static void gdk_display_init (GdkDisplay *display);
static void gdk_display_dispose (GObject *object);
static void gdk_display_finalize (GObject *object);
@ -65,7 +63,6 @@ static GdkWindow* singlehead_default_window_at_pointer (GdkScreen *screen
static guint signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class;
static char *gdk_sm_client_id;
static const GdkDisplayPointerHooks default_pointer_hooks = {
@ -87,39 +84,13 @@ static const GdkPointerHooks singlehead_default_pointer_hooks = {
static const GdkPointerHooks *singlehead_current_pointer_hooks = &singlehead_default_pointer_hooks;
GType
gdk_display_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info = {
sizeof (GdkDisplayClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplay),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_display_init
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkDisplay"), &object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkDisplay, gdk_display, G_TYPE_OBJECT);
static void
gdk_display_class_init (GdkDisplayClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
object_class->finalize = gdk_display_finalize;
object_class->dispose = gdk_display_dispose;
@ -184,13 +155,13 @@ gdk_display_dispose (GObject *object)
NULL);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
}
static void
gdk_display_finalize (GObject *object)
{
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_display_parent_class)->finalize (object);
}
/**

View File

@ -67,33 +67,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
static GdkDisplay *default_display = NULL;
GType
gdk_display_manager_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDisplayManagerClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_manager_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplayManager),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkDisplayManager"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkDisplayManager, gdk_display_manager, G_TYPE_OBJECT);
static void
gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
@ -133,6 +107,11 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
}
static void
gdk_display_manager_init (GdkDisplayManager *manager)
{
}
static void
gdk_display_manager_set_property (GObject *object,
guint prop_id,

View File

@ -62,36 +62,8 @@ static void gdk_drawable_real_draw_pixbuf (GdkDrawable *draw
gint x_dither,
gint y_dither);
static void gdk_drawable_class_init (GdkDrawableClass *klass);
GType
gdk_drawable_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drawable_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawable),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkDrawable"),
&object_info,
G_TYPE_FLAG_ABSTRACT);
}
return object_type;
}
G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT);
static void
gdk_drawable_class_init (GdkDrawableClass *klass)
@ -104,6 +76,11 @@ gdk_drawable_class_init (GdkDrawableClass *klass)
klass->draw_pixbuf = gdk_drawable_real_draw_pixbuf;
}
static void
gdk_drawable_init (GdkDrawable *drawable)
{
}
/* Manipulation of drawables
*/

View File

@ -36,37 +36,9 @@ enum {
LAST_SIGNAL
};
static void gdk_keymap_class_init (GdkKeymapClass *klass);
static guint signals[LAST_SIGNAL] = { 0 };
GType
gdk_keymap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkKeymapClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_keymap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkKeymap),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkKeymap"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT);
static void
gdk_keymap_class_init (GdkKeymapClass *klass)
@ -111,6 +83,11 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
0);
}
static void
gdk_keymap_init (GdkKeymap *keymap)
{
}
/* Other key-handling stuff
*/

View File

@ -153,39 +153,9 @@ static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
static GdkColormap* gdk_pixmap_real_get_colormap (GdkDrawable *drawable);
static GdkScreen* gdk_pixmap_real_get_screen (GdkDrawable *drawable);
static void gdk_pixmap_init (GdkPixmapObject *pixmap);
static void gdk_pixmap_class_init (GdkPixmapObjectClass *klass);
static void gdk_pixmap_finalize (GObject *object);
static gpointer parent_class = NULL;
GType
gdk_pixmap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkPixmapObjectClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_pixmap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkPixmapObject),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_pixmap_init,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
g_intern_static_string ("GdkPixmap"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkPixmapObject, gdk_pixmap, GDK_TYPE_DRAWABLE);
static void
gdk_pixmap_init (GdkPixmapObject *pixmap)
@ -200,8 +170,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_pixmap_finalize;
drawable_class->create_gc = gdk_pixmap_create_gc;
@ -237,7 +205,7 @@ gdk_pixmap_finalize (GObject *object)
g_object_unref (obj->impl);
obj->impl = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_pixmap_parent_class)->finalize (object);
}
static GdkGC *

View File

@ -29,8 +29,6 @@
#include "gdkintl.h"
#include "gdkalias.h"
static void gdk_screen_class_init (GdkScreenClass *klass);
static void gdk_screen_init (GdkScreen *screen);
static void gdk_screen_dispose (GObject *object);
static void gdk_screen_finalize (GObject *object);
static void gdk_screen_set_property (GObject *object,
@ -57,42 +55,13 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
static gpointer parent_class = NULL;
GType
gdk_screen_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkScreenClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_screen_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkScreen),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_screen_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkScreen"), &object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE(GdkScreen, gdk_screen, G_TYPE_OBJECT);
static void
gdk_screen_class_init (GdkScreenClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gdk_screen_dispose;
object_class->finalize = gdk_screen_finalize;
object_class->set_property = gdk_screen_set_property;
@ -164,7 +133,7 @@ gdk_screen_dispose (GObject *object)
}
}
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (gdk_screen_parent_class)->dispose (object);
}
static void
@ -175,7 +144,7 @@ gdk_screen_finalize (GObject *object)
if (screen->font_options)
cairo_font_options_destroy (screen->font_options);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_screen_parent_class)->finalize (object);
}
void

View File

@ -183,8 +183,6 @@ static GdkRegion* gdk_window_get_visible_region (GdkDrawable *drawable);
static void gdk_window_free_paint_stack (GdkWindow *window);
static void gdk_window_init (GdkWindowObject *window);
static void gdk_window_class_init (GdkWindowObjectClass *klass);
static void gdk_window_finalize (GObject *object);
static void gdk_window_clear_backing_rect (GdkWindow *window,
gint x,
@ -192,38 +190,10 @@ static void gdk_window_clear_backing_rect (GdkWindow *window,
gint width,
gint height);
static gpointer parent_class = NULL;
GType
gdk_window_object_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkWindowObjectClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_window_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkWindowObject),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_window_init,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
g_intern_static_string ("GdkWindow"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkWindowObject, gdk_window_object, GDK_TYPE_DRAWABLE);
static void
gdk_window_init (GdkWindowObject *window)
gdk_window_object_init (GdkWindowObject *window)
{
/* 0-initialization is good for all other fields. */
@ -235,13 +205,11 @@ gdk_window_init (GdkWindowObject *window)
}
static void
gdk_window_class_init (GdkWindowObjectClass *klass)
gdk_window_object_class_init (GdkWindowObjectClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_window_finalize;
drawable_class->create_gc = gdk_window_create_gc;
@ -295,7 +263,7 @@ gdk_window_finalize (GObject *object)
g_object_unref (obj->impl);
obj->impl = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_window_object_parent_class)->finalize (object);
}
static void

View File

@ -66,46 +66,17 @@ static gboolean gdk_colormap_equal (Colormap *a,
static void gdk_colormap_sync (GdkColormap *colormap,
gboolean force);
static void gdk_colormap_init (GdkColormap *colormap);
static void gdk_colormap_class_init (GdkColormapClass *klass);
static void gdk_colormap_finalize (GObject *object);
static gpointer parent_class = NULL;
GType
gdk_colormap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkColormapClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_colormap_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkColormap),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_colormap_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkColormap"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkColormap, gdk_colormap, G_TYPE_OBJECT);
static void
gdk_colormap_init (GdkColormap *colormap)
{
GdkColormapPrivateX11 *private;
private = g_new (GdkColormapPrivateX11, 1);
private = G_TYPE_INSTANCE_GET_PRIVATE (colormap, GDK_TYPE_COLORMAP,
GdkColormapPrivateX11);
colormap->windowing_data = private;
@ -123,9 +94,9 @@ gdk_colormap_class_init (GdkColormapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_colormap_finalize;
g_type_class_add_private (object_class, sizeof (GdkColormapPrivateX11));
}
static void
@ -144,9 +115,8 @@ gdk_colormap_finalize (GObject *object)
g_free (private->info);
g_free (colormap->colors);
g_free (private);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_colormap_parent_class)->finalize (object);
}
/**

View File

@ -55,7 +55,6 @@
#endif
static void gdk_display_x11_class_init (GdkDisplayX11Class *class);
static void gdk_display_x11_dispose (GObject *object);
static void gdk_display_x11_finalize (GObject *object);
@ -67,8 +66,6 @@ static void gdk_internal_connection_watch (Display *display,
XPointer *watch_data);
#endif /* HAVE_X11R6 */
static gpointer parent_class = NULL;
/* Note that we never *directly* use WM_LOCALE_NAME, WM_PROTOCOLS,
* but including them here has the side-effect of getting them
* into the internal Xlib cache
@ -99,45 +96,21 @@ static const char *const precache_atoms[] = {
"_NET_VIRTUAL_ROOTS"
};
GType
_gdk_display_x11_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDisplayX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplayX11),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_DISPLAY,
g_intern_static_string ("GdkDisplayX11"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkDisplayX11, _gdk_display_x11, GDK_TYPE_DISPLAY);
static void
gdk_display_x11_class_init (GdkDisplayX11Class * class)
_gdk_display_x11_class_init (GdkDisplayX11Class * class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = gdk_display_x11_dispose;
object_class->finalize = gdk_display_x11_finalize;
parent_class = g_type_class_peek_parent (class);
}
static void
_gdk_display_x11_init (GdkDisplayX11 *display)
{
}
/**
* gdk_display_open:
@ -747,7 +720,7 @@ gdk_display_x11_dispose (GObject *object)
_gdk_events_uninit (GDK_DISPLAY_OBJECT (object));
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (_gdk_display_x11_parent_class)->dispose (object);
}
static void
@ -806,7 +779,7 @@ gdk_display_x11_finalize (GObject *object)
XCloseDisplay (display_x11->xdisplay);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_display_x11_parent_class)->finalize (object);
}
/**

View File

@ -126,11 +126,8 @@ static void xdnd_manage_source_filter (GdkDragContext *context,
GdkWindow *window,
gboolean add_filter);
static void gdk_drag_context_init (GdkDragContext *dragcontext);
static void gdk_drag_context_class_init (GdkDragContextClass *klass);
static void gdk_drag_context_finalize (GObject *object);
static gpointer parent_class = NULL;
static GList *contexts;
const static struct {
@ -145,40 +142,16 @@ const static struct {
{ "XdndDrop", xdnd_drop_filter },
};
GType
gdk_drag_context_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDragContextClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drag_context_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDragContext),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_drag_context_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkDragContext"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT);
static void
gdk_drag_context_init (GdkDragContext *dragcontext)
{
GdkDragContextPrivateX11 *private;
private = g_new0 (GdkDragContextPrivateX11, 1);
private = G_TYPE_INSTANCE_GET_PRIVATE (dragcontext,
GDK_TYPE_DRAG_CONTEXT,
GdkDragContextPrivateX11);
dragcontext->windowing_data = private;
@ -190,9 +163,9 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_drag_context_finalize;
g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateX11));
}
static void
@ -222,9 +195,7 @@ gdk_drag_context_finalize (GObject *object)
contexts = g_list_remove (contexts, context);
g_free (private);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
}
/* Drag Contexts */
@ -239,7 +210,7 @@ gdk_drag_context_finalize (GObject *object)
GdkDragContext *
gdk_drag_context_new (void)
{
return g_object_new (gdk_drag_context_get_type (), NULL);
return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL);
}
/**

View File

@ -139,49 +139,18 @@ static gint gdk_x11_get_depth (GdkDrawable *drawable);
static GdkScreen * gdk_x11_get_screen (GdkDrawable *drawable);
static GdkVisual* gdk_x11_get_visual (GdkDrawable *drawable);
static void gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass);
static void gdk_drawable_impl_x11_finalize (GObject *object);
static gpointer parent_class = NULL;
static const cairo_user_data_key_t gdk_x11_cairo_key;
GType
_gdk_drawable_impl_x11_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableImplX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drawable_impl_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawableImplX11),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
g_intern_static_string ("GdkDrawableImplX11"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkDrawableImplX11, _gdk_drawable_impl_x11, GDK_TYPE_DRAWABLE);
static void
gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
_gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
{
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_drawable_impl_x11_finalize;
drawable_class->create_gc = _gdk_x11_gc_new;
@ -209,12 +178,17 @@ gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
drawable_class->_copy_to_image = _gdk_x11_copy_to_image;
}
static void
_gdk_drawable_impl_x11_init (GdkDrawableImplX11 *impl)
{
}
static void
gdk_drawable_impl_x11_finalize (GObject *object)
{
gdk_drawable_set_colormap (GDK_DRAWABLE (object), NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_drawable_impl_x11_parent_class)->finalize (object);
}
/**
@ -1418,7 +1392,7 @@ gdk_x11_draw_pixbuf (GdkDrawable *drawable,
gdk_x11_drawable_get_picture (drawable) == None)
{
GdkDrawable *wrapper = GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper;
GDK_DRAWABLE_CLASS (parent_class)->draw_pixbuf (wrapper, gc, pixbuf,
GDK_DRAWABLE_CLASS (_gdk_drawable_impl_x11_parent_class)->draw_pixbuf (wrapper, gc, pixbuf,
src_x, src_y, dest_x, dest_y,
width, height,
dither, x_dither, y_dither);

View File

@ -54,47 +54,16 @@ static void gdk_x11_gc_set_dashes (GdkGC *gc,
gint8 dash_list[],
gint n);
static void gdk_gc_x11_class_init (GdkGCX11Class *klass);
static void gdk_gc_x11_finalize (GObject *object);
static gpointer parent_class = NULL;
GType
_gdk_gc_x11_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkGCX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_gc_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkGCX11),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_GC,
g_intern_static_string ("GdkGCX11"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkGCX11, _gdk_gc_x11, GDK_TYPE_GC);
static void
gdk_gc_x11_class_init (GdkGCX11Class *klass)
_gdk_gc_x11_class_init (GdkGCX11Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkGCClass *gc_class = GDK_GC_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_gc_x11_finalize;
gc_class->get_values = gdk_x11_gc_get_values;
@ -102,6 +71,11 @@ gdk_gc_x11_class_init (GdkGCX11Class *klass)
gc_class->set_dashes = gdk_x11_gc_set_dashes;
}
static void
_gdk_gc_x11_init (GdkGCX11 *gc)
{
}
static void
gdk_gc_x11_finalize (GObject *object)
{
@ -109,7 +83,7 @@ gdk_gc_x11_finalize (GObject *object)
XFreeGC (GDK_GC_XDISPLAY (x11_gc), GDK_GC_XGC (x11_gc));
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_gc_x11_parent_class)->finalize (object);
}

View File

@ -67,47 +67,20 @@ struct _GdkImagePrivateX11
};
static GList *image_list = NULL;
static gpointer parent_class = NULL;
static void gdk_x11_image_destroy (GdkImage *image);
static void gdk_image_init (GdkImage *image);
static void gdk_image_class_init (GdkImageClass *klass);
static void gdk_image_finalize (GObject *object);
#define PRIVATE_DATA(image) ((GdkImagePrivateX11 *) GDK_IMAGE (image)->windowing_data)
GType
gdk_image_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkImageClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_image_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkImage),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_image_init,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
g_intern_static_string ("GdkImage"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE(GdkImage, gdk_image, G_TYPE_OBJECT);
static void
gdk_image_init (GdkImage *image)
{
image->windowing_data = g_new0 (GdkImagePrivateX11, 1);
image->windowing_data = G_TYPE_INSTANCE_GET_PRIVATE (image,
GDK_TYPE_IMAGE,
GdkImagePrivateX11);
}
static void
@ -115,9 +88,9 @@ gdk_image_class_init (GdkImageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_image_finalize;
g_type_class_add (object_class, sizeof (GdkImagePrivateX11));
}
static void
@ -127,7 +100,7 @@ gdk_image_finalize (GObject *object)
gdk_x11_image_destroy (image);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_image_parent_class)->finalize (object);
}
@ -158,7 +131,10 @@ _gdk_image_exit (void)
* Return value: a new #GdkImage.
**/
GdkImage *
gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint width, gint height)
gdk_image_new_bitmap (GdkVisual *visual,
gpointer data,
gint width,
gint height)
{
Visual *xvisual;
GdkImage *image;
@ -726,12 +702,6 @@ gdk_x11_image_destroy (GdkImage *image)
private = PRIVATE_DATA (image);
if (private == NULL) /* This means that _gdk_image_exit() destroyed the
* image already, and now we're called a second
* time from _finalize()
*/
return;
if (private->ximage) /* Deal with failure of creation */
{
switch (image->type)
@ -770,10 +740,9 @@ gdk_x11_image_destroy (GdkImage *image)
case GDK_IMAGE_FASTEST:
g_assert_not_reached ();
}
}
g_free (private);
image->windowing_data = NULL;
private->ximage = NULL;
}
}
/**

View File

@ -60,41 +60,10 @@ static void gdk_pixmap_impl_x11_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
static void gdk_pixmap_impl_x11_init (GdkPixmapImplX11 *pixmap);
static void gdk_pixmap_impl_x11_class_init (GdkPixmapImplX11Class *klass);
static void gdk_pixmap_impl_x11_dispose (GObject *object);
static void gdk_pixmap_impl_x11_finalize (GObject *object);
static gpointer parent_class = NULL;
GType
gdk_pixmap_impl_x11_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkPixmapImplX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_pixmap_impl_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkPixmapImplX11),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_pixmap_impl_x11_init,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_X11,
g_intern_static_string ("GdkPixmapImplX11"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkPixmapImplX11, gdk_pixmap_impl_x11, GDK_TYPE_DRAWABLE_IMPL_X11);
GType
_gdk_pixmap_impl_get_type (void)
@ -115,8 +84,6 @@ gdk_pixmap_impl_x11_class_init (GdkPixmapImplX11Class *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gdk_pixmap_impl_x11_dispose;
object_class->finalize = gdk_pixmap_impl_x11_finalize;
@ -138,7 +105,7 @@ gdk_pixmap_impl_x11_dispose (GObject *object)
_gdk_xid_table_remove (display, GDK_PIXMAP_XID (wrapper));
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (gdk_pixmap_impl_x11_parent_class)->dispose (object);
}
static void
@ -155,7 +122,7 @@ gdk_pixmap_impl_x11_finalize (GObject *object)
_gdk_x11_drawable_finish (GDK_DRAWABLE (draw_impl));
}
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_pixmap_impl_x11_parent_class)->finalize (object);
}
static void

View File

@ -47,7 +47,6 @@
#include <X11/extensions/Xrandr.h>
#endif
static void gdk_screen_x11_class_init (GdkScreenX11Class *klass);
static void gdk_screen_x11_dispose (GObject *object);
static void gdk_screen_x11_finalize (GObject *object);
static void init_xinerama_support (GdkScreen *screen);
@ -59,45 +58,18 @@ enum
LAST_SIGNAL
};
static gpointer parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
GType
_gdk_screen_x11_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkScreenX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_screen_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkScreenX11),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_SCREEN,
g_intern_static_string ("GdkScreenX11"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE (GdkScreenX11, _gdk_screen_x11, GDK_TYPE_SCREEN);
static void
gdk_screen_x11_class_init (GdkScreenX11Class *klass)
_gdk_screen_x11_class_init (GdkScreenX11Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gdk_screen_x11_dispose;
object_class->finalize = gdk_screen_x11_finalize;
parent_class = g_type_class_peek_parent (klass);
signals[WINDOW_MANAGER_CHANGED] =
g_signal_new (g_intern_static_string ("window_manager_changed"),
G_OBJECT_CLASS_TYPE (object_class),
@ -109,6 +81,11 @@ gdk_screen_x11_class_init (GdkScreenX11Class *klass)
0);
}
static void
_gdk_screen_x11_init (GdkScreenX11 *screen)
{
}
/**
* gdk_screen_get_display:
* @screen: a #GdkScreen
@ -309,7 +286,7 @@ gdk_screen_x11_dispose (GObject *object)
if (screen_x11->root_window)
_gdk_window_destroy (screen_x11->root_window, TRUE);
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (_gdk_screen_x11_parent_class)->dispose (object);
screen_x11->xdisplay = NULL;
screen_x11->xscreen = NULL;
@ -342,7 +319,7 @@ gdk_screen_x11_finalize (GObject *object)
g_free (screen_x11->monitors);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_screen_x11_parent_class)->finalize (object);
}
/**

View File

@ -96,12 +96,8 @@ static void gdk_window_impl_x11_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
static GdkRegion* gdk_window_impl_x11_get_visible_region (GdkDrawable *drawable);
static void gdk_window_impl_x11_init (GdkWindowImplX11 *window);
static void gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass);
static void gdk_window_impl_x11_finalize (GObject *object);
static gpointer parent_class = NULL;
#define WINDOW_IS_TOPLEVEL(window) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
@ -114,33 +110,7 @@ static gpointer parent_class = NULL;
(( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 )) \
)
GType
gdk_window_impl_x11_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkWindowImplX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_window_impl_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkWindowImplX11),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_window_impl_x11_init,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_X11,
g_intern_static_string ("GdkWindowImplX11"),
&object_info, 0);
}
return object_type;
}
G_DEFINE_TYPE(GdkWindowImplX11, gdk_window_impl_x11, GDK_TYPE_DRAWABLE_IMPL_X11);
GType
_gdk_window_impl_get_type (void)
@ -182,8 +152,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_window_impl_x11_finalize;
drawable_class->set_colormap = gdk_window_impl_x11_set_colormap;
@ -226,7 +194,7 @@ gdk_window_impl_x11_finalize (GObject *object)
if (window_impl->cursor)
gdk_cursor_unref (window_impl->cursor);
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_window_impl_x11_parent_class)->finalize (object);
}
static void
@ -395,7 +363,7 @@ gdk_window_impl_x11_set_colormap (GdkDrawable *drawable,
return;
/* chain up */
GDK_DRAWABLE_CLASS (parent_class)->set_colormap (drawable, cmap);
GDK_DRAWABLE_CLASS (gdk_window_impl_x11_parent_class)->set_colormap (drawable, cmap);
if (cmap)
{