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
					Matthias Clasen
				
			
				
					committed by
					
						 Matthias Clasen
						Matthias Clasen
					
				
			
			
				
	
			
			
			 Matthias Clasen
						Matthias Clasen
					
				
			
						parent
						
							7d49b31a79
						
					
				
				
					commit
					10f0736ac7
				
			| @ -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); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  | ||||
| @ -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); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  | ||||
| @ -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,41 +142,17 @@ 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; | ||||
|  | ||||
|   contexts = g_list_prepend (contexts, dragcontext); | ||||
| @ -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 */ | ||||
| @ -237,9 +208,9 @@ gdk_drag_context_finalize (GObject *object) | ||||
|  * Return value: the newly created #GdkDragContext. | ||||
|  **/ | ||||
| GdkDragContext * | ||||
| gdk_drag_context_new        (void) | ||||
| gdk_drag_context_new (void) | ||||
| { | ||||
|   return g_object_new (gdk_drag_context_get_type (), NULL); | ||||
|   return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  | ||||
| @ -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,10 +1392,10 @@ 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, | ||||
| 						      src_x, src_y, dest_x, dest_y, | ||||
| 						      width, height, | ||||
| 						      dither, x_dither, y_dither); | ||||
|       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); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -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 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); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -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 (); | ||||
| 	} | ||||
|        | ||||
|       private->ximage = NULL; | ||||
|     } | ||||
|  | ||||
|   g_free (private); | ||||
|   image->windowing_data = NULL; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  | ||||
| @ -71,17 +71,17 @@ gdk_device_get_type (void) | ||||
|   if (!object_type) | ||||
|     { | ||||
|       static const GTypeInfo object_info = | ||||
|       { | ||||
|         sizeof (GdkDeviceClass), | ||||
|         (GBaseInitFunc) NULL, | ||||
|         (GBaseFinalizeFunc) NULL, | ||||
|         (GClassInitFunc) NULL, | ||||
|         NULL,           /* class_finalize */ | ||||
|         NULL,           /* class_data */ | ||||
|         sizeof (GdkDevicePrivate), | ||||
|         0,              /* n_preallocs */ | ||||
|         (GInstanceInitFunc) NULL, | ||||
|       }; | ||||
| 	{ | ||||
| 	  sizeof (GdkDeviceClass), | ||||
| 	  (GBaseInitFunc) NULL, | ||||
| 	  (GBaseFinalizeFunc) NULL, | ||||
| 	  (GClassInitFunc) NULL, | ||||
| 	  NULL,           /* class_finalize */ | ||||
| 	  NULL,           /* class_data */ | ||||
| 	  sizeof (GdkDevicePrivate), | ||||
| 	  0,              /* n_preallocs */ | ||||
| 	  (GInstanceInitFunc) NULL, | ||||
| 	}; | ||||
|        | ||||
|       object_type = g_type_register_static (G_TYPE_OBJECT, | ||||
|                                             g_intern_static_string ("GdkDevice"), | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  | ||||
| @ -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) | ||||
|     { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user