summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog178
-rw-r--r--ChangeLog.pre-2-0178
-rw-r--r--ChangeLog.pre-2-10178
-rw-r--r--ChangeLog.pre-2-2178
-rw-r--r--ChangeLog.pre-2-4178
-rw-r--r--ChangeLog.pre-2-6178
-rw-r--r--ChangeLog.pre-2-8178
-rw-r--r--gdk/Makefile.am2
-rw-r--r--gdk/gdk.c6
-rw-r--r--gdk/gdkcolor.c24
-rw-r--r--gdk/gdkcolor.h26
-rw-r--r--gdk/gdkcompat.h4
-rw-r--r--gdk/gdkdnd.h27
-rw-r--r--gdk/gdkdraw.c323
-rw-r--r--gdk/gdkdrawable.h70
-rw-r--r--gdk/gdkgc.c128
-rw-r--r--gdk/gdkgc.h27
-rw-r--r--gdk/gdkimage.c19
-rw-r--r--gdk/gdkimage.h23
-rw-r--r--gdk/gdkinternals.h27
-rw-r--r--gdk/gdkpango.c17
-rw-r--r--gdk/gdkpixmap.c411
-rw-r--r--gdk/gdkpixmap.h29
-rw-r--r--gdk/gdkprivate.h109
-rw-r--r--gdk/gdktypes.h1
-rw-r--r--gdk/gdkwindow.c700
-rw-r--r--gdk/gdkwindow.h184
-rw-r--r--gdk/linux-fb/Makefile.am6
-rw-r--r--gdk/x11/Makefile.am4
-rw-r--r--gdk/x11/gdkcolor-x11.c226
-rw-r--r--gdk/x11/gdkcursor-x11.c9
-rw-r--r--gdk/x11/gdkdnd-x11.c224
-rw-r--r--gdk/x11/gdkdrawable-x11.c439
-rw-r--r--gdk/x11/gdkdrawable-x11.h73
-rw-r--r--gdk/x11/gdkevents-x11.c32
-rw-r--r--gdk/x11/gdkgc-x11.c219
-rw-r--r--gdk/x11/gdkgeometry-x11.c394
-rw-r--r--gdk/x11/gdkglobals-x11.c6
-rw-r--r--gdk/x11/gdkim-x11.c6
-rw-r--r--gdk/x11/gdkimage-x11.c218
-rw-r--r--gdk/x11/gdkinput.c8
-rw-r--r--gdk/x11/gdkmain-x11.c19
-rw-r--r--gdk/x11/gdkpixmap-x11.c225
-rw-r--r--gdk/x11/gdkpixmap-x11.h70
-rw-r--r--gdk/x11/gdkprivate-x11.h25
-rw-r--r--gdk/x11/gdkproperty-x11.c18
-rw-r--r--gdk/x11/gdkselection-x11.c18
-rw-r--r--gdk/x11/gdkwindow-x11.c750
-rw-r--r--gdk/x11/gdkwindow-x11.h89
-rw-r--r--gdk/x11/gdkx.h124
-rw-r--r--gtk/gtk-boxed.defs15
-rw-r--r--gtk/gtkaccellabel.c4
-rw-r--r--gtk/gtkbutton.c24
-rw-r--r--gtk/gtkcalendar.c53
-rw-r--r--gtk/gtkcheckmenuitem.c2
-rw-r--r--gtk/gtkclist.c47
-rw-r--r--gtk/gtkcombo.c8
-rw-r--r--gtk/gtkcontainer.c3
-rw-r--r--gtk/gtkctree.c13
-rw-r--r--gtk/gtkdnd.c36
-rw-r--r--gtk/gtkentry.c28
-rw-r--r--gtk/gtkfontsel.c2
-rw-r--r--gtk/gtkframe.c24
-rw-r--r--gtk/gtkhandlebox.c4
-rw-r--r--gtk/gtkhruler.c14
-rw-r--r--gtk/gtkhscale.c10
-rw-r--r--gtk/gtkhscrollbar.c24
-rw-r--r--gtk/gtkhseparator.c4
-rw-r--r--gtk/gtklabel.c8
-rw-r--r--gtk/gtklistitem.c4
-rw-r--r--gtk/gtkmenu.c8
-rw-r--r--gtk/gtkmenubar.c8
-rw-r--r--gtk/gtkmenuitem.c8
-rw-r--r--gtk/gtknotebook.c58
-rw-r--r--gtk/gtkoptionmenu.c8
-rw-r--r--gtk/gtkplug.c2
-rw-r--r--gtk/gtkprogressbar.c116
-rw-r--r--gtk/gtkradiomenuitem.c2
-rw-r--r--gtk/gtkrange.c16
-rw-r--r--gtk/gtkrc.c292
-rw-r--r--gtk/gtkrc.h24
-rw-r--r--gtk/gtkscale.c2
-rw-r--r--gtk/gtksocket.c9
-rw-r--r--gtk/gtkspinbutton.c42
-rw-r--r--gtk/gtkstyle.c583
-rw-r--r--gtk/gtkstyle.h21
-rw-r--r--gtk/gtktearoffmenuitem.c8
-rw-r--r--gtk/gtktext.c24
-rw-r--r--gtk/gtktextlayout.c14
-rw-r--r--gtk/gtktexttag.c8
-rw-r--r--gtk/gtktextview.c4
-rw-r--r--gtk/gtktogglebutton.c4
-rw-r--r--gtk/gtktoolbar.c4
-rw-r--r--gtk/gtktreeitem.c4
-rw-r--r--gtk/gtkviewport.c16
-rw-r--r--gtk/gtkvruler.c15
-rw-r--r--gtk/gtkvscale.c8
-rw-r--r--gtk/gtkvscrollbar.c24
-rw-r--r--gtk/gtkvseparator.c4
-rw-r--r--gtk/gtkwidget.c23
-rw-r--r--modules/linux-fb/Makefile.am11
101 files changed, 5434 insertions, 2868 deletions
diff --git a/ChangeLog b/ChangeLog
index eaaadd5c58..54808d8d1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,179 @@
+2000-06-20 Havoc Pennington <hp@redhat.com>
+
+ * modules/linux-fb/Makefile.am: Make this compile
+ without framebuffer enabled
+
+ * gdk/linux-fb/Makefile.am: Add conditional to not build
+ framebuffer unless specified in configure
+
+ * gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
+ the size of the target instead of source if -1 was passed for
+ width/height
+
+ * gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
+ width/height confusion.
+
+2000-06-19 Havoc Pennington <hp@redhat.com>
+
+ * gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
+ GDK_DRAWABLE_XID. In the future, we probably want to make it
+ faster with G_DISABLE_CHECKS turned on.
+
+2000-06-14 Havoc Pennington <hp@redhat.com>
+
+ * gdk/Makefile.am: add gdkpixmap.c
+
+ * gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
+ s/gdk_image_init/_gdk_windowing_image_init
+
+ * gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
+ ref/unref
+
+ * gdk/gdkcolor.h: make GdkColormap a GObject subclass
+
+ * gdk/gdkcompat.h: remove GdkWindowType compat, since
+ GdkWindowType is now non-deprecated;
+ change gdk_window_get_type() compat to be
+ gdk_window_get_window_type().
+
+ * gdk/gdkdnd.h: make GdkDragContext a GObject.
+
+ * gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
+ virtual GObject. Make all functions call into the vtable.
+ Move gdk_image_put() guts in here. Remove GdkDrawableType
+ and gdk_drawable_get_type(), these are now GdkWindow-specific.
+ draw_image, get_depth, get_size, set_colormap, get_colormap,
+ get_visual added to the vtable.
+
+ * gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
+ GObject. Virtualize everything.
+ (gdk_gc_new_with_values): remove check for destroyed window,
+ because now GdkWindow::create_gc will check this.
+ (gdk_gc_set_values): New function to set GC values, this
+ was already implemented but wasn't in the header
+
+ * gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
+
+ * gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
+ _gdk_window_draw_image(), remove _gdk_windowing_window_class,
+ remove _gdk_window_class; add _gdk_window_impl_get_type() and
+ _gdk_pixmap_impl_get_type(). Rename gdk_window_init to
+ _gdk_windowing_window_init, rename gdk_image_init to
+ _gdk_windowing_image_init.
+
+ * gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
+ (gdk_draw_layout): Remove check for destroyed window,
+ because all the drawable methods already check it.
+
+ * gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
+ Add gdkpixmap.c which contains implementation of GdkDrawable
+ virtual table (by chaining to a platform-specific implementation
+ object).
+
+ * gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
+ GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
+ GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
+ GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
+ GdkColormapPrivate.
+
+ * gdk/gdktypes.h: #include <glib-object.h>
+
+ * gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
+ Move most functionality to platform-specific implementation
+ object. GdkWindow itself now handles the backing store, then
+ chains to the platform-specific implementation.
+ (gdk_window_get_window_type): return GdkWindowType of the window.
+ (gdk_window_peek_children): New routine, returns the children of
+ a GdkWindow
+ (gdk_window_get_children): Was in X11-specific code and did
+ XQueryTree. Changed to simply return a copy of window->children;
+ so it can go in cross-platform code.
+
+ * gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
+
+ * gdk/x11/gdkcolor-x11.c: implement X-specific parts of
+ GdkColormap; just changed to use the new private data instead
+ of casting to GdkColormapPrivate.
+
+ * gdk/x11/gdkcursor-x11.c: added a couple typechecks to
+ gdk_cursor_new().
+
+ * gdk/x11/gdkdnd-x11.c: Change the way we access private fields
+ (private data member in the GObject).
+ (xdnd_manager_source_filter): Function had broken
+ error handling, fix it (use gdk_error_trap_push).
+
+ * gdk/x11/gdkdrawable-x11.c: This file now implements
+ a base class for GdkWindowImplX11/GdkPixmapImplX11. This
+ base class is purely for the convenience of the X port,
+ and not part of the interface to cross-platform GDK.
+
+ * gdk/x11/gdkevents-x11.c: Reflect various renamings.
+
+ * gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
+ specific to X, and returned by the create_gc virtual method
+ of GdkDrawableImplX11.
+ (gdk_x11_gc_set_dashes): Change this to take an array of gint8
+ rather than gchar, this was also changed in the GdkGC vtable.
+ (gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
+ mask is 0, return immediately, instead of checking every flag.
+ This is faster, and keeps us from segfaulting if values is NULL
+ and the mask contains some nonzero flags.
+
+ * gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
+ GdkWindow.
+
+ * gdk/x11/gdkglobals-x11.c: change type of grab window, since
+ GdkWindowPrivate is gone.
+
+ * gdk/x11/gdkim-x11.c: rename things that got renamed.
+
+ * gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
+ remove the image_put stuff that got transferred to GdkDrawable.
+
+ * gdk/x11/gdkinput.c: renamings
+
+ * gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
+
+ * gdk/x11/gdkpixmap-x11.c: GObject conversion
+
+ * gdk/x11/gdkprivate-x11.h: indentation fixes
+
+ * gdk/x11/gdkproperty-x11.c: renamings
+
+ * gdk/x11/gdkselection-x11.c: renamings
+
+ * gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
+ implements the platform-specific "impl" object.
+ Moved gdk_window_get_children to gdk/gdkwindow.c
+
+ * gdk/x11/gdkx.h: Remove all the private structs and private datas
+ that no longer exist. Add declaration of GdkGCX11 object here.
+ Fix all the macros to still work.
+
+ * gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
+ GdkDragContext from the boxed types since they are now GObjects.
+
+ * gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
+ moved xthickness/ythickness into the instance. GtkStyleClass
+ functions are now in the standard vtable for GtkStyle, so you have
+ to create a GObject subclass to write a theme engine.
+ (gtk_style_copy): fixed a leaked PangoFontDescription
+ (gtk_style_init): renamed gtk_style_realize, so gtk_style_init
+ can be the standard GObject function.
+
+ * Throughout GTK:
+ s/style->klass->[xy]thickness/style->[xy]thickness
+ s/pango_layout_unref/g_object_unref/
+
+ * gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
+
+ * gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
+ accessing GDK internals.
+
+ * gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
+ accessing GDK internals.
+
2000-06-18 Elliot Lee <sopwith@redhat.com>
* gtk/gtkwindow.c: Don't allow creation of a window bigger than the screen.
@@ -84,7 +260,7 @@ Mon Jun 5 19:32:53 CEST 2000 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/gdk*generic*: delete generic region code.
* gdk/linux-fb/gdk*generic*: delete generic region code.
* README.nanox: update information.
-
+
Tue Jun 6 10:53:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_prepend_widget): Fix to
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index eaaadd5c58..54808d8d1d 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,179 @@
+2000-06-20 Havoc Pennington <hp@redhat.com>
+
+ * modules/linux-fb/Makefile.am: Make this compile
+ without framebuffer enabled
+
+ * gdk/linux-fb/Makefile.am: Add conditional to not build
+ framebuffer unless specified in configure
+
+ * gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
+ the size of the target instead of source if -1 was passed for
+ width/height
+
+ * gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
+ width/height confusion.
+
+2000-06-19 Havoc Pennington <hp@redhat.com>
+
+ * gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
+ GDK_DRAWABLE_XID. In the future, we probably want to make it
+ faster with G_DISABLE_CHECKS turned on.
+
+2000-06-14 Havoc Pennington <hp@redhat.com>
+
+ * gdk/Makefile.am: add gdkpixmap.c
+
+ * gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
+ s/gdk_image_init/_gdk_windowing_image_init
+
+ * gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
+ ref/unref
+
+ * gdk/gdkcolor.h: make GdkColormap a GObject subclass
+
+ * gdk/gdkcompat.h: remove GdkWindowType compat, since
+ GdkWindowType is now non-deprecated;
+ change gdk_window_get_type() compat to be
+ gdk_window_get_window_type().
+
+ * gdk/gdkdnd.h: make GdkDragContext a GObject.
+
+ * gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
+ virtual GObject. Make all functions call into the vtable.
+ Move gdk_image_put() guts in here. Remove GdkDrawableType
+ and gdk_drawable_get_type(), these are now GdkWindow-specific.
+ draw_image, get_depth, get_size, set_colormap, get_colormap,
+ get_visual added to the vtable.
+
+ * gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
+ GObject. Virtualize everything.
+ (gdk_gc_new_with_values): remove check for destroyed window,
+ because now GdkWindow::create_gc will check this.
+ (gdk_gc_set_values): New function to set GC values, this
+ was already implemented but wasn't in the header
+
+ * gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
+
+ * gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
+ _gdk_window_draw_image(), remove _gdk_windowing_window_class,
+ remove _gdk_window_class; add _gdk_window_impl_get_type() and
+ _gdk_pixmap_impl_get_type(). Rename gdk_window_init to
+ _gdk_windowing_window_init, rename gdk_image_init to
+ _gdk_windowing_image_init.
+
+ * gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
+ (gdk_draw_layout): Remove check for destroyed window,
+ because all the drawable methods already check it.
+
+ * gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
+ Add gdkpixmap.c which contains implementation of GdkDrawable
+ virtual table (by chaining to a platform-specific implementation
+ object).
+
+ * gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
+ GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
+ GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
+ GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
+ GdkColormapPrivate.
+
+ * gdk/gdktypes.h: #include <glib-object.h>
+
+ * gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
+ Move most functionality to platform-specific implementation
+ object. GdkWindow itself now handles the backing store, then
+ chains to the platform-specific implementation.
+ (gdk_window_get_window_type): return GdkWindowType of the window.
+ (gdk_window_peek_children): New routine, returns the children of
+ a GdkWindow
+ (gdk_window_get_children): Was in X11-specific code and did
+ XQueryTree. Changed to simply return a copy of window->children;
+ so it can go in cross-platform code.
+
+ * gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
+
+ * gdk/x11/gdkcolor-x11.c: implement X-specific parts of
+ GdkColormap; just changed to use the new private data instead
+ of casting to GdkColormapPrivate.
+
+ * gdk/x11/gdkcursor-x11.c: added a couple typechecks to
+ gdk_cursor_new().
+
+ * gdk/x11/gdkdnd-x11.c: Change the way we access private fields
+ (private data member in the GObject).
+ (xdnd_manager_source_filter): Function had broken
+ error handling, fix it (use gdk_error_trap_push).
+
+ * gdk/x11/gdkdrawable-x11.c: This file now implements
+ a base class for GdkWindowImplX11/GdkPixmapImplX11. This
+ base class is purely for the convenience of the X port,
+ and not part of the interface to cross-platform GDK.
+
+ * gdk/x11/gdkevents-x11.c: Reflect various renamings.
+
+ * gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
+ specific to X, and returned by the create_gc virtual method
+ of GdkDrawableImplX11.
+ (gdk_x11_gc_set_dashes): Change this to take an array of gint8
+ rather than gchar, this was also changed in the GdkGC vtable.
+ (gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
+ mask is 0, return immediately, instead of checking every flag.
+ This is faster, and keeps us from segfaulting if values is NULL
+ and the mask contains some nonzero flags.
+
+ * gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
+ GdkWindow.
+
+ * gdk/x11/gdkglobals-x11.c: change type of grab window, since
+ GdkWindowPrivate is gone.
+
+ * gdk/x11/gdkim-x11.c: rename things that got renamed.
+
+ * gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
+ remove the image_put stuff that got transferred to GdkDrawable.
+
+ * gdk/x11/gdkinput.c: renamings
+
+ * gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
+
+ * gdk/x11/gdkpixmap-x11.c: GObject conversion
+
+ * gdk/x11/gdkprivate-x11.h: indentation fixes
+
+ * gdk/x11/gdkproperty-x11.c: renamings
+
+ * gdk/x11/gdkselection-x11.c: renamings
+
+ * gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
+ implements the platform-specific "impl" object.
+ Moved gdk_window_get_children to gdk/gdkwindow.c
+
+ * gdk/x11/gdkx.h: Remove all the private structs and private datas
+ that no longer exist. Add declaration of GdkGCX11 object here.
+ Fix all the macros to still work.
+
+ * gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
+ GdkDragContext from the boxed types since they are now GObjects.
+
+ * gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
+ moved xthickness/ythickness into the instance. GtkStyleClass
+ functions are now in the standard vtable for GtkStyle, so you have
+ to create a GObject subclass to write a theme engine.
+ (gtk_style_copy): fixed a leaked PangoFontDescription
+ (gtk_style_init): renamed gtk_style_realize, so gtk_style_init
+ can be the standard GObject function.
+
+ * Throughout GTK:
+ s/style->klass->[xy]thickness/style->[xy]thickness
+ s/pango_layout_unref/g_object_unref/
+
+ * gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
+
+ * gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
+ accessing GDK internals.
+
+ * gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
+ accessing GDK internals.
+
2000-06-18 Elliot Lee <sopwith@redhat.com>
* gtk/gtkwindow.c: Don't allow creation of a window bigger than the screen.
@@ -84,7 +260,7 @@ Mon Jun 5 19:32:53 CEST 2000 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/gdk*generic*: delete generic region code.
* gdk/linux-fb/gdk*generic*: delete generic region code.
* README.nanox: update information.
-
+
Tue Jun 6 10:53:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_prepend_widget): Fix to
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index eaaadd5c58..54808d8d1d 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,179 @@
+2000-06-20 Havoc Pennington <hp@redhat.com>
+
+ * modules/linux-fb/Makefile.am: Make this compile
+ without framebuffer enabled
+
+ * gdk/linux-fb/Makefile.am: Add conditional to not build
+ framebuffer unless specified in configure
+
+ * gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
+ the size of the target instead of source if -1 was passed for
+ width/height
+
+ * gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
+ width/height confusion.
+
+2000-06-19 Havoc Pennington <hp@redhat.com>
+
+ * gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
+ GDK_DRAWABLE_XID. In the future, we probably want to make it
+ faster with G_DISABLE_CHECKS turned on.
+
+2000-06-14 Havoc Pennington <hp@redhat.com>
+
+ * gdk/Makefile.am: add gdkpixmap.c
+
+ * gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
+ s/gdk_image_init/_gdk_windowing_image_init
+
+ * gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
+ ref/unref
+
+ * gdk/gdkcolor.h: make GdkColormap a GObject subclass
+
+ * gdk/gdkcompat.h: remove GdkWindowType compat, since
+ GdkWindowType is now non-deprecated;
+ change gdk_window_get_type() compat to be
+ gdk_window_get_window_type().
+
+ * gdk/gdkdnd.h: make GdkDragContext a GObject.
+
+ * gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
+ virtual GObject. Make all functions call into the vtable.
+ Move gdk_image_put() guts in here. Remove GdkDrawableType
+ and gdk_drawable_get_type(), these are now GdkWindow-specific.
+ draw_image, get_depth, get_size, set_colormap, get_colormap,
+ get_visual added to the vtable.
+
+ * gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
+ GObject. Virtualize everything.
+ (gdk_gc_new_with_values): remove check for destroyed window,
+ because now GdkWindow::create_gc will check this.
+ (gdk_gc_set_values): New function to set GC values, this
+ was already implemented but wasn't in the header
+
+ * gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
+
+ * gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
+ _gdk_window_draw_image(), remove _gdk_windowing_window_class,
+ remove _gdk_window_class; add _gdk_window_impl_get_type() and
+ _gdk_pixmap_impl_get_type(). Rename gdk_window_init to
+ _gdk_windowing_window_init, rename gdk_image_init to
+ _gdk_windowing_image_init.
+
+ * gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
+ (gdk_draw_layout): Remove check for destroyed window,
+ because all the drawable methods already check it.
+
+ * gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
+ Add gdkpixmap.c which contains implementation of GdkDrawable
+ virtual table (by chaining to a platform-specific implementation
+ object).
+
+ * gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
+ GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
+ GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
+ GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
+ GdkColormapPrivate.
+
+ * gdk/gdktypes.h: #include <glib-object.h>
+
+ * gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
+ Move most functionality to platform-specific implementation
+ object. GdkWindow itself now handles the backing store, then
+ chains to the platform-specific implementation.
+ (gdk_window_get_window_type): return GdkWindowType of the window.
+ (gdk_window_peek_children): New routine, returns the children of
+ a GdkWindow
+ (gdk_window_get_children): Was in X11-specific code and did
+ XQueryTree. Changed to simply return a copy of window->children;
+ so it can go in cross-platform code.
+
+ * gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
+
+ * gdk/x11/gdkcolor-x11.c: implement X-specific parts of
+ GdkColormap; just changed to use the new private data instead
+ of casting to GdkColormapPrivate.
+
+ * gdk/x11/gdkcursor-x11.c: added a couple typechecks to
+ gdk_cursor_new().
+
+ * gdk/x11/gdkdnd-x11.c: Change the way we access private fields
+ (private data member in the GObject).
+ (xdnd_manager_source_filter): Function had broken
+ error handling, fix it (use gdk_error_trap_push).
+
+ * gdk/x11/gdkdrawable-x11.c: This file now implements
+ a base class for GdkWindowImplX11/GdkPixmapImplX11. This
+ base class is purely for the convenience of the X port,
+ and not part of the interface to cross-platform GDK.
+
+ * gdk/x11/gdkevents-x11.c: Reflect various renamings.
+
+ * gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
+ specific to X, and returned by the create_gc virtual method
+ of GdkDrawableImplX11.
+ (gdk_x11_gc_set_dashes): Change this to take an array of gint8
+ rather than gchar, this was also changed in the GdkGC vtable.
+ (gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
+ mask is 0, return immediately, instead of checking every flag.
+ This is faster, and keeps us from segfaulting if values is NULL
+ and the mask contains some nonzero flags.
+
+ * gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
+ GdkWindow.
+
+ * gdk/x11/gdkglobals-x11.c: change type of grab window, since
+ GdkWindowPrivate is gone.
+
+ * gdk/x11/gdkim-x11.c: rename things that got renamed.
+
+ * gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
+ remove the image_put stuff that got transferred to GdkDrawable.
+
+ * gdk/x11/gdkinput.c: renamings
+
+ * gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
+
+ * gdk/x11/gdkpixmap-x11.c: GObject conversion
+
+ * gdk/x11/gdkprivate-x11.h: indentation fixes
+
+ * gdk/x11/gdkproperty-x11.c: renamings
+
+ * gdk/x11/gdkselection-x11.c: renamings
+
+ * gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
+ implements the platform-specific "impl" object.
+ Moved gdk_window_get_children to gdk/gdkwindow.c
+
+ * gdk/x11/gdkx.h: Remove all the private structs and private datas
+ that no longer exist. Add declaration of GdkGCX11 object here.
+ Fix all the macros to still work.
+
+ * gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
+ GdkDragContext from the boxed types since they are now GObjects.
+
+ * gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
+ moved xthickness/ythickness into the instance. GtkStyleClass
+ functions are now in the standard vtable for GtkStyle, so you have
+ to create a GObject subclass to write a theme engine.
+ (gtk_style_copy): fixed a leaked PangoFontDescription
+ (gtk_style_init): renamed gtk_style_realize, so gtk_style_init
+ can be the standard GObject function.
+
+ * Throughout GTK:
+ s/style->klass->[xy]thickness/style->[xy]thickness
+ s/pango_layout_unref/g_object_unref/
+
+ * gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
+
+ * gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
+ accessing GDK internals.
+
+ * gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
+ accessing GDK internals.
+
2000-06-18 Elliot Lee <sopwith@redhat.com>
* gtk/gtkwindow.c: Don't allow creation of a window bigger than the screen.
@@ -84,7 +260,7 @@ Mon Jun 5 19:32:53 CEST 2000 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/gdk*generic*: delete generic region code.
* gdk/linux-fb/gdk*generic*: delete generic region code.
* README.nanox: update information.
-
+
Tue Jun 6 10:53:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_prepend_widget): Fix to
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index eaaadd5c58..54808d8d1d 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,179 @@
+2000-06-20 Havoc Pennington <hp@redhat.com>
+
+ * modules/linux-fb/Makefile.am: Make this compile
+ without framebuffer enabled
+
+ * gdk/linux-fb/Makefile.am: Add conditional to not build
+ framebuffer unless specified in configure
+
+ * gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
+ the size of the target instead of source if -1 was passed for
+ width/height
+
+ * gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
+ width/height confusion.
+
+2000-06-19 Havoc Pennington <hp@redhat.com>
+
+ * gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
+ GDK_DRAWABLE_XID. In the future, we probably want to make it
+ faster with G_DISABLE_CHECKS turned on.
+
+2000-06-14 Havoc Pennington <hp@redhat.com>
+
+ * gdk/Makefile.am: add gdkpixmap.c
+
+ * gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
+ s/gdk_image_init/_gdk_windowing_image_init
+
+ * gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
+ ref/unref
+
+ * gdk/gdkcolor.h: make GdkColormap a GObject subclass
+
+ * gdk/gdkcompat.h: remove GdkWindowType compat, since
+ GdkWindowType is now non-deprecated;
+ change gdk_window_get_type() compat to be
+ gdk_window_get_window_type().
+
+ * gdk/gdkdnd.h: make GdkDragContext a GObject.
+
+ * gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
+ virtual GObject. Make all functions call into the vtable.
+ Move gdk_image_put() guts in here. Remove GdkDrawableType
+ and gdk_drawable_get_type(), these are now GdkWindow-specific.
+ draw_image, get_depth, get_size, set_colormap, get_colormap,
+ get_visual added to the vtable.
+
+ * gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
+ GObject. Virtualize everything.
+ (gdk_gc_new_with_values): remove check for destroyed window,
+ because now GdkWindow::create_gc will check this.
+ (gdk_gc_set_values): New function to set GC values, this
+ was already implemented but wasn't in the header
+
+ * gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
+
+ * gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
+ _gdk_window_draw_image(), remove _gdk_windowing_window_class,
+ remove _gdk_window_class; add _gdk_window_impl_get_type() and
+ _gdk_pixmap_impl_get_type(). Rename gdk_window_init to
+ _gdk_windowing_window_init, rename gdk_image_init to
+ _gdk_windowing_image_init.
+
+ * gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
+ (gdk_draw_layout): Remove check for destroyed window,
+ because all the drawable methods already check it.
+
+ * gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
+ Add gdkpixmap.c which contains implementation of GdkDrawable
+ virtual table (by chaining to a platform-specific implementation
+ object).
+
+ * gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
+ GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
+ GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
+ GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
+ GdkColormapPrivate.
+
+ * gdk/gdktypes.h: #include <glib-object.h>
+
+ * gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
+ Move most functionality to platform-specific implementation
+ object. GdkWindow itself now handles the backing store, then
+ chains to the platform-specific implementation.
+ (gdk_window_get_window_type): return GdkWindowType of the window.
+ (gdk_window_peek_children): New routine, returns the children of
+ a GdkWindow
+ (gdk_window_get_children): Was in X11-specific code and did
+ XQueryTree. Changed to simply return a copy of window->children;
+ so it can go in cross-platform code.
+
+ * gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
+
+ * gdk/x11/gdkcolor-x11.c: implement X-specific parts of
+ GdkColormap; just changed to use the new private data instead
+ of casting to GdkColormapPrivate.
+
+ * gdk/x11/gdkcursor-x11.c: added a couple typechecks to
+ gdk_cursor_new().
+
+ * gdk/x11/gdkdnd-x11.c: Change the way we access private fields
+ (private data member in the GObject).
+ (xdnd_manager_source_filter): Function had broken
+ error handling, fix it (use gdk_error_trap_push).
+
+ * gdk/x11/gdkdrawable-x11.c: This file now implements
+ a base class for GdkWindowImplX11/GdkPixmapImplX11. This
+ base class is purely for the convenience of the X port,
+ and not part of the interface to cross-platform GDK.
+
+ * gdk/x11/gdkevents-x11.c: Reflect various renamings.
+
+ * gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
+ specific to X, and returned by the create_gc virtual method
+ of GdkDrawableImplX11.
+ (gdk_x11_gc_set_dashes): Change this to take an array of gint8
+ rather than gchar, this was also changed in the GdkGC vtable.
+ (gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
+ mask is 0, return immediately, instead of checking every flag.
+ This is faster, and keeps us from segfaulting if values is NULL
+ and the mask contains some nonzero flags.
+
+ * gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
+ GdkWindow.
+
+ * gdk/x11/gdkglobals-x11.c: change type of grab window, since
+ GdkWindowPrivate is gone.
+
+ * gdk/x11/gdkim-x11.c: rename things that got renamed.
+
+ * gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
+ remove the image_put stuff that got transferred to GdkDrawable.
+
+ * gdk/x11/gdkinput.c: renamings
+
+ * gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
+
+ * gdk/x11/gdkpixmap-x11.c: GObject conversion
+
+ * gdk/x11/gdkprivate-x11.h: indentation fixes
+
+ * gdk/x11/gdkproperty-x11.c: renamings
+
+ * gdk/x11/gdkselection-x11.c: renamings
+
+ * gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
+ implements the platform-specific "impl" object.
+ Moved gdk_window_get_children to gdk/gdkwindow.c
+
+ * gdk/x11/gdkx.h: Remove all the private structs and private datas
+ that no longer exist. Add declaration of GdkGCX11 object here.
+ Fix all the macros to still work.
+
+ * gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
+ GdkDragContext from the boxed types since they are now GObjects.
+
+ * gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
+ moved xthickness/ythickness into the instance. GtkStyleClass
+ functions are now in the standard vtable for GtkStyle, so you have
+ to create a GObject subclass to write a theme engine.
+ (gtk_style_copy): fixed a leaked PangoFontDescription
+ (gtk_style_init): renamed gtk_style_realize, so gtk_style_init
+ can be the standard GObject function.
+
+ * Throughout GTK:
+ s/style->klass->[xy]thickness/style->[xy]thickness
+ s/pango_layout_unref/g_object_unref/
+
+ * gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
+
+ * gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
+ accessing GDK internals.
+
+ * gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
+ accessing GDK internals.
+
2000-06-18 Elliot Lee <sopwith@redhat.com>
* gtk/gtkwindow.c: Don't allow creation of a window bigger than the screen.
@@ -84,7 +260,7 @@ Mon Jun 5 19:32:53 CEST 2000 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/gdk*generic*: delete generic region code.
* gdk/linux-fb/gdk*generic*: delete generic region code.
* README.nanox: update information.
-
+
Tue Jun 6 10:53:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_prepend_widget): Fix to
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index eaaadd5c58..54808d8d1d 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,179 @@
+2000-06-20 Havoc Pennington <hp@redhat.com>
+
+ * modules/linux-fb/Makefile.am: Make this compile
+ without framebuffer enabled
+
+ * gdk/linux-fb/Makefile.am: Add conditional to not build
+ framebuffer unless specified in configure
+
+ * gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
+ the size of the target instead of source if -1 was passed for
+ width/height
+
+ * gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
+ width/height confusion.
+
+2000-06-19 Havoc Pennington <hp@redhat.com>
+
+ * gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
+ GDK_DRAWABLE_XID. In the future, we probably want to make it
+ faster with G_DISABLE_CHECKS turned on.
+
+2000-06-14 Havoc Pennington <hp@redhat.com>
+
+ * gdk/Makefile.am: add gdkpixmap.c
+
+ * gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
+ s/gdk_image_init/_gdk_windowing_image_init
+
+ * gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
+ ref/unref
+
+ * gdk/gdkcolor.h: make GdkColormap a GObject subclass
+
+ * gdk/gdkcompat.h: remove GdkWindowType compat, since
+ GdkWindowType is now non-deprecated;
+ change gdk_window_get_type() compat to be
+ gdk_window_get_window_type().
+
+ * gdk/gdkdnd.h: make GdkDragContext a GObject.
+
+ * gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
+ virtual GObject. Make all functions call into the vtable.
+ Move gdk_image_put() guts in here. Remove GdkDrawableType
+ and gdk_drawable_get_type(), these are now GdkWindow-specific.
+ draw_image, get_depth, get_size, set_colormap, get_colormap,
+ get_visual added to the vtable.
+
+ * gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
+ GObject. Virtualize everything.
+ (gdk_gc_new_with_values): remove check for destroyed window,
+ because now GdkWindow::create_gc will check this.
+ (gdk_gc_set_values): New function to set GC values, this
+ was already implemented but wasn't in the header
+
+ * gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
+
+ * gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
+ _gdk_window_draw_image(), remove _gdk_windowing_window_class,
+ remove _gdk_window_class; add _gdk_window_impl_get_type() and
+ _gdk_pixmap_impl_get_type(). Rename gdk_window_init to
+ _gdk_windowing_window_init, rename gdk_image_init to
+ _gdk_windowing_image_init.
+
+ * gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
+ (gdk_draw_layout): Remove check for destroyed window,
+ because all the drawable methods already check it.
+
+ * gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
+ Add gdkpixmap.c which contains implementation of GdkDrawable
+ virtual table (by chaining to a platform-specific implementation
+ object).
+
+ * gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
+ GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
+ GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
+ GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
+ GdkColormapPrivate.
+
+ * gdk/gdktypes.h: #include <glib-object.h>
+
+ * gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
+ Move most functionality to platform-specific implementation
+ object. GdkWindow itself now handles the backing store, then
+ chains to the platform-specific implementation.
+ (gdk_window_get_window_type): return GdkWindowType of the window.
+ (gdk_window_peek_children): New routine, returns the children of
+ a GdkWindow
+ (gdk_window_get_children): Was in X11-specific code and did
+ XQueryTree. Changed to simply return a copy of window->children;
+ so it can go in cross-platform code.
+
+ * gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
+
+ * gdk/x11/gdkcolor-x11.c: implement X-specific parts of
+ GdkColormap; just changed to use the new private data instead
+ of casting to GdkColormapPrivate.
+
+ * gdk/x11/gdkcursor-x11.c: added a couple typechecks to
+ gdk_cursor_new().
+
+ * gdk/x11/gdkdnd-x11.c: Change the way we access private fields
+ (private data member in the GObject).
+ (xdnd_manager_source_filter): Function had broken
+ error handling, fix it (use gdk_error_trap_push).
+
+ * gdk/x11/gdkdrawable-x11.c: This file now implements
+ a base class for GdkWindowImplX11/GdkPixmapImplX11. This
+ base class is purely for the convenience of the X port,
+ and not part of the interface to cross-platform GDK.
+
+ * gdk/x11/gdkevents-x11.c: Reflect various renamings.
+
+ * gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
+ specific to X, and returned by the create_gc virtual method
+ of GdkDrawableImplX11.
+ (gdk_x11_gc_set_dashes): Change this to take an array of gint8
+ rather than gchar, this was also changed in the GdkGC vtable.
+ (gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
+ mask is 0, return immediately, instead of checking every flag.
+ This is faster, and keeps us from segfaulting if values is NULL
+ and the mask contains some nonzero flags.
+
+ * gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
+ GdkWindow.
+
+ * gdk/x11/gdkglobals-x11.c: change type of grab window, since
+ GdkWindowPrivate is gone.
+
+ * gdk/x11/gdkim-x11.c: rename things that got renamed.
+
+ * gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
+ remove the image_put stuff that got transferred to GdkDrawable.
+
+ * gdk/x11/gdkinput.c: renamings
+
+ * gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
+
+ * gdk/x11/gdkpixmap-x11.c: GObject conversion
+
+ * gdk/x11/gdkprivate-x11.h: indentation fixes
+
+ * gdk/x11/gdkproperty-x11.c: renamings
+
+ * gdk/x11/gdkselection-x11.c: renamings
+
+ * gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
+ implements the platform-specific "impl" object.
+ Moved gdk_window_get_children to gdk/gdkwindow.c
+
+ * gdk/x11/gdkx.h: Remove all the private structs and private datas
+ that no longer exist. Add declaration of GdkGCX11 object here.
+ Fix all the macros to still work.
+
+ * gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
+ GdkDragContext from the boxed types since they are now GObjects.
+
+ * gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
+ moved xthickness/ythickness into the instance. GtkStyleClass
+ functions are now in the standard vtable for GtkStyle, so you have
+ to create a GObject subclass to write a theme engine.
+ (gtk_style_copy): fixed a leaked PangoFontDescription
+ (gtk_style_init): renamed gtk_style_realize, so gtk_style_init
+ can be the standard GObject function.
+
+ * Throughout GTK:
+ s/style->klass->[xy]thickness/style->[xy]thickness
+ s/pango_layout_unref/g_object_unref/
+
+ * gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
+
+ * gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
+ accessing GDK internals.
+
+ * gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
+ accessing GDK internals.
+
2000-06-18 Elliot Lee <sopwith@redhat.com>
* gtk/gtkwindow.c: Don't allow creation of a window bigger than the screen.
@@ -84,7 +260,7 @@ Mon Jun 5 19:32:53 CEST 2000 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/gdk*generic*: delete generic region code.
* gdk/linux-fb/gdk*generic*: delete generic region code.
* README.nanox: update information.
-
+
Tue Jun 6 10:53:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_prepend_widget): Fix to
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index eaaadd5c58..54808d8d1d 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,179 @@
+2000-06-20 Havoc Pennington <hp@redhat.com>
+
+ * modules/linux-fb/Makefile.am: Make this compile
+ without framebuffer enabled
+
+ * gdk/linux-fb/Makefile.am: Add conditional to not build
+ framebuffer unless specified in configure
+
+ * gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
+ the size of the target instead of source if -1 was passed for
+ width/height
+
+ * gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
+ width/height confusion.
+
+2000-06-19 Havoc Pennington <hp@redhat.com>
+
+ * gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
+ GDK_DRAWABLE_XID. In the future, we probably want to make it
+ faster with G_DISABLE_CHECKS turned on.
+
+2000-06-14 Havoc Pennington <hp@redhat.com>
+
+ * gdk/Makefile.am: add gdkpixmap.c
+
+ * gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
+ s/gdk_image_init/_gdk_windowing_image_init
+
+ * gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
+ ref/unref
+
+ * gdk/gdkcolor.h: make GdkColormap a GObject subclass
+
+ * gdk/gdkcompat.h: remove GdkWindowType compat, since
+ GdkWindowType is now non-deprecated;
+ change gdk_window_get_type() compat to be
+ gdk_window_get_window_type().
+
+ * gdk/gdkdnd.h: make GdkDragContext a GObject.
+
+ * gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
+ virtual GObject. Make all functions call into the vtable.
+ Move gdk_image_put() guts in here. Remove GdkDrawableType
+ and gdk_drawable_get_type(), these are now GdkWindow-specific.
+ draw_image, get_depth, get_size, set_colormap, get_colormap,
+ get_visual added to the vtable.
+
+ * gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
+ GObject. Virtualize everything.
+ (gdk_gc_new_with_values): remove check for destroyed window,
+ because now GdkWindow::create_gc will check this.
+ (gdk_gc_set_values): New function to set GC values, this
+ was already implemented but wasn't in the header
+
+ * gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
+
+ * gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
+ _gdk_window_draw_image(), remove _gdk_windowing_window_class,
+ remove _gdk_window_class; add _gdk_window_impl_get_type() and
+ _gdk_pixmap_impl_get_type(). Rename gdk_window_init to
+ _gdk_windowing_window_init, rename gdk_image_init to
+ _gdk_windowing_image_init.
+
+ * gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
+ (gdk_draw_layout): Remove check for destroyed window,
+ because all the drawable methods already check it.
+
+ * gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
+ Add gdkpixmap.c which contains implementation of GdkDrawable
+ virtual table (by chaining to a platform-specific implementation
+ object).
+
+ * gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
+ GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
+ GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
+ GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
+ GdkColormapPrivate.
+
+ * gdk/gdktypes.h: #include <glib-object.h>
+
+ * gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
+ Move most functionality to platform-specific implementation
+ object. GdkWindow itself now handles the backing store, then
+ chains to the platform-specific implementation.
+ (gdk_window_get_window_type): return GdkWindowType of the window.
+ (gdk_window_peek_children): New routine, returns the children of
+ a GdkWindow
+ (gdk_window_get_children): Was in X11-specific code and did
+ XQueryTree. Changed to simply return a copy of window->children;
+ so it can go in cross-platform code.
+
+ * gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
+
+ * gdk/x11/gdkcolor-x11.c: implement X-specific parts of
+ GdkColormap; just changed to use the new private data instead
+ of casting to GdkColormapPrivate.
+
+ * gdk/x11/gdkcursor-x11.c: added a couple typechecks to
+ gdk_cursor_new().
+
+ * gdk/x11/gdkdnd-x11.c: Change the way we access private fields
+ (private data member in the GObject).
+ (xdnd_manager_source_filter): Function had broken
+ error handling, fix it (use gdk_error_trap_push).
+
+ * gdk/x11/gdkdrawable-x11.c: This file now implements
+ a base class for GdkWindowImplX11/GdkPixmapImplX11. This
+ base class is purely for the convenience of the X port,
+ and not part of the interface to cross-platform GDK.
+
+ * gdk/x11/gdkevents-x11.c: Reflect various renamings.
+
+ * gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
+ specific to X, and returned by the create_gc virtual method
+ of GdkDrawableImplX11.
+ (gdk_x11_gc_set_dashes): Change this to take an array of gint8
+ rather than gchar, this was also changed in the GdkGC vtable.
+ (gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
+ mask is 0, return immediately, instead of checking every flag.
+ This is faster, and keeps us from segfaulting if values is NULL
+ and the mask contains some nonzero flags.
+
+ * gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
+ GdkWindow.
+
+ * gdk/x11/gdkglobals-x11.c: change type of grab window, since
+ GdkWindowPrivate is gone.
+
+ * gdk/x11/gdkim-x11.c: rename things that got renamed.
+
+ * gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
+ remove the image_put stuff that got transferred to GdkDrawable.
+
+ * gdk/x11/gdkinput.c: renamings
+
+ * gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
+
+ * gdk/x11/gdkpixmap-x11.c: GObject conversion
+
+ * gdk/x11/gdkprivate-x11.h: indentation fixes
+
+ * gdk/x11/gdkproperty-x11.c: renamings
+
+ * gdk/x11/gdkselection-x11.c: renamings
+
+ * gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
+ implements the platform-specific "impl" object.
+ Moved gdk_window_get_children to gdk/gdkwindow.c
+
+ * gdk/x11/gdkx.h: Remove all the private structs and private datas
+ that no longer exist. Add declaration of GdkGCX11 object here.
+ Fix all the macros to still work.
+
+ * gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
+ GdkDragContext from the boxed types since they are now GObjects.
+
+ * gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
+ moved xthickness/ythickness into the instance. GtkStyleClass
+ functions are now in the standard vtable for GtkStyle, so you have
+ to create a GObject subclass to write a theme engine.
+ (gtk_style_copy): fixed a leaked PangoFontDescription
+ (gtk_style_init): renamed gtk_style_realize, so gtk_style_init
+ can be the standard GObject function.
+
+ * Throughout GTK:
+ s/style->klass->[xy]thickness/style->[xy]thickness
+ s/pango_layout_unref/g_object_unref/
+
+ * gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
+
+ * gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
+ accessing GDK internals.
+
+ * gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
+ accessing GDK internals.
+
2000-06-18 Elliot Lee <sopwith@redhat.com>
* gtk/gtkwindow.c: Don't allow creation of a window bigger than the screen.
@@ -84,7 +260,7 @@ Mon Jun 5 19:32:53 CEST 2000 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/gdk*generic*: delete generic region code.
* gdk/linux-fb/gdk*generic*: delete generic region code.
* README.nanox: update information.
-
+
Tue Jun 6 10:53:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_prepend_widget): Fix to
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index eaaadd5c58..54808d8d1d 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,179 @@
+2000-06-20 Havoc Pennington <hp@redhat.com>
+
+ * modules/linux-fb/Makefile.am: Make this compile
+ without framebuffer enabled
+
+ * gdk/linux-fb/Makefile.am: Add conditional to not build
+ framebuffer unless specified in configure
+
+ * gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
+ the size of the target instead of source if -1 was passed for
+ width/height
+
+ * gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
+ width/height confusion.
+
+2000-06-19 Havoc Pennington <hp@redhat.com>
+
+ * gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
+ GDK_DRAWABLE_XID. In the future, we probably want to make it
+ faster with G_DISABLE_CHECKS turned on.
+
+2000-06-14 Havoc Pennington <hp@redhat.com>
+
+ * gdk/Makefile.am: add gdkpixmap.c
+
+ * gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
+ s/gdk_image_init/_gdk_windowing_image_init
+
+ * gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
+ ref/unref
+
+ * gdk/gdkcolor.h: make GdkColormap a GObject subclass
+
+ * gdk/gdkcompat.h: remove GdkWindowType compat, since
+ GdkWindowType is now non-deprecated;
+ change gdk_window_get_type() compat to be
+ gdk_window_get_window_type().
+
+ * gdk/gdkdnd.h: make GdkDragContext a GObject.
+
+ * gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
+ virtual GObject. Make all functions call into the vtable.
+ Move gdk_image_put() guts in here. Remove GdkDrawableType
+ and gdk_drawable_get_type(), these are now GdkWindow-specific.
+ draw_image, get_depth, get_size, set_colormap, get_colormap,
+ get_visual added to the vtable.
+
+ * gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
+ GObject. Virtualize everything.
+ (gdk_gc_new_with_values): remove check for destroyed window,
+ because now GdkWindow::create_gc will check this.
+ (gdk_gc_set_values): New function to set GC values, this
+ was already implemented but wasn't in the header
+
+ * gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
+
+ * gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
+ _gdk_window_draw_image(), remove _gdk_windowing_window_class,
+ remove _gdk_window_class; add _gdk_window_impl_get_type() and
+ _gdk_pixmap_impl_get_type(). Rename gdk_window_init to
+ _gdk_windowing_window_init, rename gdk_image_init to
+ _gdk_windowing_image_init.
+
+ * gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
+ (gdk_draw_layout): Remove check for destroyed window,
+ because all the drawable methods already check it.
+
+ * gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
+ Add gdkpixmap.c which contains implementation of GdkDrawable
+ virtual table (by chaining to a platform-specific implementation
+ object).
+
+ * gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
+ GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
+ GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
+ GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
+ GdkColormapPrivate.
+
+ * gdk/gdktypes.h: #include <glib-object.h>
+
+ * gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
+ Move most functionality to platform-specific implementation
+ object. GdkWindow itself now handles the backing store, then
+ chains to the platform-specific implementation.
+ (gdk_window_get_window_type): return GdkWindowType of the window.
+ (gdk_window_peek_children): New routine, returns the children of
+ a GdkWindow
+ (gdk_window_get_children): Was in X11-specific code and did
+ XQueryTree. Changed to simply return a copy of window->children;
+ so it can go in cross-platform code.
+
+ * gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
+
+ * gdk/x11/gdkcolor-x11.c: implement X-specific parts of
+ GdkColormap; just changed to use the new private data instead
+ of casting to GdkColormapPrivate.
+
+ * gdk/x11/gdkcursor-x11.c: added a couple typechecks to
+ gdk_cursor_new().
+
+ * gdk/x11/gdkdnd-x11.c: Change the way we access private fields
+ (private data member in the GObject).
+ (xdnd_manager_source_filter): Function had broken
+ error handling, fix it (use gdk_error_trap_push).
+
+ * gdk/x11/gdkdrawable-x11.c: This file now implements
+ a base class for GdkWindowImplX11/GdkPixmapImplX11. This
+ base class is purely for the convenience of the X port,
+ and not part of the interface to cross-platform GDK.
+
+ * gdk/x11/gdkevents-x11.c: Reflect various renamings.
+
+ * gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
+ specific to X, and returned by the create_gc virtual method
+ of GdkDrawableImplX11.
+ (gdk_x11_gc_set_dashes): Change this to take an array of gint8
+ rather than gchar, this was also changed in the GdkGC vtable.
+ (gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
+ mask is 0, return immediately, instead of checking every flag.
+ This is faster, and keeps us from segfaulting if values is NULL
+ and the mask contains some nonzero flags.
+
+ * gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
+ GdkWindow.
+
+ * gdk/x11/gdkglobals-x11.c: change type of grab window, since
+ GdkWindowPrivate is gone.
+
+ * gdk/x11/gdkim-x11.c: rename things that got renamed.
+
+ * gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
+ remove the image_put stuff that got transferred to GdkDrawable.
+
+ * gdk/x11/gdkinput.c: renamings
+
+ * gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
+
+ * gdk/x11/gdkpixmap-x11.c: GObject conversion
+
+ * gdk/x11/gdkprivate-x11.h: indentation fixes
+
+ * gdk/x11/gdkproperty-x11.c: renamings
+
+ * gdk/x11/gdkselection-x11.c: renamings
+
+ * gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
+ implements the platform-specific "impl" object.
+ Moved gdk_window_get_children to gdk/gdkwindow.c
+
+ * gdk/x11/gdkx.h: Remove all the private structs and private datas
+ that no longer exist. Add declaration of GdkGCX11 object here.
+ Fix all the macros to still work.
+
+ * gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
+ GdkDragContext from the boxed types since they are now GObjects.
+
+ * gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
+ moved xthickness/ythickness into the instance. GtkStyleClass
+ functions are now in the standard vtable for GtkStyle, so you have
+ to create a GObject subclass to write a theme engine.
+ (gtk_style_copy): fixed a leaked PangoFontDescription
+ (gtk_style_init): renamed gtk_style_realize, so gtk_style_init
+ can be the standard GObject function.
+
+ * Throughout GTK:
+ s/style->klass->[xy]thickness/style->[xy]thickness
+ s/pango_layout_unref/g_object_unref/
+
+ * gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
+
+ * gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
+ accessing GDK internals.
+
+ * gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
+ accessing GDK internals.
+
2000-06-18 Elliot Lee <sopwith@redhat.com>
* gtk/gtkwindow.c: Don't allow creation of a window bigger than the screen.
@@ -84,7 +260,7 @@ Mon Jun 5 19:32:53 CEST 2000 Paolo Molaro <lupus@linuxcare.com>
* gdk/nanox/gdk*generic*: delete generic region code.
* gdk/linux-fb/gdk*generic*: delete generic region code.
* README.nanox: update information.
-
+
Tue Jun 6 10:53:59 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_prepend_widget): Fix to
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 6f23194a3a..168750d0bd 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -74,6 +74,7 @@ gdk_public_h_sources = @STRIP_BEGIN@ \
gdkvisual.h \
gdkwindow.h \
@STRIP_END@
+
gdk_c_sources = @STRIP_BEGIN@ \
gdk.c \
gdkcolor.c \
@@ -87,6 +88,7 @@ gdk_c_sources = @STRIP_BEGIN@ \
gdkimage.c \
gdkinternals.h \
gdkpango.c \
+ gdkpixmap.c \
gdkpoly-generic.h \
gdkpolyreg-generic.c \
gdkrgb.c \
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 0e3e93c299..21aaf2624b 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -312,7 +312,7 @@ gdk_init_check (int *argc,
gdk_ndebug_keys);
}
#endif /* G_ENABLE_DEBUG */
-
+
arg_context = gdk_arg_context_new (NULL);
gdk_arg_context_add_table (arg_context, gdk_args);
gdk_arg_context_add_table (arg_context, _gdk_windowing_args);
@@ -336,8 +336,8 @@ gdk_init_check (int *argc,
gdk_events_init ();
gdk_visual_init ();
- gdk_window_init ();
- gdk_image_init ();
+ _gdk_windowing_window_init ();
+ _gdk_windowing_image_init ();
gdk_input_init ();
gdk_dnd_init ();
diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c
index e06bc400a8..fc53956d73 100644
--- a/gdk/gdkcolor.c
+++ b/gdk/gdkcolor.c
@@ -32,37 +32,21 @@
GdkColormap*
gdk_colormap_ref (GdkColormap *cmap)
{
- GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
-
- g_return_val_if_fail (cmap != NULL, NULL);
-
- private->ref_count += 1;
- return cmap;
+ return (GdkColormap *) g_object_ref (G_OBJECT (cmap));
}
void
gdk_colormap_unref (GdkColormap *cmap)
{
- GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
-
- g_return_if_fail (cmap != NULL);
- g_return_if_fail (private->ref_count > 0);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- _gdk_colormap_real_destroy (cmap);
+ g_object_unref (G_OBJECT (cmap));
}
GdkVisual *
gdk_colormap_get_visual (GdkColormap *colormap)
{
- GdkColormapPrivate *private;
-
- g_return_val_if_fail (colormap != NULL, NULL);
-
- private = (GdkColormapPrivate *)colormap;
+ g_return_val_if_fail (GDK_IS_COLORMAP (colormap), NULL);
- return private->visual;
+ return colormap->visual;
}
void
diff --git a/gdk/gdkcolor.h b/gdk/gdkcolor.h
index d2af35266a..f7ab3ff5da 100644
--- a/gdk/gdkcolor.h
+++ b/gdk/gdkcolor.h
@@ -24,12 +24,38 @@ struct _GdkColor
/* The colormap type.
*/
+
+typedef struct _GdkColormapClass GdkColormapClass;
+
+#define GDK_TYPE_COLORMAP (gdk_colormap_get_type ())
+#define GDK_COLORMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_COLORMAP, GdkColormap))
+#define GDK_COLORMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_COLORMAP, GdkColormapClass))
+#define GDK_IS_COLORMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_COLORMAP))
+#define GDK_IS_COLORMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_COLORMAP))
+#define GDK_COLORMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_COLORMAP, GdkColormapClass))
+
+
struct _GdkColormap
{
+ GObject parent_instance;
+
+ /*< public >*/
gint size;
GdkColor *colors;
+
+ /*< private >*/
+ GdkVisual *visual;
+
+ gpointer windowing_data;
+};
+
+struct _GdkColormapClass
+{
+ GObjectClass parent_class;
+
};
+GType gdk_colormap_get_type (void);
GdkColormap* gdk_colormap_new (GdkVisual *visual,
gboolean allocate);
diff --git a/gdk/gdkcompat.h b/gdk/gdkcompat.h
index b078370869..742f0082d1 100644
--- a/gdk/gdkcompat.h
+++ b/gdk/gdkcompat.h
@@ -11,13 +11,11 @@ extern "C" {
*/
#ifndef GDK_DISABLE_COMPAT_H
-#define GdkWindowType GdkDrawableType
-
#define gdk_draw_pixmap gdk_draw_drawable
#define gdk_draw_bitmap gdk_draw_drawable
#define gdk_window_get_size gdk_drawable_get_size
-#define gdk_window_get_type gdk_drawable_get_type
+#define gdk_window_get_type gdk_window_get_window_type
#define gdk_window_get_colormap gdk_drawable_get_colormap
#define gdk_window_set_colormap gdk_drawable_set_colormap
#define gdk_window_get_visual gdk_drawable_get_visual
diff --git a/gdk/gdkdnd.h b/gdk/gdkdnd.h
index 657e00c820..803872b9c1 100644
--- a/gdk/gdkdnd.h
+++ b/gdk/gdkdnd.h
@@ -31,10 +31,24 @@ typedef enum
GDK_DRAG_PROTO_LOCAL /* Intra-app */
} GdkDragProtocol;
-/* Structure that holds information about a drag in progress.
+/* Object that holds information about a drag in progress.
* this is used on both source and destination sides.
*/
+
+typedef struct _GdkDragContextClass GdkDragContextClass;
+
+#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
+#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
+#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
+#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
+#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
+#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
+
struct _GdkDragContext {
+ GObject parent_instance;
+
+ /*< public >*/
+
GdkDragProtocol protocol;
gboolean is_source;
@@ -48,10 +62,21 @@ struct _GdkDragContext {
GdkDragAction action;
guint32 start_time;
+
+ /*< private >*/
+
+ gpointer windowing_data;
+};
+
+struct _GdkDragContextClass {
+ GObjectClass parent_class;
+
+
};
/* Drag and Drop */
+GType gdk_drag_context_get_type (void);
GdkDragContext * gdk_drag_context_new (void);
void gdk_drag_context_ref (GdkDragContext *context);
void gdk_drag_context_unref (GdkDragContext *context);
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index ceb3db0d1b..8503035df8 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -28,54 +28,59 @@
#include "gdkinternals.h"
#include "gdkwindow.h"
-/* Manipulation of drawables
- */
-GdkDrawable *
-gdk_drawable_alloc (void)
+GType
+gdk_drawable_get_type (void)
{
- GdkDrawablePrivate *private = g_new (GdkDrawablePrivate, 1);
- GdkDrawable *drawable = (GdkDrawable*) private;
-
- drawable->user_data = NULL;
-
- private->ref_count = 1;
- private->destroyed = FALSE;
- private->klass = NULL;
- private->klass_data = NULL;
- private->window_type = GDK_WINDOW_CHILD;
-
- private->width = 1;
- private->height = 1;
-
- private->depth = 0;
-
- private->colormap = NULL;
+ static GType object_type = 0;
- return drawable;
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (GdkDrawableClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) NULL,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GdkDrawable),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
+ };
+
+ object_type = g_type_register_static (G_TYPE_OBJECT,
+ "GdkDrawable",
+ &object_info);
+ }
+
+ return object_type;
}
+/* Manipulation of drawables
+ */
+
void
gdk_drawable_set_data (GdkDrawable *drawable,
const gchar *key,
gpointer data,
GDestroyNotify destroy_func)
{
- g_dataset_set_data_full (drawable, key, data, destroy_func);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+
+ g_object_set_qdata_full (G_OBJECT (drawable),
+ g_quark_from_string (key),
+ data,
+ destroy_func);
}
gpointer
gdk_drawable_get_data (GdkDrawable *drawable,
const gchar *key)
{
- return g_dataset_get_data (drawable, key);
-}
-
-GdkDrawableType
-gdk_drawable_get_type (GdkDrawable *drawable)
-{
- g_return_val_if_fail (drawable != NULL, (GdkDrawableType) -1);
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
- return GDK_DRAWABLE_TYPE (drawable);
+ return g_object_get_qdata (G_OBJECT (drawable),
+ g_quark_try_string (key));
}
void
@@ -83,63 +88,56 @@ gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
gint *height)
{
- GdkDrawablePrivate *drawable_private;
-
- g_return_if_fail (drawable != NULL);
-
- drawable_private = (GdkDrawablePrivate*) drawable;
-
- if (width)
- *width = drawable_private->width;
- if (height)
- *height = drawable_private->height;
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+
+ GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
}
GdkVisual*
gdk_drawable_get_visual (GdkDrawable *drawable)
{
- GdkColormap *colormap;
-
- g_return_val_if_fail (drawable != NULL, NULL);
-
- colormap = gdk_drawable_get_colormap (drawable);
- return colormap ? gdk_colormap_get_visual (colormap) : NULL;
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+ return GDK_DRAWABLE_GET_CLASS (drawable)->get_visual (drawable);
}
gint
gdk_drawable_get_depth (GdkDrawable *drawable)
{
- GdkDrawablePrivate *private = (GdkDrawablePrivate *)drawable;
- g_return_val_if_fail (drawable != NULL, 0);
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
- return private->depth;
+ return GDK_DRAWABLE_GET_CLASS (drawable)->get_depth (drawable);
+}
+
+void
+gdk_drawable_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap)
+{
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+
+ GDK_DRAWABLE_GET_CLASS (drawable)->set_colormap (drawable, cmap);
+}
+
+GdkColormap*
+gdk_drawable_get_colormap (GdkDrawable *drawable)
+{
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+ return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable);
}
GdkDrawable*
gdk_drawable_ref (GdkDrawable *drawable)
{
- GdkDrawablePrivate *private = (GdkDrawablePrivate *)drawable;
- g_return_val_if_fail (drawable != NULL, NULL);
-
- private->ref_count += 1;
- return drawable;
+ return (GdkDrawable *) g_object_ref (G_OBJECT (drawable));
}
void
gdk_drawable_unref (GdkDrawable *drawable)
{
- GdkDrawablePrivate *private = (GdkDrawablePrivate *)drawable;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (private->ref_count > 0);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- private->klass->destroy (drawable);
- g_dataset_destroy (drawable);
- g_free (drawable);
- }
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+
+ g_object_unref (G_OBJECT (drawable));
}
/* Drawing
@@ -150,20 +148,15 @@ gdk_draw_point (GdkDrawable *drawable,
gint x,
gint y)
{
- GdkGCPrivate *gc_private;
GdkPoint point;
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
- gc_private = (GdkGCPrivate*) gc;
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ g_return_if_fail (GDK_IS_GC (gc));
point.x = x;
point.y = y;
- ((GdkDrawablePrivate *)drawable)->klass->draw_points (drawable, gc, &point, 1);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc, &point, 1);
}
void
@@ -174,21 +167,18 @@ gdk_draw_line (GdkDrawable *drawable,
gint x2,
gint y2)
{
- GdkGCPrivate *gc_private;
GdkSegment segment;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
-
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
- gc_private = (GdkGCPrivate*) gc;
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ g_return_if_fail (GDK_IS_GC (gc));
segment.x1 = x1;
segment.y1 = y1;
segment.x2 = x2;
segment.y2 = y2;
- ((GdkDrawablePrivate *)drawable)->klass->draw_segments (drawable, gc, &segment, 1);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, &segment, 1);
}
void
@@ -199,23 +189,25 @@ gdk_draw_rectangle (GdkDrawable *drawable,
gint y,
gint width,
gint height)
-{
- GdkDrawablePrivate *drawable_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
+{
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ g_return_if_fail (GDK_IS_GC (gc));
- drawable_private = (GdkDrawablePrivate*) drawable;
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
-
- if (width < 0)
- width = drawable_private->width;
- if (height < 0)
- height = drawable_private->height;
+ if (width < 0 || height < 0)
+ {
+ gint real_width;
+ gint real_height;
+
+ gdk_drawable_get_size (drawable, &real_width, &real_height);
+
+ if (width < 0)
+ width = real_width;
+ if (height < 0)
+ height = real_height;
+ }
- ((GdkDrawablePrivate *)drawable)->klass->draw_rectangle (drawable, gc, filled, x, y,
- width, height);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_rectangle (drawable, gc, filled, x, y,
+ width, height);
}
void
@@ -228,25 +220,25 @@ gdk_draw_arc (GdkDrawable *drawable,
gint height,
gint angle1,
gint angle2)
-{
- GdkDrawablePrivate *drawable_private;
- GdkGCPrivate *gc_private;
+{
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ g_return_if_fail (GDK_IS_GC (gc));
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkDrawablePrivate*) drawable;
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- if (width < 0)
- width = drawable_private->width;
- if (height < 0)
- height = drawable_private->height;
+ if (width < 0 || height < 0)
+ {
+ gint real_width;
+ gint real_height;
+
+ gdk_drawable_get_size (drawable, &real_width, &real_height);
+
+ if (width < 0)
+ width = real_width;
+ if (height < 0)
+ height = real_height;
+ }
- ((GdkDrawablePrivate *)drawable)->klass->draw_arc (drawable, gc, filled,
- x, y, width, height, angle1, angle2);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_arc (drawable, gc, filled,
+ x, y, width, height, angle1, angle2);
}
void
@@ -256,14 +248,11 @@ gdk_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ g_return_if_fail (GDK_IS_GC (gc));
- ((GdkDrawablePrivate *)drawable)->klass->draw_polygon (drawable, gc, filled,
- points, npoints);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_polygon (drawable, gc, filled,
+ points, npoints);
}
/* gdk_draw_string
@@ -298,12 +287,12 @@ gdk_draw_text (GdkDrawable *drawable,
const gchar *text,
gint text_length)
{
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (font != NULL);
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (text != NULL);
- ((GdkDrawablePrivate *)drawable)->klass->draw_text (drawable, font, gc, x, y, text, text_length);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_text (drawable, font, gc, x, y, text, text_length);
}
void
@@ -315,12 +304,12 @@ gdk_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text,
gint text_length)
{
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (font != NULL);
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (text != NULL);
- ((GdkDrawablePrivate *)drawable)->klass->draw_text_wc (drawable, font, gc, x, y, text, text_length);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_text_wc (drawable, font, gc, x, y, text, text_length);
}
void
@@ -334,21 +323,26 @@ gdk_draw_drawable (GdkDrawable *drawable,
gint width,
gint height)
{
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (src != NULL);
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
- if (GDK_DRAWABLE_DESTROYED (drawable) || GDK_DRAWABLE_DESTROYED (src))
- return;
-
- if (width == -1)
- width = ((GdkDrawablePrivate *)src)->width;
- if (height == -1)
- height = ((GdkDrawablePrivate *)src)->height;
+ if (width < 0 || height < 0)
+ {
+ gint real_width;
+ gint real_height;
+
+ gdk_drawable_get_size (src, &real_width, &real_height);
+
+ if (width < 0)
+ width = real_width;
+ if (height < 0)
+ height = real_height;
+ }
- ((GdkDrawablePrivate *)drawable)->klass->draw_drawable (drawable, gc, src,
- xsrc, ysrc, xdest, ydest,
- width, height);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, src,
+ xsrc, ysrc, xdest, ydest,
+ width, height);
}
void
@@ -362,25 +356,17 @@ gdk_draw_image (GdkDrawable *drawable,
gint width,
gint height)
{
- GdkImagePrivate *image_private;
-
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- image_private = (GdkImagePrivate*) image;
+ g_return_if_fail (GDK_IS_GC (gc));
if (width == -1)
width = image->width;
if (height == -1)
height = image->height;
- if (GDK_IS_WINDOW (drawable))
- _gdk_window_draw_image (drawable, gc, image, xsrc, ysrc,
- xdest, ydest, width, height);
- else
- image_private->klass->image_put (image, drawable, gc, xsrc, ysrc,
- xdest, ydest, width, height);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_image (drawable, gc, image, xsrc, ysrc,
+ xdest, ydest, width, height);
}
void
@@ -389,18 +375,15 @@ gdk_draw_points (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail ((points != NULL) && (npoints > 0));
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (npoints >= 0);
if (npoints == 0)
return;
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
-
- ((GdkDrawablePrivate *)drawable)->klass->draw_points (drawable, gc, points, npoints);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc, points, npoints);
}
void
@@ -409,19 +392,16 @@ gdk_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
if (nsegs == 0)
return;
g_return_if_fail (segs != NULL);
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (nsegs >= 0);
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
-
- ((GdkDrawablePrivate *)drawable)->klass->draw_segments (drawable, gc, segs, nsegs);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, segs, nsegs);
}
void
@@ -431,18 +411,15 @@ gdk_draw_lines (GdkDrawable *drawable,
gint npoints)
{
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (points != NULL);
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (npoints >= 0);
if (npoints == 0)
return;
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
-
- ((GdkDrawablePrivate *)drawable)->klass->draw_lines (drawable, gc, points, npoints);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_lines (drawable, gc, points, npoints);
}
void
@@ -454,11 +431,11 @@ gdk_draw_glyphs (GdkDrawable *drawable,
PangoGlyphString *glyphs)
{
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ g_return_if_fail (GDK_IS_GC (gc));
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
- ((GdkDrawablePrivate *)drawable)->klass->draw_glyphs (drawable, gc, font, x, y, glyphs);
+ GDK_DRAWABLE_GET_CLASS (drawable)->draw_glyphs (drawable, gc, font, x, y, glyphs);
}
+
+
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index c7a6ef41eb..0091858ef5 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -10,45 +10,22 @@ extern "C" {
typedef struct _GdkDrawableClass GdkDrawableClass;
-/* Types of windows.
- * Root: There is only 1 root window and it is initialized
- * at startup. Creating a window of type GDK_WINDOW_ROOT
- * is an error.
- * Toplevel: Windows which interact with the window manager.
- * Child: Windows which are children of some other type of window.
- * (Any other type of window). Most windows are child windows.
- * Dialog: A special kind of toplevel window which interacts with
- * the window manager slightly differently than a regular
- * toplevel window. Dialog windows should be used for any
- * transient window.
- * Pixmap: Pixmaps are really just another kind of window which
- * doesn't actually appear on the screen. It can't have
- * children, either and is really just a convenience so
- * that the drawing functions can work on both windows
- * and pixmaps transparently. (ie. You shouldn't pass a
- * pixmap to any procedure which accepts a window with the
- * exception of the drawing functions).
- * Foreign: A window that actually belongs to another application
- */
-typedef enum
-{
- GDK_WINDOW_ROOT,
- GDK_WINDOW_TOPLEVEL,
- GDK_WINDOW_CHILD,
- GDK_WINDOW_DIALOG,
- GDK_WINDOW_TEMP,
- GDK_DRAWABLE_PIXMAP,
- GDK_WINDOW_FOREIGN
-} GdkDrawableType;
+#define GDK_TYPE_DRAWABLE (gdk_drawable_get_type ())
+#define GDK_DRAWABLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE, GdkDrawable))
+#define GDK_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE, GdkDrawableClass))
+#define GDK_IS_DRAWABLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE))
+#define GDK_IS_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE))
+#define GDK_DRAWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE, GdkDrawableClass))
struct _GdkDrawable
{
- gpointer user_data;
+ GObject parent_instance;
};
struct _GdkDrawableClass
{
- void (*destroy) (GdkDrawable *drawable);
+ GObjectClass parent_class;
+
GdkGC *(*create_gc) (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask);
@@ -108,19 +85,40 @@ struct _GdkDrawableClass
GdkGC *gc,
GdkPoint *points,
gint npoints);
+
void (*draw_glyphs) (GdkDrawable *drawable,
GdkGC *gc,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
+
+ void (*draw_image) (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+
+ gint (*get_depth) (GdkDrawable *drawable);
+ void (*get_size) (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+
+ void (*set_colormap) (GdkDrawable *drawable,
+ GdkColormap *cmap);
+
+ GdkColormap* (*get_colormap) (GdkDrawable *drawable);
+ GdkVisual* (*get_visual) (GdkDrawable *drawable);
};
+GType gdk_drawable_get_type (void);
+
/* Manipulation of drawables
*/
-GdkDrawable * gdk_drawable_alloc (void);
-
-GdkDrawableType gdk_drawable_get_type (GdkDrawable *window);
void gdk_drawable_set_data (GdkDrawable *drawable,
const gchar *key,
@@ -129,7 +127,7 @@ void gdk_drawable_set_data (GdkDrawable *drawable,
gpointer gdk_drawable_get_data (GdkDrawable *drawable,
const gchar *key);
-void gdk_drawable_get_size (GdkWindow *drawable,
+void gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
void gdk_drawable_set_colormap (GdkDrawable *drawable,
diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c
index 8eb6eaad46..099ba1cc2b 100644
--- a/gdk/gdkgc.c
+++ b/gdk/gdkgc.c
@@ -29,21 +29,32 @@
#include "gdkgc.h"
#include "gdkprivate.h"
-GdkGC*
-gdk_gc_alloc (void)
+GType
+gdk_gc_get_type (void)
{
- GdkGCPrivate *private;
-
- private = g_new (GdkGCPrivate, 1);
- private->ref_count = 1;
- private->klass = NULL;
- private->klass_data = NULL;
- private->clip_x_origin = 0;
- private->clip_y_origin = 0;
- private->ts_x_origin = 0;
- private->ts_y_origin = 0;
-
- return (GdkGC *)private;
+ static GType object_type = 0;
+
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (GdkGCClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) NULL,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GdkGC),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
+ };
+
+ object_type = g_type_register_static (G_TYPE_OBJECT,
+ "GdkGC",
+ &object_info);
+ }
+
+ return object_type;
}
GdkGC*
@@ -51,9 +62,6 @@ gdk_gc_new (GdkDrawable *drawable)
{
g_return_val_if_fail (drawable != NULL, NULL);
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return NULL;
-
return gdk_gc_new_with_values (drawable, NULL, 0);
}
@@ -63,26 +71,24 @@ gdk_gc_new_with_values (GdkDrawable *drawable,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
- GdkGCPrivate *private;
g_return_val_if_fail (drawable != NULL, NULL);
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return NULL;
+ gc = GDK_DRAWABLE_GET_CLASS (drawable)->create_gc (drawable,
+ values,
+ values_mask);
- gc = ((GdkDrawablePrivate *)drawable)->klass->create_gc (drawable,
- values,
- values_mask);
- private = (GdkGCPrivate *)gc;
+ if (gc == NULL) /* This would mean the drawable was destroyed. */
+ return NULL;
if (values_mask & GDK_GC_CLIP_X_ORIGIN)
- private->clip_x_origin = values->clip_x_origin;
+ gc->clip_x_origin = values->clip_x_origin;
if (values_mask & GDK_GC_CLIP_Y_ORIGIN)
- private->clip_y_origin = values->clip_y_origin;
+ gc->clip_y_origin = values->clip_y_origin;
if (values_mask & GDK_GC_TS_X_ORIGIN)
- private->ts_x_origin = values->ts_x_origin;
+ gc->ts_x_origin = values->ts_x_origin;
if (values_mask & GDK_GC_TS_Y_ORIGIN)
- private->ts_y_origin = values->ts_y_origin;
+ gc->ts_y_origin = values->ts_y_origin;
return gc;
}
@@ -90,39 +96,23 @@ gdk_gc_new_with_values (GdkDrawable *drawable,
GdkGC *
gdk_gc_ref (GdkGC *gc)
{
- GdkGCPrivate *private = (GdkGCPrivate*) gc;
-
- g_return_val_if_fail (gc != NULL, NULL);
- private->ref_count += 1;
-
- return gc;
+ return (GdkGC *) g_object_ref (G_OBJECT (gc));
}
void
gdk_gc_unref (GdkGC *gc)
{
- GdkGCPrivate *private = (GdkGCPrivate*) gc;
-
- g_return_if_fail (gc != NULL);
- g_return_if_fail (private->ref_count > 0);
-
- private->ref_count--;
-
- if (private->ref_count == 0)
- {
- private->klass->destroy (gc);
- g_free (private);
- }
+ g_object_unref (G_OBJECT (gc));
}
void
gdk_gc_get_values (GdkGC *gc,
GdkGCValues *values)
{
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (values != NULL);
- ((GdkGCPrivate *)gc)->klass->get_values (gc, values);
+ GDK_GC_GET_CLASS (gc)->get_values (gc, values);
}
void
@@ -130,21 +120,19 @@ gdk_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
- GdkGCPrivate *private = (GdkGCPrivate *)gc;
-
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (values != NULL);
if (values_mask & GDK_GC_CLIP_X_ORIGIN)
- private->clip_x_origin = values->clip_x_origin;
+ gc->clip_x_origin = values->clip_x_origin;
if (values_mask & GDK_GC_CLIP_Y_ORIGIN)
- private->clip_y_origin = values->clip_y_origin;
+ gc->clip_y_origin = values->clip_y_origin;
if (values_mask & GDK_GC_TS_X_ORIGIN)
- private->ts_x_origin = values->ts_x_origin;
+ gc->ts_x_origin = values->ts_x_origin;
if (values_mask & GDK_GC_TS_Y_ORIGIN)
- private->ts_y_origin = values->ts_y_origin;
+ gc->ts_y_origin = values->ts_y_origin;
- private->klass->set_values (gc, values, values_mask);
+ GDK_GC_GET_CLASS (gc)->set_values (gc, values, values_mask);
}
void
@@ -153,7 +141,7 @@ gdk_gc_set_foreground (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (color != NULL);
values.foreground = *color;
@@ -166,7 +154,7 @@ gdk_gc_set_background (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (color != NULL);
values.background = *color;
@@ -179,7 +167,7 @@ gdk_gc_set_font (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (font != NULL);
values.font = font;
@@ -192,7 +180,7 @@ gdk_gc_set_function (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.function = function;
gdk_gc_set_values (gc, &values, GDK_GC_FUNCTION);
@@ -204,7 +192,7 @@ gdk_gc_set_fill (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.fill = fill;
gdk_gc_set_values (gc, &values, GDK_GC_FILL);
@@ -216,7 +204,7 @@ gdk_gc_set_tile (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.tile = tile;
gdk_gc_set_values (gc, &values, GDK_GC_TILE);
@@ -228,7 +216,7 @@ gdk_gc_set_stipple (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.stipple = stipple;
gdk_gc_set_values (gc, &values, GDK_GC_STIPPLE);
@@ -241,7 +229,7 @@ gdk_gc_set_ts_origin (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.ts_x_origin = x;
values.ts_y_origin = y;
@@ -257,7 +245,7 @@ gdk_gc_set_clip_origin (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.clip_x_origin = x;
values.clip_y_origin = y;
@@ -272,7 +260,7 @@ gdk_gc_set_clip_mask (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.clip_mask = mask;
gdk_gc_set_values (gc, &values, GDK_GC_CLIP_MASK);
@@ -285,7 +273,7 @@ gdk_gc_set_subwindow (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.subwindow_mode = mode;
gdk_gc_set_values (gc, &values, GDK_GC_SUBWINDOW);
@@ -297,7 +285,7 @@ gdk_gc_set_exposures (GdkGC *gc,
{
GdkGCValues values;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
values.graphics_exposures = exposures;
gdk_gc_set_values (gc, &values, GDK_GC_EXPOSURES);
@@ -330,8 +318,8 @@ gdk_gc_set_dashes (GdkGC *gc,
gint8 dash_list[],
gint n)
{
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (dash_list != NULL);
- ((GdkGCPrivate *)gc)->klass->set_dashes (gc, dash_offset, dash_list, n);
+ GDK_GC_GET_CLASS (gc)->set_dashes (gc, dash_offset, dash_list, n);
}
diff --git a/gdk/gdkgc.h b/gdk/gdkgc.h
index 95eaa15ad1..4ae317a881 100644
--- a/gdk/gdkgc.h
+++ b/gdk/gdkgc.h
@@ -151,14 +151,27 @@ struct _GdkGCValues
GdkJoinStyle join_style;
};
+#define GDK_TYPE_GC (gdk_gc_get_type ())
+#define GDK_GC(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC, GdkGC))
+#define GDK_GC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC, GdkGCClass))
+#define GDK_IS_GC(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC))
+#define GDK_IS_GC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC))
+#define GDK_GC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC, GdkGCClass))
+
struct _GdkGC
{
- gint dummy_var;
+ GObject parent_instance;
+
+ gint clip_x_origin;
+ gint clip_y_origin;
+ gint ts_x_origin;
+ gint ts_y_origin;
};
struct _GdkGCClass
{
- void (*destroy) (GdkGC *gc);
+ GObjectClass parent_class;
+
void (*get_values) (GdkGC *gc,
GdkGCValues *values);
void (*set_values) (GdkGC *gc,
@@ -166,23 +179,23 @@ struct _GdkGCClass
GdkGCValuesMask mask);
void (*set_dashes) (GdkGC *gc,
gint dash_offset,
- gchar dash_list[],
+ gint8 dash_list[],
gint n);
};
+GType gdk_gc_get_type (void);
GdkGC *gdk_gc_new (GdkDrawable *drawable);
-GdkGC *gdk_gc_alloc (void);
-
GdkGC *gdk_gc_new_with_values (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
-void gdk_gc_init (GdkGC *gc,
- GdkGCClass *klass);
GdkGC *gdk_gc_ref (GdkGC *gc);
void gdk_gc_unref (GdkGC *gc);
void gdk_gc_get_values (GdkGC *gc,
GdkGCValues *values);
+void gdk_gc_set_values (GdkGC *gc,
+ GdkGCValues *values,
+ GdkGCValuesMask values_mask);
void gdk_gc_set_foreground (GdkGC *gc,
GdkColor *color);
void gdk_gc_set_background (GdkGC *gc,
diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c
index 1e82d50df2..7eaf462161 100644
--- a/gdk/gdkimage.c
+++ b/gdk/gdkimage.c
@@ -33,26 +33,13 @@
GdkImage *
gdk_image_ref (GdkImage *image)
{
- GdkImagePrivate *private = (GdkImagePrivate *)image;
-
- g_return_val_if_fail (image != NULL, NULL);
-
- private->ref_count++;
-
- return image;
+ return (GdkImage *) g_object_ref (G_OBJECT (image));
}
void
gdk_image_unref (GdkImage *image)
{
- GdkImagePrivate *private = (GdkImagePrivate *)image;
-
- g_return_if_fail (image != NULL);
- g_return_if_fail (private->ref_count > 0);
+ g_return_if_fail (GDK_IS_IMAGE (image));
- private->ref_count--;
- if (private->ref_count == 0)
- private->klass->destroy (image);
+ g_object_unref (G_OBJECT (image));
}
-
-
diff --git a/gdk/gdkimage.h b/gdk/gdkimage.h
index 1dc8a880cd..ee0154e210 100644
--- a/gdk/gdkimage.h
+++ b/gdk/gdkimage.h
@@ -29,8 +29,19 @@ typedef enum
GDK_IMAGE_SHARED_PIXMAP
} GdkImageType;
+typedef struct _GdkImageClass GdkImageClass;
+
+#define GDK_TYPE_IMAGE (gdk_image_get_type ())
+#define GDK_IMAGE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_IMAGE, GdkImage))
+#define GDK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_IMAGE, GdkImageClass))
+#define GDK_IS_IMAGE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_IMAGE))
+#define GDK_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_IMAGE))
+#define GDK_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_IMAGE, GdkImageClass))
+
struct _GdkImage
{
+ GObject parent_instance;
+
GdkImageType type;
GdkVisual *visual; /* visual used to create the image */
GdkByteOrder byte_order;
@@ -40,9 +51,18 @@ struct _GdkImage
guint16 bpp; /* bytes per pixel */
guint16 bpl; /* bytes per line */
gpointer mem;
+
+ gpointer windowing_data;
+};
+
+struct _GdkImageClass
+{
+ GObjectClass parent_class;
};
-GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
+GType gdk_image_get_type (void);
+
+GdkImage* gdk_image_new_bitmap (GdkVisual *visual,
gpointer data,
gint width,
gint height);
@@ -74,7 +94,6 @@ guint32 gdk_image_get_pixel (GdkImage *image,
gint x,
gint y);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 925a36ab40..60daff5c5c 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -129,16 +129,6 @@ void gdk_im_close (void);
void gdk_ic_cleanup (void);
#endif /* USE_XIM */
-GdkWindow* _gdk_window_alloc (void);
-void _gdk_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
void _gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy);
void _gdk_window_clear_update_area (GdkWindow *window);
@@ -156,15 +146,6 @@ void _gdk_colormap_real_destroy (GdkColormap *colormap);
void _gdk_cursor_destroy (GdkCursor *cursor);
-/* Class supplied by windowing-system-dependent code for GdkWindow.
- */
-extern GdkDrawableClass _gdk_windowing_window_class;
-
-/* Class for covering over windowing-system-dependent and backing-store
- * code for GdkWindow
- */
-extern GdkDrawableClass _gdk_window_class;
-
extern GdkArgDesc _gdk_windowing_args[];
gboolean _gdk_windowing_init_check (int argc,
char **argv);
@@ -208,15 +189,19 @@ void _gdk_windowing_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy);
+/* Implementation types */
+GType _gdk_window_impl_get_type (void);
+GType _gdk_pixmap_impl_get_type (void);
+
/************************************
* Initialization and exit routines *
************************************/
-void gdk_window_init (void);
+void _gdk_windowing_window_init (void);
void gdk_visual_init (void);
void gdk_dnd_init (void);
-void gdk_image_init (void);
+void _gdk_windowing_image_init (void);
void gdk_image_exit (void);
void gdk_input_init (void);
diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c
index 521df43149..85c582a466 100644
--- a/gdk/gdkpango.c
+++ b/gdk/gdkpango.c
@@ -48,14 +48,17 @@ gdk_pango_context_destroy (GdkPangoContextInfo *info)
static GdkPangoContextInfo *
gdk_pango_context_get_info (PangoContext *context, gboolean create)
{
- GdkPangoContextInfo *info = pango_context_get_data (context, GDK_INFO_KEY);
+ GdkPangoContextInfo *info =
+ g_object_get_qdata (G_OBJECT (context),
+ g_quark_try_string (GDK_INFO_KEY));
if (!info && create)
{
info = g_new (GdkPangoContextInfo, 1);
info->colormap = NULL;
- pango_context_set_data (context, GDK_INFO_KEY,
- info, (GDestroyNotify)gdk_pango_context_destroy);
+ g_object_set_qdata_full (G_OBJECT (context),
+ g_quark_from_static_string (GDK_INFO_KEY),
+ info, (GDestroyNotify)gdk_pango_context_destroy);
}
return info;
@@ -156,9 +159,6 @@ gdk_draw_layout_line (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
g_return_if_fail (line != NULL);
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
-
context = pango_layout_get_context (line->layout);
pango_layout_line_get_extents (line,NULL, &overall_rect);
@@ -260,11 +260,6 @@ gdk_draw_layout (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
g_return_if_fail (layout != NULL);
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
-
- g_return_if_fail (layout != NULL);
-
indent = pango_layout_get_indent (layout);
width = pango_layout_get_width (layout);
align = pango_layout_get_alignment (layout);
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
new file mode 100644
index 0000000000..70c825f915
--- /dev/null
+++ b/gdk/gdkpixmap.c
@@ -0,0 +1,411 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "gdkpixmap.h"
+#include "gdkinternals.h"
+
+static GdkGC *gdk_pixmap_create_gc (GdkDrawable *drawable,
+ GdkGCValues *values,
+ GdkGCValuesMask mask);
+static void gdk_pixmap_draw_rectangle (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+static void gdk_pixmap_draw_arc (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint angle1,
+ gint angle2);
+static void gdk_pixmap_draw_polygon (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ GdkPoint *points,
+ gint npoints);
+static void gdk_pixmap_draw_text (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const gchar *text,
+ gint text_length);
+static void gdk_pixmap_draw_text_wc (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length);
+static void gdk_pixmap_draw_drawable (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPixmap *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+static void gdk_pixmap_draw_points (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
+static void gdk_pixmap_draw_segments (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkSegment *segs,
+ gint nsegs);
+static void gdk_pixmap_draw_lines (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
+static void gdk_pixmap_draw_glyphs (GdkDrawable *drawable,
+ GdkGC *gc,
+ PangoFont *font,
+ gint x,
+ gint y,
+ PangoGlyphString *glyphs);
+static void gdk_pixmap_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+
+static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+
+static GdkVisual* gdk_pixmap_real_get_visual (GdkDrawable *drawable);
+static gint gdk_pixmap_real_get_depth (GdkDrawable *drawable);
+static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap);
+static GdkColormap* gdk_pixmap_real_get_colormap (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,
+ "GdkPixmap",
+ &object_info);
+ }
+
+ return object_type;
+}
+
+static void
+gdk_pixmap_init (GdkPixmapObject *pixmap)
+{
+ /* 0-initialization is good for all other fields. */
+ pixmap->impl =
+ GDK_DRAWABLE (g_type_create_instance (_gdk_pixmap_impl_get_type ()));
+}
+
+static void
+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;
+ drawable_class->draw_rectangle = gdk_pixmap_draw_rectangle;
+ drawable_class->draw_arc = gdk_pixmap_draw_arc;
+ drawable_class->draw_polygon = gdk_pixmap_draw_polygon;
+ drawable_class->draw_text = gdk_pixmap_draw_text;
+ drawable_class->draw_text_wc = gdk_pixmap_draw_text_wc;
+ drawable_class->draw_drawable = gdk_pixmap_draw_drawable;
+ drawable_class->draw_points = gdk_pixmap_draw_points;
+ drawable_class->draw_segments = gdk_pixmap_draw_segments;
+ drawable_class->draw_lines = gdk_pixmap_draw_lines;
+ drawable_class->draw_glyphs = gdk_pixmap_draw_glyphs;
+ drawable_class->draw_image = gdk_pixmap_draw_image;
+ drawable_class->get_depth = gdk_pixmap_real_get_depth;
+ drawable_class->get_size = gdk_pixmap_real_get_size;
+ drawable_class->set_colormap = gdk_pixmap_real_set_colormap;
+ drawable_class->get_colormap = gdk_pixmap_real_get_colormap;
+ drawable_class->get_visual = gdk_pixmap_real_get_visual;
+}
+
+static void
+gdk_pixmap_finalize (GObject *object)
+{
+ GdkPixmapObject *obj = (GdkPixmapObject *) object;
+
+ g_object_unref (G_OBJECT (obj->impl));
+ obj->impl = NULL;
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static GdkGC *
+gdk_pixmap_create_gc (GdkDrawable *drawable,
+ GdkGCValues *values,
+ GdkGCValuesMask mask)
+{
+ return gdk_gc_new_with_values (((GdkPixmapObject *) drawable)->impl,
+ values, mask);
+}
+
+static void
+gdk_pixmap_draw_rectangle (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_rectangle (private->impl, gc, filled,
+ x, y, width, height);
+}
+
+static void
+gdk_pixmap_draw_arc (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint angle1,
+ gint angle2)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_arc (private->impl, gc, filled,
+ x, y,
+ width, height, angle1, angle2);
+}
+
+static void
+gdk_pixmap_draw_polygon (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ GdkPoint *points,
+ gint npoints)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_polygon (private->impl, gc, filled, points, npoints);
+}
+
+static void
+gdk_pixmap_draw_text (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const gchar *text,
+ gint text_length)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_text (private->impl, font, gc,
+ x, y, text, text_length);
+}
+
+static void
+gdk_pixmap_draw_text_wc (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_text_wc (private->impl, font, gc,
+ x, y, text, text_length);
+}
+
+static void
+gdk_pixmap_draw_drawable (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPixmap *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
+ xdest, ydest,
+ width, height);
+}
+
+static void
+gdk_pixmap_draw_points (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_points (private->impl, gc, points, npoints);
+}
+
+static void
+gdk_pixmap_draw_segments (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkSegment *segs,
+ gint nsegs)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_segments (private->impl, gc, segs, nsegs);
+}
+
+static void
+gdk_pixmap_draw_lines (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_lines (private->impl, gc, points, npoints);
+}
+
+static void
+gdk_pixmap_draw_glyphs (GdkDrawable *drawable,
+ GdkGC *gc,
+ PangoFont *font,
+ gint x,
+ gint y,
+ PangoGlyphString *glyphs)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_glyphs (private->impl, gc, font, x, y, glyphs);
+}
+
+static void
+gdk_pixmap_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
+{
+ GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+ gdk_draw_image (private->impl, gc, image, xsrc, ysrc, xdest, ydest,
+ width, height);
+}
+
+static void
+gdk_pixmap_real_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height)
+{
+ g_return_if_fail (GDK_IS_PIXMAP (drawable));
+
+ gdk_drawable_get_size (GDK_DRAWABLE (((GdkPixmapObject*)drawable)->impl),
+ width, height);
+}
+
+static GdkVisual*
+gdk_pixmap_real_get_visual (GdkDrawable *drawable)
+{
+ GdkColormap *colormap;
+
+ g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
+
+ colormap = gdk_drawable_get_colormap (drawable);
+ return colormap ? gdk_colormap_get_visual (colormap) : NULL;
+}
+
+static gint
+gdk_pixmap_real_get_depth (GdkDrawable *drawable)
+{
+ gint depth;
+
+ g_return_val_if_fail (GDK_IS_PIXMAP (drawable), 0);
+
+ depth = GDK_PIXMAP_OBJECT (drawable)->depth;
+
+ return depth;
+}
+
+static void
+gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap)
+{
+ g_return_if_fail (GDK_IS_PIXMAP (drawable));
+
+ gdk_drawable_set_colormap (((GdkPixmapObject*)drawable)->impl, cmap);
+}
+
+static GdkColormap*
+gdk_pixmap_real_get_colormap (GdkDrawable *drawable)
+{
+ g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
+
+ return gdk_drawable_get_colormap (((GdkPixmapObject*)drawable)->impl);
+}
diff --git a/gdk/gdkpixmap.h b/gdk/gdkpixmap.h
index f4807be10f..700d0007cf 100644
--- a/gdk/gdkpixmap.h
+++ b/gdk/gdkpixmap.h
@@ -2,11 +2,40 @@
#define __GDK_PIXMAP_H__
#include <gdk/gdktypes.h>
+#include <gdk/gdkdrawable.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
+typedef struct _GdkPixmapObject GdkPixmapObject;
+typedef struct _GdkPixmapObjectClass GdkPixmapObjectClass;
+
+#define GDK_TYPE_PIXMAP (gdk_pixmap_get_type ())
+#define GDK_PIXMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP, GdkPixmap))
+#define GDK_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP, GdkPixmapObjectClass))
+#define GDK_IS_PIXMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP))
+#define GDK_IS_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP))
+#define GDK_PIXMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP, GdkPixmapClass))
+#define GDK_PIXMAP_OBJECT(object) ((GdkPixmapObject *) GDK_PIXMAP (object))
+
+struct _GdkPixmapObject
+{
+ GdkDrawable parent_instance;
+
+ GdkDrawable *impl; /* window-system-specific delegate object */
+
+ gint depth;
+};
+
+struct _GdkPixmapObjectClass
+{
+ GdkDrawableClass parent_class;
+
+};
+
+GType gdk_pixmap_get_type (void);
+
/* Pixmaps
*/
GdkPixmap* gdk_pixmap_new (GdkWindow *window,
diff --git a/gdk/gdkprivate.h b/gdk/gdkprivate.h
index f882c35829..3df7bbbf6d 100644
--- a/gdk/gdkprivate.h
+++ b/gdk/gdkprivate.h
@@ -44,111 +44,24 @@ extern "C" {
#define GDK_PARENT_RELATIVE_BG ((GdkPixmap *)1L)
#define GDK_NO_BG ((GdkPixmap *)2L)
-#define GDK_DRAWABLE_TYPE(d) (((GdkDrawablePrivate *)d)->window_type)
-#define GDK_IS_WINDOW(d) (GDK_DRAWABLE_TYPE(d) <= GDK_WINDOW_TEMP || \
- GDK_DRAWABLE_TYPE(d) == GDK_WINDOW_FOREIGN)
-#define GDK_IS_PIXMAP(d) (GDK_DRAWABLE_TYPE(d) == GDK_DRAWABLE_PIXMAP)
-#define GDK_DRAWABLE_DESTROYED(d) (((GdkDrawablePrivate *)d)->destroyed)
-#define GDK_DRAWABLE_P(d) ((GdkDrawablePrivate*)d)
-#define GDK_WINDOW_P(d) ((GdkWindowPrivate*)d)
-#define GDK_GC_P(d) ((GdkGCPrivate*)d)
-
-typedef struct _GdkDrawablePrivate GdkDrawablePrivate;
-typedef struct _GdkWindowPrivate GdkWindowPrivate;
-typedef struct _GdkImageClass GdkImageClass;
-typedef struct _GdkImagePrivate GdkImagePrivate;
-typedef struct _GdkGCPrivate GdkGCPrivate;
-typedef struct _GdkColormapPrivate GdkColormapPrivate;
+#define GDK_WINDOW_TYPE(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->window_type)
+#define GDK_WINDOW_DESTROYED(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->destroyed)
+
+#define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
+#define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
+#define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid))
+
typedef struct _GdkColorInfo GdkColorInfo;
typedef struct _GdkFontPrivate GdkFontPrivate;
typedef struct _GdkEventFilter GdkEventFilter;
typedef struct _GdkClientFilter GdkClientFilter;
-struct _GdkDrawablePrivate
-{
- GdkDrawable drawable;
- GdkDrawableClass *klass;
- gpointer klass_data;
-
- guint ref_count;
-
- gint width;
- gint height;
-
- GdkColormap *colormap;
-
- guint8 window_type;
- guint8 depth;
-
- guint destroyed : 2;
-};
-
-struct _GdkWindowPrivate
-{
- GdkDrawablePrivate drawable;
-
- GdkWindow *parent;
- gint x;
- gint y;
- guint8 resize_count;
- guint mapped : 1;
- guint guffaw_gravity : 1;
- guint input_only : 1;
-
- gint extension_events;
-
- GList *filters;
- GList *children;
-
- GdkColor bg_color;
- GdkPixmap *bg_pixmap;
-
- GSList *paint_stack;
-
- GdkRegion *update_area;
- guint update_freeze_count;
-};
-
-struct _GdkImageClass
-{
- void (*destroy) (GdkImage *image);
- void (*image_put) (GdkImage *image,
- GdkDrawable *window,
- GdkGC *gc,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-};
-
-struct _GdkImagePrivate
-{
- GdkImage image;
-
- guint ref_count;
- GdkImageClass *klass;
-};
-
struct _GdkFontPrivate
{
GdkFont font;
guint ref_count;
};
-struct _GdkGCPrivate
-{
- guint ref_count;
- GdkGCClass *klass;
- gpointer klass_data;
-
- gint clip_x_origin;
- gint clip_y_origin;
- gint ts_x_origin;
- gint ts_y_origin;
-};
-
typedef enum {
GDK_COLOR_WRITEABLE = 1 << 0
} GdkColorInfoFlags;
@@ -159,14 +72,6 @@ struct _GdkColorInfo
guint ref_count;
};
-struct _GdkColormapPrivate
-{
- GdkColormap colormap;
- GdkVisual *visual;
-
- guint ref_count;
-};
-
struct _GdkEventFilter {
GdkFilterFunc function;
gpointer data;
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index a4055e2d70..91112510fb 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -31,6 +31,7 @@
*/
#include <glib.h>
#include <pango/pango.h>
+#include <glib-object.h>
#ifdef G_OS_WIN32
# ifdef GDK_COMPILATION
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ff25f7f70a..0f4ce13c8c 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -44,63 +44,61 @@ struct _GdkWindowPaint
gint x_offset;
gint y_offset;
};
-
-static void gdk_window_draw_destroy (GdkDrawable *drawable);
-static GdkGC *gdk_window_draw_create_gc (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask mask);
+static GdkGC *gdk_window_create_gc (GdkDrawable *drawable,
+ GdkGCValues *values,
+ GdkGCValuesMask mask);
static void gdk_window_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height);
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
static void gdk_window_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint angle1,
+ gint angle2);
static void gdk_window_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ gint filled,
+ GdkPoint *points,
+ gint npoints);
static void gdk_window_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const gchar *text,
+ gint text_length);
static void gdk_window_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length);
static void gdk_window_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
+ GdkGC *gc,
+ GdkPixmap *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
static void gdk_window_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
static void gdk_window_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
+ GdkGC *gc,
+ GdkSegment *segs,
+ gint nsegs);
static void gdk_window_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
@@ -112,74 +110,131 @@ static void gdk_window_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs);
+static void gdk_window_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+
+
+static void gdk_window_real_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+
+static GdkVisual* gdk_window_real_get_visual (GdkDrawable *drawable);
+static gint gdk_window_real_get_depth (GdkDrawable *drawable);
+static void gdk_window_real_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap);
+static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
+
static void gdk_window_free_paint_stack (GdkWindow *window);
-/* All drawing operations on windows are forwarded through the following
- * class to enable the automatic-backing-store feature.
- */
-GdkDrawableClass _gdk_window_class = {
- gdk_window_draw_destroy,
- gdk_window_draw_create_gc,
- gdk_window_draw_rectangle,
- gdk_window_draw_arc,
- gdk_window_draw_polygon,
- gdk_window_draw_text,
- gdk_window_draw_text_wc,
- gdk_window_draw_drawable,
- gdk_window_draw_points,
- gdk_window_draw_segments,
- gdk_window_draw_lines,
- gdk_window_draw_glyphs,
-};
+static void gdk_window_init (GdkWindowObject *window);
+static void gdk_window_class_init (GdkWindowObjectClass *klass);
+static void gdk_window_finalize (GObject *object);
-GdkWindow *
-_gdk_window_alloc (void)
+static gpointer parent_class = NULL;
+
+GType
+gdk_window_object_get_type (void)
{
- GdkWindowPrivate *private = g_new (GdkWindowPrivate, 1);
- GdkWindow *window = (GdkWindow*) private;
-
- window->user_data = NULL;
+ static GType object_type = 0;
- private->drawable.ref_count = 1;
- private->drawable.destroyed = FALSE;
- private->drawable.klass = NULL;
- private->drawable.klass_data = NULL;
- private->drawable.window_type = GDK_WINDOW_CHILD;
+ 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,
+ "GdkWindow",
+ &object_info);
+ }
+
+ return object_type;
+}
- private->drawable.width = 1;
- private->drawable.height = 1;
+static void
+gdk_window_init (GdkWindowObject *window)
+{
+ /* 0-initialization is good for all other fields. */
- private->drawable.colormap = NULL;
+ window->window_type = GDK_WINDOW_CHILD;
- private->parent = NULL;
- private->x = 0;
- private->y = 0;
- private->resize_count = 0;
+ window->impl =
+ GDK_DRAWABLE (g_type_create_instance (_gdk_window_impl_get_type ()));
+}
- private->mapped = FALSE;
- private->guffaw_gravity = FALSE;
- private->extension_events = FALSE;
+static void
+gdk_window_class_init (GdkWindowObjectClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
- private->filters = NULL;
- private->children = NULL;
-
- private->bg_color.pixel = 0;
- private->bg_color.red = 0;
- private->bg_color.green = 0;
- private->bg_color.blue = 0;
-
- private->bg_pixmap = NULL;
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gdk_window_finalize;
+
+ drawable_class->create_gc = gdk_window_create_gc;
+ drawable_class->draw_rectangle = gdk_window_draw_rectangle;
+ drawable_class->draw_arc = gdk_window_draw_arc;
+ drawable_class->draw_polygon = gdk_window_draw_polygon;
+ drawable_class->draw_text = gdk_window_draw_text;
+ drawable_class->draw_text_wc = gdk_window_draw_text_wc;
+ drawable_class->draw_drawable = gdk_window_draw_drawable;
+ drawable_class->draw_points = gdk_window_draw_points;
+ drawable_class->draw_segments = gdk_window_draw_segments;
+ drawable_class->draw_lines = gdk_window_draw_lines;
+ drawable_class->draw_glyphs = gdk_window_draw_glyphs;
+ drawable_class->draw_image = gdk_window_draw_image;
+ drawable_class->get_depth = gdk_window_real_get_depth;
+ drawable_class->get_size = gdk_window_real_get_size;
+ drawable_class->set_colormap = gdk_window_real_set_colormap;
+ drawable_class->get_colormap = gdk_window_real_get_colormap;
+ drawable_class->get_visual = gdk_window_real_get_visual;
+}
- private->paint_stack = NULL;
+static void
+gdk_window_finalize (GObject *object)
+{
+ GdkWindow *window = GDK_WINDOW (object);
+ GdkWindowObject *obj = (GdkWindowObject *) object;
+
+ if (!GDK_WINDOW_DESTROYED (window))
+ {
+ if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
+ {
+ g_warning ("losing last reference to undestroyed window\n");
+ _gdk_window_destroy (window, FALSE);
+ }
+ else
+ /* We use TRUE here, to keep us from actually calling
+ * XDestroyWindow() on the window
+ */
+ _gdk_window_destroy (window, TRUE);
+ }
- private->update_area = NULL;
- private->update_freeze_count = 0;
+ g_object_unref (G_OBJECT (obj->impl));
+ obj->impl = NULL;
- return window;
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
- * _gdk_window_destroy_heirarchy:
+ * _gdk_window_destroy_hierarchy:
* @window: a #GdkWindow
* @recursing: If TRUE, then this is being called because a parent
* was destroyed. This generally means that the call to the windowing system
@@ -195,37 +250,37 @@ _gdk_window_alloc (void)
* drop the reference count created by gdk_window_new().
**/
static void
-_gdk_window_destroy_heirarchy (GdkWindow *window,
+_gdk_window_destroy_hierarchy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
- GdkWindowPrivate *private;
- GdkWindowPrivate *temp_private;
+ GdkWindowObject *private;
+ GdkWindowObject *temp_private;
GdkWindow *temp_window;
GList *children;
GList *tmp;
g_return_if_fail (window != NULL);
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindowObject*) window;
- switch (private->drawable.window_type)
+ switch (GDK_WINDOW_TYPE (window))
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
case GDK_WINDOW_FOREIGN:
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
private->mapped = FALSE;
- private->drawable.destroyed = TRUE;
+ private->destroyed = TRUE;
_gdk_windowing_window_destroy (window, recursing, foreign_destroy);
if (private->parent)
{
- GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;
+ GdkWindowObject *parent_private = (GdkWindowObject *)private->parent;
if (parent_private->children)
parent_private->children = g_list_remove (parent_private->children, window);
}
@@ -239,7 +294,7 @@ _gdk_window_destroy_heirarchy (GdkWindow *window,
private->bg_pixmap = NULL;
}
- if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_FOREIGN)
+ if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
{
children = tmp = private->children;
private->children = NULL;
@@ -249,9 +304,9 @@ _gdk_window_destroy_heirarchy (GdkWindow *window,
temp_window = tmp->data;
tmp = tmp->next;
- temp_private = (GdkWindowPrivate*) temp_window;
+ temp_private = (GdkWindowObject*) temp_window;
if (temp_private)
- _gdk_window_destroy_heirarchy (temp_window, TRUE, foreign_destroy);
+ _gdk_window_destroy_hierarchy (temp_window, TRUE, foreign_destroy);
}
g_list_free (children);
@@ -270,22 +325,14 @@ _gdk_window_destroy_heirarchy (GdkWindow *window,
g_list_free (private->filters);
private->filters = NULL;
}
-
- if (private->drawable.colormap)
- {
- gdk_colormap_unref (private->drawable.colormap);
- private->drawable.colormap = NULL;
- }
+
+ gdk_drawable_set_colormap (GDK_DRAWABLE (window), NULL);
}
break;
case GDK_WINDOW_ROOT:
g_error ("attempted to destroy root window");
break;
-
- case GDK_WINDOW_PIXMAP:
- g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
- break;
}
}
@@ -304,13 +351,13 @@ void
_gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy)
{
- _gdk_window_destroy_heirarchy (window, FALSE, foreign_destroy);
+ _gdk_window_destroy_hierarchy (window, FALSE, foreign_destroy);
}
void
gdk_window_destroy (GdkWindow *window)
{
- _gdk_window_destroy_heirarchy (window, FALSE, FALSE);
+ _gdk_window_destroy_hierarchy (window, FALSE, FALSE);
gdk_drawable_unref (window);
}
@@ -320,7 +367,7 @@ gdk_window_set_user_data (GdkWindow *window,
{
g_return_if_fail (window != NULL);
- window->user_data = user_data;
+ ((GdkWindowObject*)window)->user_data = user_data;
}
void
@@ -329,7 +376,15 @@ gdk_window_get_user_data (GdkWindow *window,
{
g_return_if_fail (window != NULL);
- *data = window->user_data;
+ *data = ((GdkWindowObject*)window)->user_data;
+}
+
+GdkWindowType
+gdk_window_get_window_type (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), (GdkWindowType) -1);
+
+ return GDK_WINDOW_TYPE (window);
}
void
@@ -337,41 +392,60 @@ gdk_window_get_position (GdkWindow *window,
gint *x,
gint *y)
{
- GdkWindowPrivate *window_private;
+ GdkWindowObject *obj;
- g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- window_private = (GdkWindowPrivate*) window;
+ obj = (GdkWindowObject*) window;
if (x)
- *x = window_private->x;
+ *x = obj->x;
if (y)
- *y = window_private->y;
+ *y = obj->y;
}
GdkWindow*
gdk_window_get_parent (GdkWindow *window)
{
- g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
- return ((GdkWindowPrivate*) window)->parent;
+ return (GdkWindow*) ((GdkWindowObject*) window)->parent;
}
GdkWindow*
gdk_window_get_toplevel (GdkWindow *window)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *obj;
- g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
- private = (GdkWindowPrivate *)window;
- while (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
- private = (GdkWindowPrivate *)private->parent;
+ obj = (GdkWindowObject *)window;
+ while (GDK_WINDOW_TYPE (obj) == GDK_WINDOW_CHILD)
+ obj = (GdkWindowObject *)obj->parent;
- return (GdkWindow *)window;
+ return GDK_WINDOW (obj);
+}
+
+GList*
+gdk_window_get_children (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return NULL;
+
+ return g_list_copy (GDK_WINDOW_OBJECT (window)->children);
+}
+
+GList *
+gdk_window_peek_children (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return NULL;
+
+ return GDK_WINDOW_OBJECT (window)->children;
}
void
@@ -379,15 +453,15 @@ gdk_window_add_filter (GdkWindow *window,
GdkFilterFunc function,
gpointer data)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
GList *tmp_list;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowPrivate*) window;
- if (private && GDK_DRAWABLE_DESTROYED (window))
+ private = (GdkWindowObject*) window;
+ if (private && GDK_WINDOW_DESTROYED (window))
return;
if (private)
@@ -418,14 +492,14 @@ gdk_window_remove_filter (GdkWindow *window,
GdkFilterFunc function,
gpointer data)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
GList *tmp_list, *node;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindowObject*) window;
if (private)
tmp_list = private->filters;
@@ -458,7 +532,7 @@ gdk_window_get_toplevels (void)
GList *new_list = NULL;
GList *tmp_list;
- tmp_list = ((GdkWindowPrivate *)gdk_parent_root)->children;
+ tmp_list = ((GdkWindowObject *)gdk_parent_root)->children;
while (tmp_list)
{
new_list = g_list_prepend (new_list, tmp_list->data);
@@ -480,7 +554,7 @@ gdk_window_get_toplevels (void)
gboolean
gdk_window_is_visible (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
@@ -503,19 +577,19 @@ gdk_window_is_visible (GdkWindow *window)
gboolean
gdk_window_is_viewable (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
while (private &&
- (private != (GdkWindowPrivate *)gdk_parent_root) &&
- (private->drawable.window_type != GDK_WINDOW_FOREIGN))
+ (private != (GdkWindowObject *)gdk_parent_root) &&
+ (GDK_WINDOW_TYPE (private) != GDK_WINDOW_FOREIGN))
{
if (!private->mapped)
return FALSE;
- private = (GdkWindowPrivate *)private->parent;
+ private = (GdkWindowObject *)private->parent;
}
return TRUE;
@@ -538,7 +612,7 @@ gdk_window_begin_paint_rect (GdkWindow *window,
static GdkGC *
gdk_window_get_bg_gc (GdkWindow *window, GdkWindowPaint *paint)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
guint gc_mask = 0;
GdkGCValues gc_values;
@@ -549,7 +623,7 @@ gdk_window_get_bg_gc (GdkWindow *window, GdkWindowPaint *paint)
tmp_paint.x_offset += private->x;
tmp_paint.y_offset += private->y;
- return gdk_window_get_bg_gc (private->parent, &tmp_paint);
+ return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
}
else if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG && private->bg_pixmap != GDK_NO_BG)
{
@@ -586,7 +660,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
GdkRegion *region)
{
#ifdef USE_BACKING_STORE
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkRectangle clip_box;
GdkWindowPaint *paint;
GdkRegion *init_region;
@@ -595,7 +669,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
paint = g_new (GdkWindowPaint, 1);
@@ -681,7 +755,7 @@ void
gdk_window_end_paint (GdkWindow *window)
{
#ifdef USE_BACKING_STORE
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowPaint *paint;
GdkGC *tmp_gc;
GdkRectangle clip_box;
@@ -690,7 +764,7 @@ gdk_window_end_paint (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
g_return_if_fail (private->paint_stack != NULL);
@@ -707,11 +781,11 @@ gdk_window_end_paint (GdkWindow *window)
gdk_gc_set_clip_region (tmp_gc, paint->region);
gdk_gc_set_clip_origin (tmp_gc, -x_offset, -y_offset);
- _gdk_windowing_window_class.draw_drawable (window, tmp_gc, paint->pixmap,
- clip_box.x - paint->x_offset,
- clip_box.y - paint->y_offset,
- clip_box.x - x_offset, clip_box.y - y_offset,
- clip_box.width, clip_box.height);
+ gdk_draw_drawable (private->impl, tmp_gc, paint->pixmap,
+ clip_box.x - paint->x_offset,
+ clip_box.y - paint->y_offset,
+ clip_box.x - x_offset, clip_box.y - y_offset,
+ clip_box.width, clip_box.height);
gdk_gc_unref (tmp_gc);
if (private->paint_stack)
@@ -736,7 +810,7 @@ gdk_window_end_paint (GdkWindow *window)
static void
gdk_window_free_paint_stack (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
if (private->paint_stack)
{
@@ -765,7 +839,7 @@ gdk_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
if (private->paint_stack)
{
@@ -779,10 +853,10 @@ gdk_window_get_offsets (GdkWindow *window,
#define OFFSET_GC(gc) \
gint x_offset, y_offset; \
- gint old_clip_x = ((GdkGCPrivate *)gc)->clip_x_origin; \
- gint old_clip_y = ((GdkGCPrivate *)gc)->clip_y_origin; \
- gint old_ts_x = ((GdkGCPrivate *)gc)->ts_x_origin; \
- gint old_ts_y = ((GdkGCPrivate *)gc)->ts_y_origin; \
+ gint old_clip_x = gc->clip_x_origin; \
+ gint old_clip_y = gc->clip_y_origin; \
+ gint old_ts_x = gc->ts_x_origin; \
+ gint old_ts_y = gc->ts_y_origin; \
gdk_window_get_offsets (drawable, &x_offset, &y_offset); \
if (x_offset != 0 || y_offset != 0) \
{ \
@@ -799,18 +873,18 @@ gdk_window_get_offsets (GdkWindow *window,
gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y); \
}
-static void
-gdk_window_draw_destroy (GdkDrawable *drawable)
-{
- _gdk_windowing_window_class.destroy (drawable);
-}
-
static GdkGC *
-gdk_window_draw_create_gc (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask mask)
+gdk_window_create_gc (GdkDrawable *drawable,
+ GdkGCValues *values,
+ GdkGCValuesMask mask)
{
- return _gdk_windowing_window_class.create_gc (drawable, values, mask);
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return NULL;
+
+ return gdk_gc_new_with_values (((GdkWindowObject *) drawable)->impl,
+ values, mask);
}
static void
@@ -822,8 +896,11 @@ gdk_window_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
if (private->paint_stack)
{
@@ -832,8 +909,8 @@ gdk_window_draw_rectangle (GdkDrawable *drawable,
x - x_offset, y - y_offset, width, height);
}
else
- _gdk_windowing_window_class.draw_rectangle (drawable, gc, filled,
- x - x_offset, y - y_offset, width, height);
+ gdk_draw_rectangle (private->impl, gc, filled,
+ x - x_offset, y - y_offset, width, height);
RESTORE_GC (gc);
}
@@ -849,9 +926,12 @@ gdk_window_draw_arc (GdkDrawable *drawable,
gint angle1,
gint angle2)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -860,9 +940,9 @@ gdk_window_draw_arc (GdkDrawable *drawable,
width, height, angle1, angle2);
}
else
- _gdk_windowing_window_class.draw_arc (drawable, gc, filled,
- x - x_offset, y - y_offset,
- width, height, angle1, angle2);
+ gdk_draw_arc (private->impl, gc, filled,
+ x - x_offset, y - y_offset,
+ width, height, angle1, angle2);
RESTORE_GC (gc);
}
@@ -873,11 +953,14 @@ gdk_window_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
int i;
@@ -899,8 +982,8 @@ gdk_window_draw_polygon (GdkDrawable *drawable,
}
else
- _gdk_windowing_window_class.draw_polygon (drawable, gc, filled, new_points, npoints);
-
+ gdk_draw_polygon (private->impl, gc, filled, new_points, npoints);
+
if (new_points != points)
g_free (new_points);
@@ -916,9 +999,12 @@ gdk_window_draw_text (GdkDrawable *drawable,
const gchar *text,
gint text_length)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -927,8 +1013,8 @@ gdk_window_draw_text (GdkDrawable *drawable,
}
else
- _gdk_windowing_window_class.draw_text (drawable, font, gc,
- x - x_offset, y - y_offset, text, text_length);
+ gdk_draw_text (private->impl, font, gc,
+ x - x_offset, y - y_offset, text, text_length);
RESTORE_GC (gc);
}
@@ -942,9 +1028,12 @@ gdk_window_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text,
gint text_length)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -952,9 +1041,9 @@ gdk_window_draw_text_wc (GdkDrawable *drawable,
x - x_offset, y - y_offset, text, text_length);
}
else
- _gdk_windowing_window_class.draw_text_wc (drawable, font, gc,
- x - x_offset, y - y_offset, text, text_length);
-
+ gdk_draw_text_wc (private->impl, font, gc,
+ x - x_offset, y - y_offset, text, text_length);
+
RESTORE_GC (gc);
}
@@ -969,9 +1058,12 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -980,9 +1072,9 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
}
else
- _gdk_windowing_window_class.draw_drawable (drawable, gc, src, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
+ gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
+ xdest - x_offset, ydest - y_offset,
+ width, height);
RESTORE_GC (gc);
}
@@ -992,11 +1084,14 @@ gdk_window_draw_points (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
@@ -1017,7 +1112,7 @@ gdk_window_draw_points (GdkDrawable *drawable,
gdk_draw_points (paint->pixmap, gc, new_points, npoints);
}
else
- _gdk_windowing_window_class.draw_points (drawable, gc, points, npoints);
+ gdk_draw_points (private->impl, gc, points, npoints);
if (new_points != points)
g_free (new_points);
@@ -1031,11 +1126,14 @@ gdk_window_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkSegment *new_segs;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
@@ -1058,8 +1156,8 @@ gdk_window_draw_segments (GdkDrawable *drawable,
gdk_draw_segments (paint->pixmap, gc, new_segs, nsegs);
}
else
- _gdk_windowing_window_class.draw_segments (drawable, gc, new_segs, nsegs);
-
+ gdk_draw_segments (private->impl, gc, new_segs, nsegs);
+
if (new_segs != segs)
g_free (new_segs);
@@ -1072,11 +1170,14 @@ gdk_window_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
@@ -1097,7 +1198,7 @@ gdk_window_draw_lines (GdkDrawable *drawable,
gdk_draw_lines (paint->pixmap, gc, new_points, npoints);
}
else
- _gdk_windowing_window_class.draw_lines (drawable, gc, new_points, npoints);
+ gdk_draw_lines (private->impl, gc, new_points, npoints);
if (new_points != points)
g_free (new_points);
@@ -1113,10 +1214,13 @@ gdk_window_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -1124,8 +1228,8 @@ gdk_window_draw_glyphs (GdkDrawable *drawable,
gdk_draw_glyphs (paint->pixmap, gc, font, x - x_offset, y - y_offset, glyphs);
}
else
- _gdk_windowing_window_class.draw_glyphs (drawable, gc, font,
- x - x_offset, y - y_offset, glyphs);
+ gdk_draw_glyphs (private->impl, gc, font,
+ x - x_offset, y - y_offset, glyphs);
RESTORE_GC (gc);
}
@@ -1138,10 +1242,13 @@ gdk_window_clear_backing_rect (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowPaint *paint = private->paint_stack->data;
GdkGC *tmp_gc;
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
tmp_gc = gdk_window_get_bg_gc (window, paint);
gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE,
x - paint->x_offset, y - paint->y_offset, width, height);
@@ -1151,13 +1258,15 @@ gdk_window_clear_backing_rect (GdkWindow *window,
void
gdk_window_clear (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+ gint width, height;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
+ gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+
gdk_window_clear_area (window, 0, 0,
- private->drawable.width, private->drawable.height);
+ width, height);
}
void
@@ -1167,7 +1276,7 @@ gdk_window_clear_area (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1185,7 +1294,7 @@ gdk_window_clear_area_e (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1196,38 +1305,104 @@ gdk_window_clear_area_e (GdkWindow *window,
_gdk_windowing_window_clear_area_e (window, x, y, width, height);
}
-void
-_gdk_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
+static void
+gdk_window_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
{
- GdkImagePrivate *image_private = (GdkImagePrivate*) image;
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
- image_private->klass->image_put (image, paint->pixmap, gc, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
+ gdk_draw_image (paint->pixmap, gc, image, xsrc, ysrc,
+ xdest - x_offset, ydest - y_offset,
+ width, height);
}
else
- image_private->klass->image_put (image, drawable, gc, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
+ gdk_draw_image (private->impl, gc, image, xsrc, ysrc,
+ xdest - x_offset, ydest - y_offset,
+ width, height);
RESTORE_GC (gc);
}
+
+static void
+gdk_window_real_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height)
+{
+ g_return_if_fail (GDK_IS_WINDOW (drawable));
+
+ gdk_drawable_get_size (GDK_WINDOW_OBJECT (drawable)->impl,
+ width, height);
+}
+
+static GdkVisual*
+gdk_window_real_get_visual (GdkDrawable *drawable)
+{
+ GdkColormap *colormap;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+ colormap = gdk_drawable_get_colormap (drawable);
+ return colormap ? gdk_colormap_get_visual (colormap) : NULL;
+}
+
+static gint
+gdk_window_real_get_depth (GdkDrawable *drawable)
+{
+ gint depth;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), 0);
+
+ depth = ((GdkWindowObject *)GDK_WINDOW (drawable))->depth;
+
+ if (depth == 0)
+ {
+ g_print ("0 depth for type %s\n", g_type_name (G_OBJECT_TYPE (drawable)));
+ G_BREAKPOINT ();
+ }
+
+ return depth;
+}
+
+static void
+gdk_window_real_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap)
+{
+ g_return_if_fail (GDK_IS_WINDOW (drawable));
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
+ gdk_drawable_set_colormap (((GdkWindowObject*)drawable)->impl, cmap);
+}
+
+static GdkColormap*
+gdk_window_real_get_colormap (GdkDrawable *drawable)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return NULL;
+
+ return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl);
+}
+
/* Code for dirty-region queueing
*/
@@ -1237,7 +1412,7 @@ static guint update_idle = 0;
static void
gdk_window_process_updates_internal (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
gboolean save_region = FALSE;
/* If an update got queued during update processing, we can get a
@@ -1253,11 +1428,14 @@ gdk_window_process_updates_internal (GdkWindow *window)
{
GdkEvent event;
GdkRectangle window_rect;
-
+ gint width, height;
+
+ gdk_drawable_get_size (GDK_DRAWABLE (private), &width, &height);
+
window_rect.x = 0;
window_rect.y = 0;
- window_rect.width = private->drawable.width;
- window_rect.height = private->drawable.height;
+ window_rect.width = width;
+ window_rect.height = height;
save_region = _gdk_windowing_window_queue_antiexpose (window, update_area);
@@ -1314,7 +1492,7 @@ void
gdk_window_process_updates (GdkWindow *window,
gboolean update_children)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1342,20 +1520,21 @@ gdk_window_invalidate_rect (GdkWindow *window,
gboolean invalidate_children)
{
GdkRectangle window_rect;
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
if (!rect)
{
window_rect.x = 0;
window_rect.y = 0;
- window_rect.width = private->drawable.width;
- window_rect.height = private->drawable.height;
+ gdk_drawable_get_size (GDK_DRAWABLE (window),
+ &window_rect.width,
+ &window_rect.height);
rect = &window_rect;
}
@@ -1382,18 +1561,20 @@ gdk_window_invalidate_rect (GdkWindow *window,
tmp_list = private->children;
while (tmp_list)
{
- GdkWindowPrivate *child = tmp_list->data;
+ GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
- /* FIXME: this is a HACK to figure out if the child is
- * input-only.
- */
- if (child->drawable.colormap)
+ if (!child->input_only)
{
+ gint width, height;
+
+ gdk_drawable_get_size (GDK_DRAWABLE (child),
+ &width, &height);
+
child_rect.x = child->x;
child_rect.y = child->y;
- child_rect.width = child->drawable.width;
- child_rect.height = child->drawable.height;
+ child_rect.width = width;
+ child_rect.height = height;
if (gdk_rectangle_intersect (rect, &child_rect, &new_rect))
{
@@ -1412,12 +1593,12 @@ gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *region,
gboolean invalidate_children)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
if (private->input_only)
@@ -1446,15 +1627,20 @@ gdk_window_invalidate_region (GdkWindow *window,
tmp_list = private->children;
while (tmp_list)
{
- GdkWindowPrivate *child = tmp_list->data;
+ GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (child->input_only)
{
+ gint width, height;
+
+ gdk_drawable_get_size (GDK_DRAWABLE (child),
+ &width, &height);
+
child_rect.x = child->x;
child_rect.y = child->y;
- child_rect.width = child->drawable.width;
- child_rect.height = child->drawable.height;
+ child_rect.width = width;
+ child_rect.height = height;
child_region = gdk_region_rectangle (&child_rect);
gdk_region_intersect (child_region, region);
@@ -1474,7 +1660,7 @@ gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *
gdk_window_get_update_area (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkRegion *tmp_region;
g_return_val_if_fail (window != NULL, NULL);
@@ -1503,7 +1689,7 @@ gdk_window_get_update_area (GdkWindow *window)
void
_gdk_window_clear_update_area (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1520,7 +1706,7 @@ _gdk_window_clear_update_area (GdkWindow *window)
void
gdk_window_freeze_updates (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1531,7 +1717,7 @@ gdk_window_freeze_updates (GdkWindow *window)
void
gdk_window_thaw_updates (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 3738c0851f..ccce0dbb70 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -28,6 +28,28 @@ typedef enum
GDK_INPUT_ONLY
} GdkWindowClass;
+/* Types of windows.
+ * Root: There is only 1 root window and it is initialized
+ * at startup. Creating a window of type GDK_WINDOW_ROOT
+ * is an error.
+ * Toplevel: Windows which interact with the window manager.
+ * Child: Windows which are children of some other type of window.
+ * (Any other type of window). Most windows are child windows.
+ * Dialog: A special kind of toplevel window which interacts with
+ * the window manager slightly differently than a regular
+ * toplevel window. Dialog windows should be used for any
+ * transient window.
+ * Foreign: A window that actually belongs to another application
+ */
+typedef enum
+{
+ GDK_WINDOW_ROOT,
+ GDK_WINDOW_TOPLEVEL,
+ GDK_WINDOW_CHILD,
+ GDK_WINDOW_DIALOG,
+ GDK_WINDOW_TEMP,
+ GDK_WINDOW_FOREIGN
+} GdkWindowType;
/* Window attribute mask values.
* GDK_WA_TITLE: The "title" field is valid.
@@ -97,7 +119,7 @@ struct _GdkWindowAttr
GdkWindowClass wclass;
GdkVisual *visual;
GdkColormap *colormap;
- GdkDrawableType window_type;
+ GdkWindowType window_type;
GdkCursor *cursor;
gchar *wmclass_name;
gchar *wmclass_class;
@@ -118,61 +140,114 @@ struct _GdkGeometry {
/* GdkGravity gravity; */
};
+typedef struct _GdkWindowObject GdkWindowObject;
+typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
+
+#define GDK_TYPE_WINDOW (gdk_window_object_get_type ())
+#define GDK_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW, GdkWindow))
+#define GDK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowObjectClass))
+#define GDK_IS_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW))
+#define GDK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW))
+#define GDK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowObjectClass))
+#define GDK_WINDOW_OBJECT(object) ((GdkWindowObject *) GDK_WINDOW (object))
+
+struct _GdkWindowObject
+{
+ GdkDrawable parent_instance;
+
+ gpointer user_data;
+
+ GdkDrawable *impl; /* window-system-specific delegate object */
+
+ GdkWindowObject *parent;
+
+ gint x;
+ gint y;
+
+ gint extension_events;
+
+ GList *filters;
+ GList *children;
+
+ GdkColor bg_color;
+ GdkPixmap *bg_pixmap;
+
+ GSList *paint_stack;
+
+ GdkRegion *update_area;
+ guint update_freeze_count;
+
+ guint8 window_type;
+ guint8 depth;
+ guint8 resize_count;
+ guint mapped : 1;
+ guint guffaw_gravity : 1;
+ guint input_only : 1;
+
+ guint destroyed : 2;
+};
+
+struct _GdkWindowObjectClass
+{
+ GdkDrawableClass parent_class;
+
+
+};
+
/* Windows
*/
-GdkWindow* gdk_window_new (GdkWindow *parent,
- GdkWindowAttr *attributes,
- gint attributes_mask);
-void gdk_window_destroy (GdkWindow *window);
-
-GdkWindow* gdk_window_at_pointer (gint *win_x,
- gint *win_y);
-void gdk_window_show (GdkWindow *window);
-void gdk_window_hide (GdkWindow *window);
-void gdk_window_withdraw (GdkWindow *window);
-void gdk_window_move (GdkWindow *window,
- gint x,
- gint y);
-void gdk_window_resize (GdkWindow *window,
- gint width,
- gint height);
-void gdk_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_window_scroll (GdkWindow *window,
- gint dx,
- gint dy);
-void gdk_window_reparent (GdkWindow *window,
- GdkWindow *new_parent,
- gint x,
- gint y);
-void gdk_window_clear (GdkWindow *window);
-void gdk_window_clear_area (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_window_clear_area_e (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_window_raise (GdkWindow *window);
-void gdk_window_lower (GdkWindow *window);
-
-void gdk_window_set_user_data (GdkWindow *window,
- gpointer user_data);
-void gdk_window_set_override_redirect (GdkWindow *window,
- gboolean override_redirect);
-
-void gdk_window_add_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data);
-void gdk_window_remove_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data);
+GType gdk_window_object_get_type (void);
+GdkWindow* gdk_window_new (GdkWindow *parent,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
+void gdk_window_destroy (GdkWindow *window);
+GdkWindowType gdk_window_get_window_type (GdkWindow *window);
+GdkWindow* gdk_window_at_pointer (gint *win_x,
+ gint *win_y);
+void gdk_window_show (GdkWindow *window);
+void gdk_window_hide (GdkWindow *window);
+void gdk_window_withdraw (GdkWindow *window);
+void gdk_window_move (GdkWindow *window,
+ gint x,
+ gint y);
+void gdk_window_resize (GdkWindow *window,
+ gint width,
+ gint height);
+void gdk_window_move_resize (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gdk_window_reparent (GdkWindow *window,
+ GdkWindow *new_parent,
+ gint x,
+ gint y);
+void gdk_window_clear (GdkWindow *window);
+void gdk_window_clear_area (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gdk_window_clear_area_e (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gdk_window_raise (GdkWindow *window);
+void gdk_window_lower (GdkWindow *window);
+void gdk_window_set_user_data (GdkWindow *window,
+ gpointer user_data);
+void gdk_window_set_override_redirect (GdkWindow *window,
+ gboolean override_redirect);
+void gdk_window_add_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data);
+void gdk_window_remove_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data);
+void gdk_window_scroll (GdkWindow *window,
+ gint dx,
+ gint dy);
/*
* This allows for making shaped (partially transparent) windows
@@ -279,6 +354,7 @@ GdkWindow * gdk_window_get_parent (GdkWindow *window);
GdkWindow * gdk_window_get_toplevel (GdkWindow *window);
GList * gdk_window_get_children (GdkWindow *window);
+GList * gdk_window_peek_children (GdkWindow *window);
GdkEventMask gdk_window_get_events (GdkWindow *window);
void gdk_window_set_events (GdkWindow *window,
GdkEventMask event_mask);
diff --git a/gdk/linux-fb/Makefile.am b/gdk/linux-fb/Makefile.am
index 21462c1628..c2eb72de27 100644
--- a/gdk/linux-fb/Makefile.am
+++ b/gdk/linux-fb/Makefile.am
@@ -19,6 +19,8 @@ LDFLAGS = @STRIP_BEGIN@ \
-lm \
@STRIP_END@
+if USE_LINUX_FB
+
noinst_LTLIBRARIES = libgdk-linux-fb.la
noinst_PROGRAMS=#test-fb
@@ -59,3 +61,7 @@ libgdk_linux_fb_la_SOURCES = \
mispans.c \
gdkpango-fb.c
mispans.c
+
+else
+noinst_LTLIBRARIES =
+endif
diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
index 1e8e1ad103..5cca5f4224 100644
--- a/gdk/x11/Makefile.am
+++ b/gdk/x11/Makefile.am
@@ -83,7 +83,7 @@ gxid_LDADD = $(LDADDS)
endif
install-data-local:
- ../../$(MKINSTALLDIRS) $(includedir)/gdk
+ $(MKINSTALLDIRS) $(includedir)/gdk
$(INSTALL_DATA) $(srcdir)/gdkx.h $(includedir)/gdk
- ../../$(MKINSTALLDIRS) $(includedir)/gdk/x11
+ $(MKINSTALLDIRS) $(includedir)/gdk/x11
$(INSTALL_DATA) $(srcdir)/gdkprivate-x11.h $(includedir)/gdk/x11
diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c
index 156933cec4..d32f85451e 100644
--- a/gdk/x11/gdkcolor-x11.c
+++ b/gdk/x11/gdkcolor-x11.c
@@ -29,6 +29,8 @@
#include "gdkcolor.h"
#include "gdkprivate-x11.h"
+#define GDK_COLORMAP_PRIVATE_DATA(cmap) ((GdkColormapPrivateX11 *) GDK_COLORMAP (cmap)->windowing_data)
+
static gint gdk_colormap_match_color (GdkColormap *cmap,
GdkColor *color,
const gchar *available);
@@ -38,36 +40,113 @@ static guint gdk_colormap_hash (Colormap *cmap);
static gint gdk_colormap_cmp (Colormap *a,
Colormap *b);
+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;
+
static GHashTable *colormap_hash = 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,
+ "GdkColormap",
+ &object_info);
+ }
+
+ return object_type;
+}
+
+static void
+gdk_colormap_init (GdkColormap *colormap)
+{
+ GdkColormapPrivateX11 *private;
+
+ private = g_new (GdkColormapPrivateX11, 1);
+
+ colormap->windowing_data = private;
+
+ private->xdisplay = gdk_display;
+ private->hash = NULL;
+ private->last_sync_time = 0;
+ private->info = NULL;
+
+ colormap->size = 0;
+ colormap->colors = NULL;
+}
+
+static void
+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;
+}
+
+static void
+gdk_colormap_finalize (GObject *object)
+{
+ GdkColormap *colormap = GDK_COLORMAP (object);
+ GdkColormapPrivateX11 *private = GDK_COLORMAP_PRIVATE_DATA (colormap);
+
+ gdk_colormap_remove (colormap);
+
+ XFreeColormap (private->xdisplay, private->xcolormap);
+
+ if (private->hash)
+ g_hash_table_destroy (private->hash);
+
+ g_free (private->info);
+ g_free (colormap->colors);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
GdkColormap*
gdk_colormap_new (GdkVisual *visual,
gboolean private_cmap)
{
GdkColormap *colormap;
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
Visual *xvisual;
int size;
int i;
+ /* FIXME when object properties settle down, there needs to be some
+ * kind of default construction (and construct-only arguments)
+ */
+
g_return_val_if_fail (visual != NULL, NULL);
- private = g_new (GdkColormapPrivateX, 1);
- colormap = (GdkColormap*) private;
+ colormap = GDK_COLORMAP (g_type_create_instance (gdk_colormap_get_type ()));
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
- private->xdisplay = gdk_display;
- private->base.visual = visual;
- private->base.ref_count = 1;
-
- private->hash = NULL;
- private->last_sync_time = 0;
- private->info = NULL;
+ colormap->visual = visual;
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
colormap->size = visual->colormap_size;
- colormap->colors = NULL;
switch (visual->type)
{
@@ -145,22 +224,6 @@ gdk_colormap_new (GdkVisual *visual,
return colormap;
}
-void
-_gdk_colormap_real_destroy (GdkColormap *colormap)
-{
- GdkColormapPrivateX *private = (GdkColormapPrivateX*) colormap;
-
- gdk_colormap_remove (colormap);
- XFreeColormap (private->xdisplay, private->xcolormap);
-
- if (private->hash)
- g_hash_table_destroy (private->hash);
-
- g_free (private->info);
- g_free (colormap->colors);
- g_free (colormap);
-}
-
#define MIN_SYNC_TIME 2
void
@@ -168,12 +231,12 @@ gdk_colormap_sync (GdkColormap *colormap,
gboolean force)
{
time_t current_time;
- GdkColormapPrivateX *private = (GdkColormapPrivateX *)colormap;
+ GdkColormapPrivateX11 *private = GDK_COLORMAP_PRIVATE_DATA (colormap);
XColor *xpalette;
gint nlookup;
gint i;
- g_return_if_fail (colormap != NULL);
+ g_return_if_fail (GDK_IS_COLORMAP (colormap));
current_time = time (NULL);
if (!force && ((current_time - private->last_sync_time) < MIN_SYNC_TIME))
@@ -215,35 +278,34 @@ GdkColormap*
gdk_colormap_get_system (void)
{
static GdkColormap *colormap = NULL;
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
if (!colormap)
{
- private = g_new (GdkColormapPrivateX, 1);
- colormap = (GdkColormap*) private;
+ colormap = GDK_COLORMAP (g_type_create_instance (gdk_colormap_get_type ()));
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
private->xdisplay = gdk_display;
private->xcolormap = DefaultColormap (gdk_display, gdk_screen);
- private->base.visual = gdk_visual_get_system ();
+ colormap->visual = gdk_visual_get_system ();
private->private_val = FALSE;
- private->base.ref_count = 1;
private->hash = NULL;
private->last_sync_time = 0;
private->info = NULL;
colormap->colors = NULL;
- colormap->size = private->base.visual->colormap_size;
+ colormap->size = colormap->visual->colormap_size;
- if ((private->base.visual->type == GDK_VISUAL_GRAYSCALE) ||
- (private->base.visual->type == GDK_VISUAL_PSEUDO_COLOR))
+ if ((colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
+ (colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
{
private->info = g_new0 (GdkColorInfo, colormap->size);
colormap->colors = g_new (GdkColor, colormap->size);
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
(GCompareFunc) gdk_color_equal);
-
+
gdk_colormap_sync (colormap, TRUE);
}
@@ -263,7 +325,7 @@ void
gdk_colormap_change (GdkColormap *colormap,
gint ncolors)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
GdkVisual *visual;
XColor *palette;
gint shift;
@@ -271,12 +333,12 @@ gdk_colormap_change (GdkColormap *colormap,
int size;
int i;
- g_return_if_fail (colormap != NULL);
+ g_return_if_fail (GDK_IS_COLORMAP (colormap));
palette = g_new (XColor, ncolors);
- private = (GdkColormapPrivateX*) colormap;
- switch (private->base.visual->type)
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
+ switch (colormap->visual->type)
{
case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_PSEUDO_COLOR:
@@ -293,7 +355,7 @@ gdk_colormap_change (GdkColormap *colormap,
break;
case GDK_VISUAL_DIRECT_COLOR:
- visual = private->base.visual;
+ visual = colormap->visual;
shift = visual->red_shift;
max_colors = 1 << visual->red_prec;
@@ -350,13 +412,13 @@ gdk_colors_alloc (GdkColormap *colormap,
gulong *pixels,
gint npixels)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
gint return_val;
gint i;
- g_return_val_if_fail (colormap != NULL, 0);
+ g_return_val_if_fail (GDK_IS_COLORMAP (colormap), 0);
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
return_val = XAllocColorCells (private->xdisplay, private->xcolormap,
contiguous, planes, nplanes, pixels, npixels);
@@ -408,18 +470,18 @@ gdk_colors_free (GdkColormap *colormap,
gint in_npixels,
gulong planes)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
gulong *pixels;
gint npixels = 0;
gint i;
- g_return_if_fail (colormap != NULL);
+ g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (in_pixels != NULL);
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
- if ((private->base.visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
- (private->base.visual->type != GDK_VISUAL_GRAYSCALE))
+ if ((colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
+ (colormap->visual->type != GDK_VISUAL_GRAYSCALE))
return;
pixels = g_new (gulong, in_npixels);
@@ -456,18 +518,18 @@ gdk_colormap_free_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
gulong *pixels;
gint npixels = 0;
gint i;
- g_return_if_fail (colormap != NULL);
+ g_return_if_fail (GDK_IS_COLORMAP (colormap));
g_return_if_fail (colors != NULL);
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
- if ((private->base.visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
- (private->base.visual->type != GDK_VISUAL_GRAYSCALE))
+ if ((colormap->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
+ (colormap->visual->type != GDK_VISUAL_GRAYSCALE))
return;
pixels = g_new (gulong, ncolors);
@@ -509,10 +571,10 @@ gdk_colormap_alloc1 (GdkColormap *colormap,
GdkColor *color,
GdkColor *ret)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
XColor xcolor;
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
xcolor.red = color->red;
xcolor.green = color->green;
@@ -561,12 +623,12 @@ gdk_colormap_alloc_colors_writeable (GdkColormap *colormap,
gboolean best_match,
gboolean *success)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
gulong *pixels;
Status status;
gint i, index;
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
if (private->private_val)
{
@@ -619,13 +681,13 @@ gdk_colormap_alloc_colors_private (GdkColormap *colormap,
gboolean best_match,
gboolean *success)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
gint i, index;
XColor *store = g_new (XColor, ncolors);
gint nstore = 0;
gint nremaining = 0;
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
index = -1;
/* First, store the colors we have room for */
@@ -698,12 +760,12 @@ gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
gboolean best_match,
gboolean *success)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
gint i, index;
gint nremaining = 0;
gint nfailed = 0;
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
index = -1;
for (i=0; i<ncolors; i++)
@@ -790,12 +852,12 @@ gdk_colormap_alloc_colors_pseudocolor (GdkColormap *colormap,
gboolean best_match,
gboolean *success)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
GdkColor *lookup_color;
gint i;
gint nremaining = 0;
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
/* Check for an exact match among previously allocated colors */
@@ -837,23 +899,23 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
gboolean best_match,
gboolean *success)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
GdkVisual *visual;
gint i;
gint nremaining = 0;
XColor xcolor;
- g_return_val_if_fail (colormap != NULL, FALSE);
+ g_return_val_if_fail (GDK_IS_COLORMAP (colormap), FALSE);
g_return_val_if_fail (colors != NULL, FALSE);
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
for (i=0; i<ncolors; i++)
{
success[i] = FALSE;
}
- switch (private->base.visual->type)
+ switch (colormap->visual->type)
{
case GDK_VISUAL_PSEUDO_COLOR:
case GDK_VISUAL_GRAYSCALE:
@@ -867,7 +929,7 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_TRUE_COLOR:
- visual = private->base.visual;
+ visual = colormap->visual;
for (i=0; i<ncolors; i++)
{
@@ -905,10 +967,10 @@ gboolean
gdk_color_change (GdkColormap *colormap,
GdkColor *color)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
XColor xcolor;
- g_return_val_if_fail (colormap != NULL, FALSE);
+ g_return_val_if_fail (GDK_IS_COLORMAP (colormap), FALSE);
g_return_val_if_fail (color != NULL, FALSE);
xcolor.pixel = color->pixel;
@@ -917,7 +979,7 @@ gdk_color_change (GdkColormap *colormap,
xcolor.blue = color->blue;
xcolor.flags = DoRed | DoGreen | DoBlue;
- private = (GdkColormapPrivateX*) colormap;
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
return TRUE;
@@ -930,7 +992,7 @@ GdkColormap*
gdkx_colormap_get (Colormap xcolormap)
{
GdkColormap *colormap;
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
colormap = gdk_colormap_lookup (xcolormap);
if (colormap)
@@ -939,12 +1001,12 @@ gdkx_colormap_get (Colormap xcolormap)
if (xcolormap == DefaultColormap (gdk_display, gdk_screen))
return gdk_colormap_get_system ();
- private = g_new (GdkColormapPrivateX, 1);
- colormap = (GdkColormap*) private;
+ colormap = GDK_COLORMAP (g_type_create_instance (gdk_colormap_get_type ()));
+ private = GDK_COLORMAP_PRIVATE_DATA (colormap);
private->xdisplay = gdk_display;
private->xcolormap = xcolormap;
- private->base.visual = NULL;
+ colormap->visual = NULL;
private->private_val = TRUE;
/* To do the following safely, we would have to have some way of finding
@@ -1035,13 +1097,13 @@ gdk_colormap_lookup (Colormap xcolormap)
static void
gdk_colormap_add (GdkColormap *cmap)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
if (!colormap_hash)
colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
(GCompareFunc) gdk_colormap_cmp);
- private = (GdkColormapPrivateX*)cmap;
+ private = GDK_COLORMAP_PRIVATE_DATA (cmap);
g_hash_table_insert (colormap_hash, &private->xcolormap, cmap);
}
@@ -1049,13 +1111,13 @@ gdk_colormap_add (GdkColormap *cmap)
static void
gdk_colormap_remove (GdkColormap *cmap)
{
- GdkColormapPrivateX *private;
+ GdkColormapPrivateX11 *private;
if (!colormap_hash)
colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
(GCompareFunc) gdk_colormap_cmp);
- private = (GdkColormapPrivateX *)cmap;
+ private = GDK_COLORMAP_PRIVATE_DATA (cmap);
g_hash_table_remove (colormap_hash, &private->xcolormap);
}
diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c
index d0a580cccd..277bd2e264 100644
--- a/gdk/x11/gdkcursor-x11.c
+++ b/gdk/x11/gdkcursor-x11.c
@@ -29,6 +29,8 @@
#include "gdkx.h"
#include "gdkcursor.h"
+#include "gdkpixmap-x11.h"
+#include <gdk/gdkpixmap.h>
GdkCursor*
gdk_cursor_new (GdkCursorType cursor_type)
@@ -62,12 +64,13 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
Cursor xcursor;
XColor xfg, xbg;
- g_return_val_if_fail (source != NULL, NULL);
+ g_return_val_if_fail (GDK_IS_PIXMAP (source), NULL);
+ g_return_val_if_fail (GDK_IS_PIXMAP (mask), NULL);
g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL);
- source_pixmap = GDK_DRAWABLE_XID (source);
- mask_pixmap = GDK_DRAWABLE_XID (mask);
+ source_pixmap = GDK_PIXMAP_XID (source);
+ mask_pixmap = GDK_PIXMAP_XID (mask);
xfg.pixel = fg->pixel;
xfg.red = fg->red;
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 8509b3220e..05faffd556 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -34,7 +34,7 @@
#include "gdkinternals.h"
#include "gdkprivate-x11.h"
-typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
+typedef struct _GdkDragContextPrivateX11 GdkDragContextPrivateX11;
typedef enum {
GDK_DRAG_STATUS_DRAG,
@@ -58,7 +58,7 @@ typedef struct {
/* Structure that holds information about a drag in progress.
* this is used on both source and destination sides.
*/
-struct _GdkDragContextPrivate {
+struct _GdkDragContextPrivateX11 {
GdkDragContext context;
GdkAtom motif_selection;
@@ -82,6 +82,8 @@ struct _GdkDragContextPrivate {
GdkWindowCache *window_cache;
};
+#define PRIVATE_DATA(context) ((GdkDragContextPrivateX11 *) GDK_DRAG_CONTEXT (context)->windowing_data)
+
GdkDragContext *current_dest_drag = NULL;
/* Forward declarations */
@@ -121,66 +123,115 @@ static void xdnd_manage_source_filter (GdkDragContext *context,
GdkWindow *window,
gboolean add_filter);
-/* Drag Contexts */
+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;
-GdkDragContext *
-gdk_drag_context_new (void)
+GType
+gdk_drag_context_get_type (void)
{
- GdkDragContextPrivate *result;
+ 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,
+ "GdkDragContext",
+ &object_info);
+ }
+
+ return object_type;
+}
- result = g_new0 (GdkDragContextPrivate, 1);
+static void
+gdk_drag_context_init (GdkDragContext *dragcontext)
+{
+ GdkDragContextPrivateX11 *private;
- result->ref_count = 1;
+ private = g_new0 (GdkDragContextPrivateX11, 1);
- contexts = g_list_prepend (contexts, result);
+ dragcontext->windowing_data = private;
- return (GdkDragContext *)result;
+ contexts = g_list_prepend (contexts, dragcontext);
}
-void
-gdk_drag_context_ref (GdkDragContext *context)
+static void
+gdk_drag_context_class_init (GdkDragContextClass *klass)
{
- g_return_if_fail (context != NULL);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
- ((GdkDragContextPrivate *)context)->ref_count++;
+ object_class->finalize = gdk_drag_context_finalize;
}
-void
-gdk_drag_context_unref (GdkDragContext *context)
+static void
+gdk_drag_context_finalize (GObject *object)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
-
- g_return_if_fail (context != NULL);
- g_return_if_fail (private->ref_count > 0);
-
- private->ref_count--;
+ GdkDragContext *context = GDK_DRAG_CONTEXT (object);
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
- if (private->ref_count == 0)
+ g_list_free (context->targets);
+
+ if (context->source_window)
{
- g_dataset_destroy (private);
+ if ((context->protocol == GDK_DRAG_PROTO_XDND) &&
+ !context->is_source)
+ xdnd_manage_source_filter (context, context->source_window, FALSE);
- g_list_free (context->targets);
+ gdk_window_unref (context->source_window);
+ }
+
+ if (context->dest_window)
+ gdk_window_unref (context->dest_window);
+
+ if (private->window_cache)
+ gdk_window_cache_destroy (private->window_cache);
+
+ contexts = g_list_remove (contexts, context);
- if (context->source_window)
- {
- if ((context->protocol == GDK_DRAG_PROTO_XDND) &&
- !context->is_source)
- xdnd_manage_source_filter (context, context->source_window, FALSE);
+ g_free (private);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
- gdk_window_unref (context->source_window);
- }
+/* Drag Contexts */
+
+GdkDragContext *
+gdk_drag_context_new (void)
+{
+ return GDK_DRAG_CONTEXT (g_type_create_instance (gdk_drag_context_get_type ()));
+}
+
+void
+gdk_drag_context_ref (GdkDragContext *context)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
- if (context->dest_window)
- gdk_window_unref (context->dest_window);
+ g_object_ref (G_OBJECT (context));
+}
- if (private->window_cache)
- gdk_window_cache_destroy (private->window_cache);
+void
+gdk_drag_context_unref (GdkDragContext *context)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
- contexts = g_list_remove (contexts, private);
- g_free (private);
- }
+ g_object_unref (G_OBJECT (context));
}
static GdkDragContext *
@@ -190,19 +241,19 @@ gdk_drag_context_find (gboolean is_source,
{
GList *tmp_list = contexts;
GdkDragContext *context;
- GdkDragContextPrivate *private;
+ GdkDragContextPrivateX11 *private;
Window context_dest_xid;
while (tmp_list)
{
context = (GdkDragContext *)tmp_list->data;
- private = (GdkDragContextPrivate *)context;
+ private = PRIVATE_DATA (context);
context_dest_xid = context->dest_window ?
- (private->drop_xid ?
- private->drop_xid :
- GDK_DRAWABLE_XID (context->dest_window)) :
- None;
+ (private->drop_xid ?
+ private->drop_xid :
+ GDK_DRAWABLE_XID (context->dest_window)) :
+ None;
if ((!context->is_source == !is_source) &&
((source_xid == None) || (context->source_window &&
@@ -1250,7 +1301,7 @@ motif_dnd_get_flags (GdkDragContext *context)
static void
motif_set_targets (GdkDragContext *context)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
MotifDragInitiatorInfo info;
gint i;
static GdkAtom motif_drag_initiator_info = GDK_NONE;
@@ -1334,7 +1385,7 @@ motif_send_enter (GdkDragContext *context,
guint32 time)
{
XEvent xev;
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
@@ -1393,7 +1444,7 @@ motif_send_motion (GdkDragContext *context,
{
gboolean retval;
XEvent xev;
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
@@ -1436,7 +1487,7 @@ static void
motif_send_drop (GdkDragContext *context, guint32 time)
{
XEvent xev;
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE);
@@ -1537,7 +1588,7 @@ motif_drag_context_new (GdkWindow *dest_window,
guint32 atom)
{
GdkDragContext *new_context;
- GdkDragContextPrivate *private;
+ GdkDragContextPrivateX11 *private;
/* FIXME, current_dest_drag really shouldn't be NULL'd
* if we error below.
@@ -1554,7 +1605,7 @@ motif_drag_context_new (GdkWindow *dest_window,
}
new_context = gdk_drag_context_new ();
- private = (GdkDragContextPrivate *)new_context;
+ private = PRIVATE_DATA (new_context);
new_context->protocol = GDK_DRAG_PROTO_MOTIF;
new_context->is_source = FALSE;
@@ -1651,7 +1702,7 @@ motif_motion (GdkEvent *event,
gint16 x_root,
gint16 y_root)
{
- GdkDragContextPrivate *private;
+ GdkDragContextPrivateX11 *private;
GDK_NOTE(DND, g_message ("Motif DND motion: flags: %#4x time: %d (%d, %d)",
flags, timestamp, x_root, y_root));
@@ -1660,7 +1711,7 @@ motif_motion (GdkEvent *event,
(current_dest_drag->protocol == GDK_DRAG_PROTO_MOTIF) &&
(timestamp >= current_dest_drag->start_time))
{
- private = (GdkDragContextPrivate *)current_dest_drag;
+ private = PRIVATE_DATA (current_dest_drag);
event->dnd.type = GDK_DRAG_MOTION;
event->dnd.context = current_dest_drag;
@@ -1689,7 +1740,7 @@ motif_operation_changed (GdkEvent *event,
guint16 flags,
guint32 timestamp)
{
- GdkDragContextPrivate *private;
+ GdkDragContextPrivateX11 *private;
GDK_NOTE(DND, g_message ("Motif DND operation changed: flags: %#4x time: %d",
flags, timestamp));
@@ -1704,7 +1755,7 @@ motif_operation_changed (GdkEvent *event,
gdk_drag_context_ref (current_dest_drag);
event->dnd.time = timestamp;
- private = (GdkDragContextPrivate *)current_dest_drag;
+ private = PRIVATE_DATA (current_dest_drag);
motif_dnd_translate_flags (current_dest_drag, flags);
@@ -1768,7 +1819,7 @@ motif_drag_status (GdkEvent *event,
if (context)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
if ((private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT) ||
(private->drag_status == GDK_DRAG_STATUS_ACTION_WAIT))
private->drag_status = GDK_DRAG_STATUS_DRAG;
@@ -1967,7 +2018,7 @@ xdnd_status_filter (GdkXEvent *xev,
context = gdk_drag_context_find (TRUE, xevent->xclient.window, dest_window);
if (context)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
private->drag_status = GDK_DRAG_STATUS_DRAG;
@@ -2020,7 +2071,7 @@ xdnd_finished_filter (GdkXEvent *xev,
static void
xdnd_set_targets (GdkDragContext *context)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
GdkAtom *atomlist;
GList *tmp_list = context->targets;
gint i;
@@ -2049,7 +2100,7 @@ xdnd_set_targets (GdkDragContext *context)
static void
xdnd_set_actions (GdkDragContext *context)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
GdkAtom *atomlist;
gint i;
gint n_atoms;
@@ -2119,7 +2170,7 @@ static void
xdnd_send_enter (GdkDragContext *context)
{
XEvent xev;
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_atom_intern ("XdndEnter", FALSE);
@@ -2171,7 +2222,7 @@ xdnd_send_leave (GdkDragContext *context)
{
XEvent xev;
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_atom_intern ("XdndLeave", FALSE);
@@ -2199,7 +2250,7 @@ xdnd_send_leave (GdkDragContext *context)
static void
xdnd_send_drop (GdkDragContext *context, guint32 time)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
XEvent xev;
xev.xclient.type = ClientMessage;
@@ -2232,7 +2283,7 @@ xdnd_send_motion (GdkDragContext *context,
GdkDragAction action,
guint32 time)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
XEvent xev;
xev.xclient.type = ClientMessage;
@@ -2365,7 +2416,7 @@ xdnd_read_actions (GdkDragContext *context)
for (i=0; i<nitems; i++)
context->actions |= xdnd_action_from_atom (data[i]);
- ((GdkDragContextPrivate *)context)->xdnd_have_actions = TRUE;
+ (PRIVATE_DATA (context))->xdnd_have_actions = TRUE;
#ifdef G_ENABLE_DEBUG
if (gdk_debug_flags & GDK_DEBUG_DND)
@@ -2423,16 +2474,10 @@ xdnd_manage_source_filter (GdkDragContext *context,
gboolean add_filter)
{
gint old_warnings = 0; /* quiet gcc */
-
- gboolean is_foreign = GDK_DRAWABLE_TYPE (window);
- if (is_foreign)
- {
- old_warnings = gdk_error_warnings;
- gdk_error_warnings = 0;
- }
+ gdk_error_trap_push ();
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
if (add_filter)
{
@@ -2454,11 +2499,8 @@ xdnd_manage_source_filter (GdkDragContext *context,
}
}
- if (is_foreign)
- {
- gdk_flush();
- gdk_error_warnings = old_warnings;
- }
+ gdk_flush ();
+ gdk_error_trap_pop ();
}
static GdkFilterReturn
@@ -2558,7 +2600,7 @@ xdnd_enter_filter (GdkXEvent *xev,
gdk_drag_context_ref (new_context);
current_dest_drag = new_context;
- ((GdkDragContextPrivate *)new_context)->xdnd_selection =
+ (PRIVATE_DATA (new_context))->xdnd_selection =
gdk_atom_intern ("XdndSelection", FALSE);
return GDK_FILTER_TRANSLATE;
@@ -2620,14 +2662,14 @@ xdnd_position_filter (GdkXEvent *xev,
event->dnd.time = time;
current_dest_drag->suggested_action = xdnd_action_from_atom (action);
- if (!((GdkDragContextPrivate *)current_dest_drag)->xdnd_have_actions)
+ if (!(PRIVATE_DATA (current_dest_drag))->xdnd_have_actions)
current_dest_drag->actions = current_dest_drag->suggested_action;
event->dnd.x_root = x_root;
event->dnd.y_root = y_root;
- ((GdkDragContextPrivate *)current_dest_drag)->last_x = x_root;
- ((GdkDragContextPrivate *)current_dest_drag)->last_y = y_root;
+ (PRIVATE_DATA (current_dest_drag))->last_x = x_root;
+ (PRIVATE_DATA (current_dest_drag))->last_y = y_root;
return GDK_FILTER_TRANSLATE;
}
@@ -2652,8 +2694,8 @@ xdnd_drop_filter (GdkXEvent *xev,
(current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
(GDK_DRAWABLE_XID (current_dest_drag->source_window) == source_window))
{
- GdkDragContextPrivate *private;
- private = (GdkDragContextPrivate *)current_dest_drag;
+ GdkDragContextPrivateX11 *private;
+ private = PRIVATE_DATA (current_dest_drag);
event->dnd.type = GDK_DROP_START;
@@ -2843,7 +2885,7 @@ gdk_drag_find_window (GdkDragContext *context,
GdkWindow **dest_window,
GdkDragProtocol *protocol)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
Window dest;
g_return_if_fail (context != NULL);
@@ -2899,7 +2941,7 @@ gdk_drag_motion (GdkDragContext *context,
GdkDragAction possible_actions,
guint32 time)
{
- GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
+ GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
g_return_val_if_fail (context != NULL, FALSE);
@@ -3073,12 +3115,12 @@ gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time)
{
- GdkDragContextPrivate *private;
+ GdkDragContextPrivateX11 *private;
XEvent xev;
g_return_if_fail (context != NULL);
- private = (GdkDragContextPrivate *)context;
+ private = PRIVATE_DATA (context);
context->action = action;
@@ -3167,11 +3209,11 @@ gdk_drop_reply (GdkDragContext *context,
gboolean ok,
guint32 time)
{
- GdkDragContextPrivate *private;
+ GdkDragContextPrivateX11 *private;
g_return_if_fail (context != NULL);
- private = (GdkDragContextPrivate *)context;
+ private = PRIVATE_DATA (context);
if (context->protocol == GDK_DRAG_PROTO_MOTIF)
{
@@ -3291,9 +3333,9 @@ gdk_drag_get_selection (GdkDragContext *context)
g_return_val_if_fail (context != NULL, GDK_NONE);
if (context->protocol == GDK_DRAG_PROTO_MOTIF)
- return ((GdkDragContextPrivate *)context)->motif_selection;
+ return (PRIVATE_DATA (context))->motif_selection;
else if (context->protocol == GDK_DRAG_PROTO_XDND)
- return ((GdkDragContextPrivate *)context)->xdnd_selection;
+ return (PRIVATE_DATA (context))->xdnd_selection;
else
return GDK_NONE;
}
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index 91cc77647a..6ed59558af 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -26,161 +26,196 @@
#include "gdkprivate-x11.h"
#include <pango/pangox.h>
+#include <config.h>
-static void gdk_x11_drawable_destroy (GdkDrawable *drawable);
-
-static void gdk_x11_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gdk_x11_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
-static void gdk_x11_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- GdkPoint *points,
- gint npoints);
-static void gdk_x11_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
-static void gdk_x11_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length);
-static void gdk_x11_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_x11_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-static void gdk_x11_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
-static void gdk_x11_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-static void gdk_x11_draw_glyphs (GdkDrawable *drawable,
- GdkGC *gc,
- PangoFont *font,
- gint x,
- gint y,
- PangoGlyphString *glyphs);
-
-GdkDrawableClass _gdk_x11_drawable_class = {
- gdk_x11_drawable_destroy,
- _gdk_x11_gc_new,
- gdk_x11_draw_rectangle,
- gdk_x11_draw_arc,
- gdk_x11_draw_polygon,
- gdk_x11_draw_text,
- gdk_x11_draw_text_wc,
- gdk_x11_draw_drawable,
- gdk_x11_draw_points,
- gdk_x11_draw_segments,
- gdk_x11_draw_lines,
- gdk_x11_draw_glyphs,
-};
+#include <stdlib.h>
-/*****************************************************
- * X11 specific implementations of generic functions *
- *****************************************************/
+#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
+#define USE_SHM
+#endif
-GdkColormap*
-gdk_drawable_get_colormap (GdkDrawable *drawable)
+#ifdef USE_SHM
+#include <X11/extensions/XShm.h>
+#endif /* USE_SHM */
+
+#include "gdkprivate-x11.h"
+#include "gdkdrawable-x11.h"
+#include "gdkpixmap-x11.h"
+
+static void gdk_x11_draw_rectangle (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+static void gdk_x11_draw_arc (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint angle1,
+ gint angle2);
+static void gdk_x11_draw_polygon (GdkDrawable *drawable,
+ GdkGC *gc,
+ gint filled,
+ GdkPoint *points,
+ gint npoints);
+static void gdk_x11_draw_text (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const gchar *text,
+ gint text_length);
+static void gdk_x11_draw_text_wc (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length);
+static void gdk_x11_draw_drawable (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPixmap *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+static void gdk_x11_draw_points (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
+static void gdk_x11_draw_segments (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkSegment *segs,
+ gint nsegs);
+static void gdk_x11_draw_lines (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
+static void gdk_x11_draw_glyphs (GdkDrawable *drawable,
+ GdkGC *gc,
+ PangoFont *font,
+ gint x,
+ gint y,
+ PangoGlyphString *glyphs);
+static void gdk_x11_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+
+static void gdk_x11_set_colormap (GdkDrawable *drawable,
+ GdkColormap *colormap);
+
+static GdkColormap* gdk_x11_get_colormap (GdkDrawable *drawable);
+
+static gint gdk_x11_get_depth (GdkDrawable *drawable);
+
+static void gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_drawable_impl_x11_get_type (void)
{
- GdkDrawablePrivate *drawable_private;
- XWindowAttributes window_attributes;
-
- g_return_val_if_fail (drawable != NULL, NULL);
- drawable_private = (GdkDrawablePrivate*) drawable;
-
- if (!GDK_DRAWABLE_DESTROYED (drawable))
- {
- if (drawable_private->colormap == NULL &&
- GDK_IS_WINDOW (drawable))
- {
- XGetWindowAttributes (GDK_DRAWABLE_XDISPLAY (drawable),
- GDK_DRAWABLE_XID (drawable),
- &window_attributes);
- drawable_private->colormap = gdk_colormap_lookup (window_attributes.colormap);
- }
+ static GType object_type = 0;
- return drawable_private->colormap;
+ 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,
+ "GdkDrawableImplX11",
+ &object_info);
}
- return NULL;
+ return object_type;
}
-void
-gdk_drawable_set_colormap (GdkDrawable *drawable,
- GdkColormap *colormap)
+static void
+gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
{
- GdkDrawablePrivate *drawable_private;
- GdkColormapPrivateX *colormap_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (colormap != NULL);
+ GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ drawable_class->create_gc = _gdk_x11_gc_new;
+ drawable_class->draw_rectangle = gdk_x11_draw_rectangle;
+ drawable_class->draw_arc = gdk_x11_draw_arc;
+ drawable_class->draw_polygon = gdk_x11_draw_polygon;
+ drawable_class->draw_text = gdk_x11_draw_text;
+ drawable_class->draw_text_wc = gdk_x11_draw_text_wc;
+ drawable_class->draw_drawable = gdk_x11_draw_drawable;
+ drawable_class->draw_points = gdk_x11_draw_points;
+ drawable_class->draw_segments = gdk_x11_draw_segments;
+ drawable_class->draw_lines = gdk_x11_draw_lines;
+ drawable_class->draw_glyphs = gdk_x11_draw_glyphs;
+ drawable_class->draw_image = gdk_x11_draw_image;
- drawable_private = (GdkDrawablePrivate *)drawable;
- colormap_private = (GdkColormapPrivateX *)colormap;
-
- if (!GDK_DRAWABLE_DESTROYED (drawable))
- {
- if (GDK_IS_WINDOW (drawable))
- {
- g_return_if_fail (colormap_private->base.visual !=
- ((GdkColormapPrivate *)(drawable_private->colormap))->visual);
+ drawable_class->set_colormap = gdk_x11_set_colormap;
+ drawable_class->get_colormap = gdk_x11_get_colormap;
- XSetWindowColormap (GDK_DRAWABLE_XDISPLAY (drawable),
- GDK_DRAWABLE_XID (drawable),
- colormap_private->xcolormap);
- }
+ drawable_class->get_depth = gdk_x11_get_depth;
+}
- if (drawable_private->colormap)
- gdk_colormap_unref (drawable_private->colormap);
- drawable_private->colormap = colormap;
- gdk_colormap_ref (drawable_private->colormap);
+/*****************************************************
+ * X11 specific implementations of generic functions *
+ *****************************************************/
- if (GDK_IS_WINDOW (drawable) &&
- drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
- gdk_window_add_colormap_windows (drawable);
- }
+static GdkColormap*
+gdk_x11_get_colormap (GdkDrawable *drawable)
+{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+ return impl->colormap;
}
-/* Drawing
- */
-static void
-gdk_x11_drawable_destroy (GdkDrawable *drawable)
+static void
+gdk_x11_set_colormap (GdkDrawable *drawable,
+ GdkColormap *colormap)
{
+ GdkDrawableImplX11 *impl;
+
+ g_return_if_fail (colormap != NULL);
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+ if (impl->colormap == colormap)
+ return;
+ if (impl->colormap)
+ gdk_colormap_unref (impl->colormap);
+ impl->colormap = colormap;
+ if (impl->colormap)
+ gdk_colormap_ref (impl->colormap);
}
+/* Drawing
+ */
+
static void
gdk_x11_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
@@ -190,11 +225,15 @@ gdk_x11_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
if (filled)
- XFillRectangle (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XFillRectangle (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), x, y, width, height);
else
- XDrawRectangle (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XDrawRectangle (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), x, y, width, height);
}
@@ -209,11 +248,16 @@ gdk_x11_draw_arc (GdkDrawable *drawable,
gint angle1,
gint angle2)
{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+
if (filled)
- XFillArc (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XFillArc (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), x, y, width, height, angle1, angle2);
else
- XDrawArc (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XDrawArc (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), x, y, width, height, angle1, angle2);
}
@@ -226,7 +270,11 @@ gdk_x11_draw_polygon (GdkDrawable *drawable,
{
XPoint *tmp_points;
gint tmp_npoints, i;
+ GdkDrawableImplX11 *impl;
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+
if (!filled &&
(points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y))
{
@@ -248,10 +296,10 @@ gdk_x11_draw_polygon (GdkDrawable *drawable,
}
if (filled)
- XFillPolygon (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XFillPolygon (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), tmp_points, tmp_npoints, Complex, CoordModeOrigin);
else
- XDrawLines (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XDrawLines (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), tmp_points, tmp_npoints, CoordModeOrigin);
g_free (tmp_points);
@@ -272,25 +320,29 @@ gdk_x11_draw_text (GdkDrawable *drawable,
const gchar *text,
gint text_length)
{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
if (font->type == GDK_FONT_FONT)
{
XFontStruct *xfont = (XFontStruct *) GDK_FONT_XFONT (font);
- XSetFont(GDK_DRAWABLE_XDISPLAY (drawable), GDK_GC_GET_XGC (gc), xfont->fid);
+ XSetFont(impl->xdisplay, GDK_GC_GET_XGC (gc), xfont->fid);
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
{
- XDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XDrawString (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), x, y, text, text_length);
}
else
{
- XDrawString16 (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XDrawString16 (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), x, y, (XChar2b *) text, text_length / 2);
}
}
else if (font->type == GDK_FONT_FONTSET)
{
XFontSet fontset = (XFontSet) GDK_FONT_XFONT (font);
- XmbDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XmbDrawString (impl->xdisplay, impl->xid,
fontset, GDK_GC_GET_XGC (gc), x, y, text, text_length);
}
else
@@ -306,15 +358,19 @@ gdk_x11_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text,
gint text_length)
{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
if (font->type == GDK_FONT_FONT)
{
XFontStruct *xfont = (XFontStruct *) GDK_FONT_XFONT (font);
gchar *text_8bit;
gint i;
- XSetFont(GDK_DRAWABLE_XDISPLAY (drawable), GDK_GC_GET_XGC (gc), xfont->fid);
+ XSetFont(impl->xdisplay, GDK_GC_GET_XGC (gc), xfont->fid);
text_8bit = g_new (gchar, text_length);
for (i=0; i<text_length; i++) text_8bit[i] = text[i];
- XDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XDrawString (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), x, y, text_8bit, text_length);
g_free (text_8bit);
}
@@ -322,7 +378,7 @@ gdk_x11_draw_text_wc (GdkDrawable *drawable,
{
if (sizeof(GdkWChar) == sizeof(wchar_t))
{
- XwcDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XwcDrawString (impl->xdisplay, impl->xid,
(XFontSet) GDK_FONT_XFONT (font),
GDK_GC_GET_XGC (gc), x, y, (wchar_t *)text, text_length);
}
@@ -332,7 +388,7 @@ gdk_x11_draw_text_wc (GdkDrawable *drawable,
gint i;
text_wchar = g_new (wchar_t, text_length);
for (i=0; i<text_length; i++) text_wchar[i] = text[i];
- XwcDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XwcDrawString (impl->xdisplay, impl->xid,
(XFontSet) GDK_FONT_XFONT (font),
GDK_GC_GET_XGC (gc), x, y, text_wchar, text_length);
g_free (text_wchar);
@@ -355,12 +411,15 @@ gdk_x11_draw_drawable (GdkDrawable *drawable,
{
int src_depth = gdk_drawable_get_depth (src);
int dest_depth = gdk_drawable_get_depth (drawable);
+ GdkDrawableImplX11 *impl;
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
if (src_depth == 1)
{
- XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
+ XCopyArea (impl->xdisplay,
GDK_DRAWABLE_XID (src),
- GDK_DRAWABLE_XID (drawable),
+ impl->xid,
GDK_GC_GET_XGC (gc),
xsrc, ysrc,
width, height,
@@ -368,9 +427,9 @@ gdk_x11_draw_drawable (GdkDrawable *drawable,
}
else if (dest_depth != 0 && src_depth == dest_depth)
{
- XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
+ XCopyArea (impl->xdisplay,
GDK_DRAWABLE_XID (src),
- GDK_DRAWABLE_XID (drawable),
+ impl->xid,
GDK_GC_GET_XGC (gc),
xsrc, ysrc,
width, height,
@@ -386,13 +445,18 @@ gdk_x11_draw_points (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+
/* We special-case npoints == 1, because X will merge multiple
* consecutive XDrawPoint requests into a PolyPoint request
*/
if (npoints == 1)
{
- XDrawPoint (GDK_DRAWABLE_XDISPLAY (drawable),
- GDK_DRAWABLE_XID (drawable),
+ XDrawPoint (impl->xdisplay,
+ impl->xid,
GDK_GC_GET_XGC (gc),
points[0].x, points[0].y);
}
@@ -407,8 +471,8 @@ gdk_x11_draw_points (GdkDrawable *drawable,
tmp_points[i].y = points[i].y;
}
- XDrawPoints (GDK_DRAWABLE_XDISPLAY (drawable),
- GDK_DRAWABLE_XID (drawable),
+ XDrawPoints (impl->xdisplay,
+ impl->xid,
GDK_GC_GET_XGC (gc),
tmp_points,
npoints,
@@ -424,12 +488,17 @@ gdk_x11_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+
/* We special-case nsegs == 1, because X will merge multiple
* consecutive XDrawLine requests into a PolySegment request
*/
if (nsegs == 1)
{
- XDrawLine (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+ XDrawLine (impl->xdisplay, impl->xid,
GDK_GC_GET_XGC (gc), segs[0].x1, segs[0].y1,
segs[0].x2, segs[0].y2);
}
@@ -446,8 +515,8 @@ gdk_x11_draw_segments (GdkDrawable *drawable,
tmp_segs[i].y2 = segs[i].y2;
}
- XDrawSegments (GDK_DRAWABLE_XDISPLAY (drawable),
- GDK_DRAWABLE_XID (drawable),
+ XDrawSegments (impl->xdisplay,
+ impl->xid,
GDK_GC_GET_XGC (gc),
tmp_segs, nsegs);
@@ -463,15 +532,19 @@ gdk_x11_draw_lines (GdkDrawable *drawable,
{
gint i;
XPoint *tmp_points = g_new (XPoint, npoints);
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
for (i=0; i<npoints; i++)
{
tmp_points[i].x = points[i].x;
tmp_points[i].y = points[i].y;
}
- XDrawLines (GDK_DRAWABLE_XDISPLAY (drawable),
- GDK_DRAWABLE_XID (drawable),
+ XDrawLines (impl->xdisplay,
+ impl->xid,
GDK_GC_GET_XGC (gc),
tmp_points, npoints,
CoordModeOrigin);
@@ -487,8 +560,46 @@ gdk_x11_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs)
{
- pango_x_render (GDK_DRAWABLE_XDISPLAY (drawable),
- GDK_DRAWABLE_XID (drawable),
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+ pango_x_render (impl->xdisplay,
+ impl->xid,
GDK_GC_GET_XGC (gc),
font, glyphs, x, y);
}
+
+static void
+gdk_x11_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
+{
+ GdkDrawableImplX11 *impl;
+
+ impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+
+ if (image->type == GDK_IMAGE_SHARED)
+ XShmPutImage (impl->xdisplay, impl->xid,
+ GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
+ xsrc, ysrc, xdest, ydest, width, height, False);
+ else
+ XPutImage (impl->xdisplay, impl->xid,
+ GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
+ xsrc, ysrc, xdest, ydest, width, height);
+}
+
+static gint
+gdk_x11_get_depth (GdkDrawable *drawable)
+{
+ /* This is a bit bogus but I'm not sure the other way is better */
+
+ return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper);
+}
+
diff --git a/gdk/x11/gdkdrawable-x11.h b/gdk/x11/gdkdrawable-x11.h
new file mode 100644
index 0000000000..d0e3d552e1
--- /dev/null
+++ b/gdk/x11/gdkdrawable-x11.h
@@ -0,0 +1,73 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GDK_DRAWABLE_X11_H__
+#define __GDK_DRAWABLE_X11_H__
+
+#include <gdk/gdkdrawable.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Drawable implementation for X11
+ */
+
+typedef struct _GdkDrawableImplX11 GdkDrawableImplX11;
+typedef struct _GdkDrawableImplX11Class GdkDrawableImplX11Class;
+
+#define GDK_TYPE_DRAWABLE_IMPL_X11 (gdk_drawable_impl_x11_get_type ())
+#define GDK_DRAWABLE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE_IMPL_X11, GdkDrawableImplX11))
+#define GDK_DRAWABLE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE_IMPL_X11, GdkDrawableImplX11Class))
+#define GDK_IS_DRAWABLE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL_X11))
+#define GDK_IS_DRAWABLE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE_IMPL_X11))
+#define GDK_DRAWABLE_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE_IMPL_X11, GdkDrawableImplX11Class))
+
+struct _GdkDrawableImplX11
+{
+ GdkDrawable parent_instance;
+
+ GdkDrawable *wrapper;
+
+ GdkColormap *colormap;
+
+ Window xid;
+ Display *xdisplay;
+};
+
+struct _GdkDrawableImplX11Class
+{
+ GdkDrawableClass parent_class;
+
+};
+
+GType gdk_drawable_impl_x11_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GDK_DRAWABLE_X11_H__ */
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 7036b96cec..b9e0285c50 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -261,7 +261,7 @@ gdk_event_translate (GdkEvent *event,
{
GdkWindow *window;
- GdkWindowPrivate *window_private;
+ GdkWindowObject *window_private;
static XComposeStatus compose;
KeySym keysym;
int charcount;
@@ -297,7 +297,7 @@ gdk_event_translate (GdkEvent *event,
window = gdk_window_lookup (xevent->xany.window);
/* FIXME: window might be a GdkPixmap!!! */
- window_private = (GdkWindowPrivate *) window;
+ window_private = (GdkWindowObject *) window;
if (window != NULL)
gdk_window_ref (window);
@@ -305,10 +305,10 @@ gdk_event_translate (GdkEvent *event,
event->any.window = window;
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
- if (window_private && GDK_DRAWABLE_DESTROYED (window))
+ if (window_private && GDK_WINDOW_DESTROYED (window))
{
if (xevent->type != DestroyNotify)
- return FALSE;
+ return FALSE;
}
else
{
@@ -329,7 +329,7 @@ gdk_event_translate (GdkEvent *event,
#ifdef USE_XIM
if (window == NULL && gdk_xim_window && xevent->type == KeyPress &&
- !GDK_DRAWABLE_DESTROYED (gdk_xim_window))
+ !GDK_WINDOW_DESTROYED (gdk_xim_window))
{
/*
* If user presses a key in Preedit or Status window, keypress event
@@ -344,7 +344,7 @@ gdk_event_translate (GdkEvent *event,
GdkFilterReturn result;
window = gdk_xim_window;
- window_private = (GdkWindowPrivate *) window;
+ window_private = (GdkWindowObject *) window;
gdk_window_ref (window);
event->any.window = window;
@@ -626,7 +626,7 @@ gdk_event_translate (GdkEvent *event,
/* Tell XInput stuff about it if appropriate */
if (window_private &&
- !GDK_DRAWABLE_DESTROYED (window) &&
+ !GDK_WINDOW_DESTROYED (window) &&
(window_private->extension_events != 0) &&
gdk_input_vtable.enter_event)
gdk_input_vtable.enter_event (&xevent->xcrossing, window);
@@ -937,9 +937,9 @@ gdk_event_translate (GdkEvent *event,
event->any.type = GDK_DESTROY;
event->any.window = window;
- return_val = window_private && !GDK_DRAWABLE_DESTROYED (window);
+ return_val = window_private && !GDK_WINDOW_DESTROYED (window);
- if (window && GDK_DRAWABLE_XID (window) != GDK_ROOT_WINDOW())
+ if (window && GDK_WINDOW_XID (window) != GDK_ROOT_WINDOW())
gdk_window_destroy_notify (window);
break;
@@ -992,16 +992,16 @@ gdk_event_translate (GdkEvent *event,
xevent->xconfigure.override_redirect,
!window
? " (discarding)"
- : GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD
+ : GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD
? " (discarding child)"
: ""));
if (window &&
- !GDK_DRAWABLE_DESTROYED (window) &&
+ !GDK_WINDOW_DESTROYED (window) &&
(window_private->extension_events != 0) &&
gdk_input_vtable.configure_event)
gdk_input_vtable.configure_event (&xevent->xconfigure, window);
- if (!window || GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD)
+ if (!window || GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
return_val = FALSE;
else
{
@@ -1012,7 +1012,7 @@ gdk_event_translate (GdkEvent *event,
if (!xevent->xconfigure.x &&
!xevent->xconfigure.y &&
- !GDK_DRAWABLE_DESTROYED (window))
+ !GDK_WINDOW_DESTROYED (window))
{
gint tx = 0;
gint ty = 0;
@@ -1042,8 +1042,8 @@ gdk_event_translate (GdkEvent *event,
}
window_private->x = event->configure.x;
window_private->y = event->configure.y;
- window_private->drawable.width = xevent->xconfigure.width;
- window_private->drawable.height = xevent->xconfigure.height;
+ GDK_WINDOW_IMPL_X11 (window_private->impl)->width = xevent->xconfigure.width;
+ GDK_WINDOW_IMPL_X11 (window_private->impl)->height = xevent->xconfigure.height;
if (window_private->resize_count > 1)
window_private->resize_count -= 1;
}
@@ -1177,7 +1177,7 @@ gdk_event_translate (GdkEvent *event,
/* something else - (e.g., a Xinput event) */
if (window_private &&
- !window_private->drawable.destroyed &&
+ !GDK_WINDOW_DESTROYED (window_private) &&
(window_private->extension_events != 0) &&
gdk_input_vtable.other_event)
return_val = gdk_input_vtable.other_event(event, xevent, window);
diff --git a/gdk/x11/gdkgc-x11.c b/gdk/x11/gdkgc-x11.c
index e68eaab9a1..80e285f856 100644
--- a/gdk/x11/gdkgc-x11.c
+++ b/gdk/x11/gdkgc-x11.c
@@ -12,8 +12,7 @@ static void gdk_x11_gc_values_to_xvalues (GdkGCValues *values,
XGCValues *xvalues,
unsigned long *xvalues_mask,
gboolean initial);
-
-static void gdk_x11_gc_destroy (GdkGC *gc);
+
static void gdk_x11_gc_get_values (GdkGC *gc,
GdkGCValues *values);
static void gdk_x11_gc_set_values (GdkGC *gc,
@@ -21,15 +20,70 @@ static void gdk_x11_gc_set_values (GdkGC *gc,
GdkGCValuesMask values_mask);
static void gdk_x11_gc_set_dashes (GdkGC *gc,
gint dash_offset,
- gchar dash_list[],
+ gint8 dash_list[],
gint n);
-static GdkGCClass gdk_x11_gc_class = {
- gdk_x11_gc_destroy,
- gdk_x11_gc_get_values,
- gdk_x11_gc_set_values,
- gdk_x11_gc_set_dashes
-};
+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,
+ "GdkGCX11",
+ &object_info);
+ }
+
+ return object_type;
+}
+
+static void
+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;
+ gc_class->set_values = gdk_x11_gc_set_values;
+ gc_class->set_dashes = gdk_x11_gc_set_dashes;
+}
+
+static void
+gdk_gc_x11_finalize (GObject *object)
+{
+ GdkGCX11 *x11_gc = GDK_GC_X11 (object);
+
+ if (x11_gc->clip_region)
+ gdk_region_destroy (x11_gc->clip_region);
+
+ XFreeGC (GDK_GC_XDISPLAY (x11_gc), GDK_GC_XGC (x11_gc));
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
GdkGC *
_gdk_x11_gc_new (GdkDrawable *drawable,
@@ -37,33 +91,34 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
- GdkGCPrivate *private;
- GdkGCXData *data;
+ GdkGCX11 *private;
XGCValues xvalues;
unsigned long xvalues_mask;
- gc = gdk_gc_alloc ();
- private = (GdkGCPrivate *)gc;
+ /* NOTICE that the drawable here has to be the impl drawable,
+ * not the publically-visible drawables.
+ */
+ g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_X11 (drawable), NULL);
- private->klass = &gdk_x11_gc_class;
- private->klass_data = data = g_new (GdkGCXData, 1);
+ gc = GDK_GC (g_type_create_instance (gdk_gc_x11_get_type ()));
+ private = GDK_GC_X11 (gc);
- data->dirty_mask = 0;
- data->clip_region = NULL;
+ private->dirty_mask = 0;
+ private->clip_region = NULL;
- GDK_GC_XDATA (gc)->xdisplay = GDK_DRAWABLE_XDISPLAY (drawable);
+ private->xdisplay = GDK_DRAWABLE_IMPL_X11 (drawable)->xdisplay;
if (values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
- data->dirty_mask |= GDK_GC_DIRTY_CLIP;
+ private->dirty_mask |= GDK_GC_DIRTY_CLIP;
}
if (values_mask & (GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN);
- data->dirty_mask |= GDK_GC_DIRTY_TS;
+ private->dirty_mask |= GDK_GC_DIRTY_TS;
}
xvalues.function = GXcopy;
@@ -75,62 +130,51 @@ _gdk_x11_gc_new (GdkDrawable *drawable,
gdk_x11_gc_values_to_xvalues (values, values_mask, &xvalues, &xvalues_mask, TRUE);
- data->xgc = XCreateGC (GDK_GC_XDISPLAY (gc),
- GDK_DRAWABLE_XID (drawable),
- xvalues_mask, &xvalues);
+ private->xgc = XCreateGC (GDK_GC_XDISPLAY (gc),
+ GDK_DRAWABLE_IMPL_X11 (drawable)->xid,
+ xvalues_mask, &xvalues);
return gc;
}
-static void
-gdk_x11_gc_destroy (GdkGC *gc)
-{
- if (GDK_GC_XDATA (gc)->clip_region)
- gdk_region_destroy (GDK_GC_XDATA (gc)->clip_region);
-
- XFreeGC (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc));
- g_free (GDK_GC_XDATA (gc));
-}
-
GC
_gdk_x11_gc_flush (GdkGC *gc)
{
- GdkGCPrivate *private = (GdkGCPrivate *)gc;
- GdkGCXData *data = GDK_GC_XDATA (gc);
+ GdkGCX11 *private = GDK_GC_X11 (gc);
- if (data->dirty_mask & GDK_GC_DIRTY_CLIP)
+ if (private->dirty_mask & GDK_GC_DIRTY_CLIP)
{
- if (!data->clip_region)
+ if (!private->clip_region)
XSetClipOrigin (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc),
- private->clip_x_origin, private->clip_y_origin);
+ gc->clip_x_origin, gc->clip_y_origin);
else
{
- XRectangle *rectangles = g_new (XRectangle, data->clip_region->numRects);
- GdkRegionBox *boxes = data->clip_region->rects;
+ XRectangle *rectangles = g_new (XRectangle, private->clip_region->numRects);
+ GdkRegionBox *boxes = private->clip_region->rects;
int i;
- for (i=0; i<data->clip_region->numRects; i++)
+ for (i=0; i<private->clip_region->numRects; i++)
{
- rectangles[i].x = CLAMP (boxes[i].x1 + private->clip_x_origin, G_MINSHORT, G_MAXSHORT);
- rectangles[i].y = CLAMP (boxes[i].y1 + private->clip_y_origin, G_MINSHORT, G_MAXSHORT);
- rectangles[i].width = CLAMP (boxes[i].x2 + private->clip_x_origin, G_MINSHORT, G_MAXSHORT) - rectangles[i].x;
- rectangles[i].height = CLAMP (boxes[i].y2 + private->clip_y_origin, G_MINSHORT, G_MAXSHORT) - rectangles[i].y;
+ rectangles[i].x = CLAMP (boxes[i].x1 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT);
+ rectangles[i].y = CLAMP (boxes[i].y1 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT);
+ rectangles[i].width = CLAMP (boxes[i].x2 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT) - rectangles[i].x;
+ rectangles[i].height = CLAMP (boxes[i].y2 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT) - rectangles[i].y;
}
XSetClipRectangles(GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), 0, 0, rectangles,
- data->clip_region->numRects, YXBanded);
+ private->clip_region->numRects, YXBanded);
g_free (rectangles);
}
}
- if (data->dirty_mask & GDK_GC_DIRTY_TS)
+ if (private->dirty_mask & GDK_GC_DIRTY_TS)
{
XSetTSOrigin (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc),
- private->ts_x_origin, private->ts_y_origin);
+ gc->ts_x_origin, gc->ts_y_origin);
}
- data->dirty_mask = 0;
+ private->dirty_mask = 0;
return GDK_GC_XGC (gc);
}
@@ -286,32 +330,32 @@ gdk_x11_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
- GdkGCXData *data;
+ GdkGCX11 *x11_gc;
XGCValues xvalues;
unsigned long xvalues_mask = 0;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
- data = GDK_GC_XDATA (gc);
+ x11_gc = GDK_GC_X11 (gc);
if (values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
- data->dirty_mask |= GDK_GC_DIRTY_CLIP;
+ x11_gc->dirty_mask |= GDK_GC_DIRTY_CLIP;
}
if (values_mask & (GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN);
- data->dirty_mask |= GDK_GC_DIRTY_TS;
+ x11_gc->dirty_mask |= GDK_GC_DIRTY_TS;
}
if (values_mask & GDK_GC_CLIP_MASK)
{
- if (data->clip_region)
+ if (x11_gc->clip_region)
{
- gdk_region_destroy (data->clip_region);
- data->clip_region = NULL;
+ gdk_region_destroy (x11_gc->clip_region);
+ x11_gc->clip_region = NULL;
}
}
@@ -326,10 +370,10 @@ gdk_x11_gc_set_values (GdkGC *gc,
static void
gdk_x11_gc_set_dashes (GdkGC *gc,
gint dash_offset,
- gchar dash_list[],
+ gint8 dash_list[],
gint n)
{
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (dash_list != NULL);
XSetDashes (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc),
@@ -343,6 +387,17 @@ gdk_x11_gc_values_to_xvalues (GdkGCValues *values,
unsigned long *xvalues_mask,
gboolean initial)
{
+ if (mask & GDK_GC_EXPOSURES)
+ xvalues->graphics_exposures = values->graphics_exposures;
+ else
+ xvalues->graphics_exposures = False;
+ *xvalues_mask |= GCGraphicsExposures;
+
+ /* Optimization for the common case (gdk_gc_new()) */
+ if (values == NULL ||
+ mask == 0)
+ return;
+
if (mask & GDK_GC_FOREGROUND)
{
xvalues->foreground = values->foreground.pixel;
@@ -560,64 +615,62 @@ void
gdk_gc_set_clip_rectangle (GdkGC *gc,
GdkRectangle *rectangle)
{
- GdkGCPrivate *private = (GdkGCPrivate *)gc;
- GdkGCXData *data;
+ GdkGCX11 *x11_gc;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
- data = GDK_GC_XDATA (gc);
+ x11_gc = GDK_GC_X11 (gc);
- if (data->clip_region)
- gdk_region_destroy (data->clip_region);
+ if (x11_gc->clip_region)
+ gdk_region_destroy (x11_gc->clip_region);
if (rectangle)
- data->clip_region = gdk_region_rectangle (rectangle);
+ x11_gc->clip_region = gdk_region_rectangle (rectangle);
else
{
- data->clip_region = NULL;
+ x11_gc->clip_region = NULL;
XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
}
- private->clip_x_origin = 0;
- private->clip_y_origin = 0;
+ gc->clip_x_origin = 0;
+ gc->clip_y_origin = 0;
- data->dirty_mask |= GDK_GC_DIRTY_CLIP;
+ x11_gc->dirty_mask |= GDK_GC_DIRTY_CLIP;
}
void
gdk_gc_set_clip_region (GdkGC *gc,
GdkRegion *region)
{
- GdkGCPrivate *private = (GdkGCPrivate *)gc;
- GdkGCXData *data;
+ GdkGCX11 *x11_gc;
- g_return_if_fail (gc != NULL);
+ g_return_if_fail (GDK_IS_GC (gc));
- data = GDK_GC_XDATA (gc);
+ x11_gc = GDK_GC_X11 (gc);
- if (data->clip_region)
- gdk_region_destroy (data->clip_region);
+ if (x11_gc->clip_region)
+ gdk_region_destroy (x11_gc->clip_region);
if (region)
- data->clip_region = gdk_region_copy (region);
+ x11_gc->clip_region = gdk_region_copy (region);
else
{
- data->clip_region = NULL;
+ x11_gc->clip_region = NULL;
XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
}
- private->clip_x_origin = 0;
- private->clip_y_origin = 0;
+ gc->clip_x_origin = 0;
+ gc->clip_y_origin = 0;
- data->dirty_mask |= GDK_GC_DIRTY_CLIP;
+ x11_gc->dirty_mask |= GDK_GC_DIRTY_CLIP;
}
void
gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc)
{
- g_return_if_fail (dst_gc != NULL);
- g_return_if_fail (src_gc != NULL);
+ g_return_if_fail (GDK_IS_GC_X11 (dst_gc));
+ g_return_if_fail (GDK_IS_GC_X11 (src_gc));
XCopyGC (GDK_GC_XDISPLAY (src_gc), GDK_GC_XGC (src_gc), ~((~1) << GCLastBit),
GDK_GC_XGC (dst_gc));
diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index 8bf26453f3..5cf3129462 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -62,10 +62,10 @@ struct _GdkWindowParentPos
GdkRectangle clip_rect;
};
-static void gdk_window_compute_position (GdkWindow *window,
+static void gdk_window_compute_position (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos,
GdkXPositionInfo *info);
-static void gdk_window_compute_parent_pos (GdkWindow *window,
+static void gdk_window_compute_parent_pos (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_premove (GdkWindow *window,
GdkWindowParentPos *parent_pos);
@@ -87,27 +87,26 @@ _gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowXData *data = (GdkWindowXData *)private->drawable.klass_data;
+ GdkWindowImplX11 *impl =
+ GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
- *x_offset = data->position_info.x_offset;
- *y_offset = data->position_info.y_offset;
+ *x_offset = impl->position_info.x_offset;
+ *y_offset = impl->position_info.y_offset;
}
void
_gdk_window_init_position (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowXData *data;
GdkWindowParentPos parent_pos;
-
- g_return_if_fail (window != NULL);
+ GdkWindowImplX11 *impl;
+
g_return_if_fail (GDK_IS_WINDOW (window));
-
- data = (GdkWindowXData *)private->drawable.klass_data;
-
- gdk_window_compute_parent_pos (window, &parent_pos);
- gdk_window_compute_position (window, &parent_pos, &data->position_info);
+
+ impl =
+ GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
+
+ gdk_window_compute_parent_pos (impl, &parent_pos);
+ gdk_window_compute_position (impl, &parent_pos, &impl->position_info);
}
/**
@@ -131,33 +130,33 @@ gdk_window_scroll (GdkWindow *window,
gint dx,
gint dy)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
gboolean can_guffaw_scroll = FALSE;
- GdkWindowXData *data;
+ GdkWindowImplX11 *impl;
+ GdkWindowObject *obj;
- g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ obj = GDK_WINDOW_OBJECT (window);
+
+ impl = GDK_WINDOW_IMPL_X11 (obj->impl);
+
+ if (GDK_WINDOW_DESTROYED (window))
return;
- data = (GdkWindowXData *)private->drawable.klass_data;
-
/* We can guffaw scroll if we are a child window, and the parent
* does not extend beyond our edges.
*/
-
- if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
{
- GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;
-
- can_guffaw_scroll = (private->x <= 0 &&
- private->y <= 0 &&
- private->x + private->drawable.width >= parent_private->drawable.width &&
- private->y + private->drawable.height >= parent_private->drawable.height);
+ GdkWindowImplX11 *parent_impl = GDK_WINDOW_IMPL_X11 (obj->parent->impl);
+ can_guffaw_scroll = (obj->x <= 0 &&
+ obj->y <= 0 &&
+ obj->x + impl->width >= parent_impl->width &&
+ obj->y + impl->height >= parent_impl->height);
}
- if (!private->children || !can_guffaw_scroll)
+ if (!obj->children || !can_guffaw_scroll)
{
/* Use XCopyArea, then move any children later
*/
@@ -165,12 +164,12 @@ gdk_window_scroll (GdkWindow *window,
GdkRegion *invalidate_region;
GdkRectangle dest_rect;
- invalidate_region = gdk_region_rectangle (&data->position_info.clip_rect);
+ invalidate_region = gdk_region_rectangle (&impl->position_info.clip_rect);
- dest_rect = data->position_info.clip_rect;
+ dest_rect = impl->position_info.clip_rect;
dest_rect.x += dx;
dest_rect.y += dy;
- gdk_rectangle_intersect (&dest_rect, &data->position_info.clip_rect, &dest_rect);
+ gdk_rectangle_intersect (&dest_rect, &impl->position_info.clip_rect, &dest_rect);
if (dest_rect.width > 0 && dest_rect.height > 0)
{
@@ -185,29 +184,30 @@ gdk_window_scroll (GdkWindow *window,
gdk_window_queue_translation (window, dx, dy);
values.graphics_exposures = True;
- gc = XCreateGC (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+ gc = XCreateGC (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
GCGraphicsExposures, &values);
- XCopyArea (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (window),
+ XCopyArea (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ GDK_WINDOW_XID (window),
gc,
dest_rect.x - dx, dest_rect.y - dy,
dest_rect.width, dest_rect.height,
dest_rect.x, dest_rect.y);
- XFreeGC (GDK_DRAWABLE_XDISPLAY (window), gc);
+ XFreeGC (GDK_WINDOW_XDISPLAY (window), gc);
}
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
- private = tmp_list->data;
+ GdkWindow * child = GDK_WINDOW (tmp_list->data);
- gdk_window_move (tmp_list->data, private->x + dx, private->y + dy);
+ gdk_window_move (child, obj->x + dx, obj->y + dy);
tmp_list = tmp_list->next;
}
@@ -227,10 +227,10 @@ _gdk_window_move_resize_child (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowImplX11 *impl;
+ GdkWindowObject *obj;
GdkXPositionInfo new_info;
GdkWindowParentPos parent_pos;
- GdkWindowXData *data;
GList *tmp_list;
gint d_xoffset, d_yoffset;
@@ -241,35 +241,36 @@ _gdk_window_move_resize_child (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- data = (GdkWindowXData *)private->drawable.klass_data;
-
- dx = x - private->x;
- dy = y - private->y;
+ impl = GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
+ obj = GDK_WINDOW_OBJECT (window);
+
+ dx = x - obj->x;
+ dy = y - obj->y;
is_move = dx != 0 || dy != 0;
- is_resize = private->drawable.width != width || private->drawable.height != height;
+ is_resize = impl->width != width || impl->height != height;
if (!is_move && !is_resize)
return;
- private->x = x;
- private->y = y;
- private->drawable.width = width;
- private->drawable.height = height;
+ obj->x = x;
+ obj->y = y;
+ impl->width = width;
+ impl->height = height;
- gdk_window_compute_parent_pos (window, &parent_pos);
- gdk_window_compute_position (window, &parent_pos, &new_info);
+ gdk_window_compute_parent_pos (impl, &parent_pos);
+ gdk_window_compute_position (impl, &parent_pos, &new_info);
- gdk_window_clip_changed (window, &data->position_info.clip_rect, &new_info.clip_rect);
+ gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
- parent_pos.x += private->x;
- parent_pos.y += private->y;
+ parent_pos.x += obj->x;
+ parent_pos.y += obj->y;
parent_pos.x11_x += new_info.x;
parent_pos.x11_y += new_info.y;
parent_pos.clip_rect = new_info.clip_rect;
- d_xoffset = new_info.x_offset - data->position_info.x_offset;
- d_yoffset = new_info.y_offset - data->position_info.y_offset;
+ d_xoffset = new_info.x_offset - impl->position_info.x_offset;
+ d_yoffset = new_info.y_offset - impl->position_info.y_offset;
if (d_xoffset != 0 || d_yoffset != 0)
{
@@ -282,57 +283,57 @@ _gdk_window_move_resize_child (GdkWindow *window,
if (d_xoffset < 0)
{
- new_x0 = data->position_info.x + d_xoffset;
- new_x1 = data->position_info.x + data->position_info.width;
+ new_x0 = impl->position_info.x + d_xoffset;
+ new_x1 = impl->position_info.x + impl->position_info.width;
}
else
{
- new_x0 = data->position_info.x;
- new_x1 = data->position_info.x + new_info.width + d_xoffset;
+ new_x0 = impl->position_info.x;
+ new_x1 = impl->position_info.x + new_info.width + d_xoffset;
}
if (d_yoffset < 0)
{
- new_y0 = data->position_info.y + d_yoffset;
- new_y1 = data->position_info.y + data->position_info.height;
+ new_y0 = impl->position_info.y + d_yoffset;
+ new_y1 = impl->position_info.y + impl->position_info.height;
}
else
{
- new_y0 = data->position_info.y;
- new_y1 = data->position_info.y + new_info.height + d_yoffset;
+ new_y0 = impl->position_info.y;
+ new_y1 = impl->position_info.y + new_info.height + d_yoffset;
}
- XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
new_x0, new_y0, new_x1 - new_x0, new_y1 - new_y0);
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_premove (tmp_list->data, &parent_pos);
tmp_list = tmp_list->next;
}
- XMoveWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XMoveWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
new_x0 + dx, new_y0 + dy);
if (d_xoffset > 0 || d_yoffset > 0)
gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
- XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
new_info.x, new_info.y, new_info.width, new_info.height);
- if (data->position_info.no_bg)
+ if (impl->position_info.no_bg)
gdk_window_tmp_reset_bg (window);
- if (!data->position_info.mapped && new_info.mapped && private->mapped)
- XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+ if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
+ XMapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
- data->position_info = new_info;
+ impl->position_info = new_info;
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_postmove (tmp_list->data, &parent_pos);
@@ -344,10 +345,10 @@ _gdk_window_move_resize_child (GdkWindow *window,
if (is_move && is_resize)
gdk_window_set_static_gravities (window, FALSE);
- if (data->position_info.mapped && !new_info.mapped)
- XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+ if (impl->position_info.mapped && !new_info.mapped)
+ XUnmapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_premove (tmp_list->data, &parent_pos);
@@ -355,87 +356,91 @@ _gdk_window_move_resize_child (GdkWindow *window,
}
if (is_resize)
- XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
new_info.x, new_info.y, new_info.width, new_info.height);
else
- XMoveWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XMoveWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
new_info.x, new_info.y);
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_postmove (tmp_list->data, &parent_pos);
tmp_list = tmp_list->next;
}
- if (data->position_info.no_bg)
+ if (impl->position_info.no_bg)
gdk_window_tmp_reset_bg (window);
- if (!data->position_info.mapped && new_info.mapped && private->mapped)
- XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+ if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
+ XMapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
- data->position_info = new_info;
+ impl->position_info = new_info;
}
}
static void
-gdk_window_compute_position (GdkWindow *window,
+gdk_window_compute_position (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos,
GdkXPositionInfo *info)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *wrapper;
int parent_x_offset;
int parent_y_offset;
+
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (window));
+
+ wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_X11 (window)->wrapper);
info->big = FALSE;
- if (private->drawable.width <= 32768)
+ if (window->width <= 32768)
{
- info->width = private->drawable.width;
- info->x = parent_pos->x + private->x - parent_pos->x11_x;
+ info->width = window->width;
+ info->x = parent_pos->x + wrapper->x - parent_pos->x11_x;
}
else
{
info->big = TRUE;
info->width = 32768;
- if (parent_pos->x + private->x < -16384)
+ if (parent_pos->x + wrapper->x < -16384)
{
- if (parent_pos->x + private->x + private->drawable.width < 16384)
- info->x = parent_pos->x + private->x + private->drawable.width - 32768 - parent_pos->x11_x;
+ if (parent_pos->x + wrapper->x + window->width < 16384)
+ info->x = parent_pos->x + wrapper->x + window->width - 32768 - parent_pos->x11_x;
else
info->x = -16384 - parent_pos->x11_y;
}
else
- info->x = parent_pos->x + private->x - parent_pos->x11_x;
+ info->x = parent_pos->x + wrapper->x - parent_pos->x11_x;
}
- if (private->drawable.height <= 32768)
+ if (window->height <= 32768)
{
- info->height = private->drawable.height;
- info->y = parent_pos->y + private->y - parent_pos->x11_y;
+ info->height = window->height;
+ info->y = parent_pos->y + wrapper->y - parent_pos->x11_y;
}
else
{
info->big = TRUE;
info->height = 32768;
- if (parent_pos->y + private->y < -16384)
+ if (parent_pos->y + wrapper->y < -16384)
{
- if (parent_pos->y + private->y + private->drawable.height < 16384)
- info->y = parent_pos->y + private->y + private->drawable.height - 32768 - parent_pos->x11_y;
+ if (parent_pos->y + wrapper->y + window->height < 16384)
+ info->y = parent_pos->y + wrapper->y + window->height - 32768 - parent_pos->x11_y;
else
info->y = -16384 - parent_pos->x11_y;
}
else
- info->y = parent_pos->y + private->y - parent_pos->x11_y;
+ info->y = parent_pos->y + wrapper->y - parent_pos->x11_y;
}
parent_x_offset = parent_pos->x11_x - parent_pos->x;
parent_y_offset = parent_pos->x11_y - parent_pos->y;
- info->x_offset = parent_x_offset + info->x - private->x;
- info->y_offset = parent_y_offset + info->y - private->y;
+ info->x_offset = parent_x_offset + info->x - wrapper->x;
+ info->y_offset = parent_y_offset + info->y - wrapper->y;
/* We don't considering the clipping of toplevel windows and their immediate children
* by their parents, and simply always map those windows.
@@ -446,24 +451,24 @@ gdk_window_compute_position (GdkWindow *window,
else if (info->x + parent_x_offset < parent_pos->clip_rect.x + parent_pos->clip_rect.width - 65536 ||
info->x + info->width + parent_x_offset > parent_pos->clip_rect.x + 65536 ||
info->y + parent_y_offset < parent_pos->clip_rect.y + parent_pos->clip_rect.height - 65536 ||
- info->y + info->width + parent_y_offset > parent_pos->clip_rect.y + 65536)
+ info->y + info->height + parent_y_offset > parent_pos->clip_rect.y + 65536)
info->mapped = FALSE;
else
info->mapped = TRUE;
info->no_bg = FALSE;
- if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+ if (GDK_WINDOW_TYPE (wrapper) == GDK_WINDOW_CHILD)
{
- info->clip_rect.x = private->x;
- info->clip_rect.y = private->y;
- info->clip_rect.width = private->drawable.width;
- info->clip_rect.height = private->drawable.height;
+ info->clip_rect.x = wrapper->x;
+ info->clip_rect.y = wrapper->y;
+ info->clip_rect.width = window->width;
+ info->clip_rect.height = window->height;
gdk_rectangle_intersect (&info->clip_rect, &parent_pos->clip_rect, &info->clip_rect);
- info->clip_rect.x -= private->x;
- info->clip_rect.y -= private->y;
+ info->clip_rect.x -= wrapper->x;
+ info->clip_rect.y -= wrapper->y;
}
else
{
@@ -475,16 +480,21 @@ gdk_window_compute_position (GdkWindow *window,
}
static void
-gdk_window_compute_parent_pos (GdkWindow *window,
+gdk_window_compute_parent_pos (GdkWindowImplX11 *window,
GdkWindowParentPos *parent_pos)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowXData *data;
+ GdkWindowObject *wrapper;
+ GdkWindowObject *parent;
GdkRectangle tmp_clip;
int clip_xoffset = 0;
int clip_yoffset = 0;
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (window));
+
+ wrapper =
+ GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_X11 (window)->wrapper);
+
parent_pos->x = 0;
parent_pos->y = 0;
parent_pos->x11_x = 0;
@@ -506,27 +516,27 @@ gdk_window_compute_parent_pos (GdkWindow *window,
parent_pos->clip_rect.width = G_MAXINT;
parent_pos->clip_rect.height = G_MAXINT;
- private = (GdkWindowPrivate *)private->parent;
- while (private && private->drawable.window_type == GDK_WINDOW_CHILD)
+ parent = (GdkWindowObject *)wrapper->parent;
+ while (parent && parent->window_type == GDK_WINDOW_CHILD)
{
- data = (GdkWindowXData *)private->drawable.klass_data;
-
+ GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (parent->impl);
+
tmp_clip.x = - clip_xoffset;
tmp_clip.y = - clip_yoffset;
- tmp_clip.width = private->drawable.width;
- tmp_clip.height = private->drawable.height;
+ tmp_clip.width = impl->width;
+ tmp_clip.height = impl->height;
gdk_rectangle_intersect (&parent_pos->clip_rect, &tmp_clip, &parent_pos->clip_rect);
- parent_pos->x += private->x;
- parent_pos->y += private->y;
- parent_pos->x11_x += data->position_info.x;
- parent_pos->x11_y += data->position_info.y;
+ parent_pos->x += parent->x;
+ parent_pos->y += parent->y;
+ parent_pos->x11_x += impl->position_info.x;
+ parent_pos->x11_y += impl->position_info.y;
- clip_xoffset += private->x;
- clip_yoffset += private->y;
+ clip_xoffset += parent->x;
+ clip_yoffset += parent->y;
- private = (GdkWindowPrivate *)private->parent;
+ parent = (GdkWindowObject *)parent->parent;
}
}
@@ -534,28 +544,31 @@ static void
gdk_window_premove (GdkWindow *window,
GdkWindowParentPos *parent_pos)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+ GdkWindowImplX11 *impl;
+ GdkWindowObject *obj;
GdkXPositionInfo new_info;
GList *tmp_list;
gint d_xoffset, d_yoffset;
GdkWindowParentPos this_pos;
+
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_X11 (obj->impl);
- gdk_window_compute_position (window, parent_pos, &new_info);
+ gdk_window_compute_position (impl, parent_pos, &new_info);
- gdk_window_clip_changed (window, &data->position_info.clip_rect, &new_info.clip_rect);
+ gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
- this_pos.x = parent_pos->x + private->x;
- this_pos.y = parent_pos->y + private->y;
+ this_pos.x = parent_pos->x + obj->x;
+ this_pos.y = parent_pos->y + obj->y;
this_pos.x11_x = parent_pos->x11_x + new_info.x;
this_pos.x11_y = parent_pos->x11_y + new_info.y;
this_pos.clip_rect = new_info.clip_rect;
- if (data->position_info.mapped && !new_info.mapped)
+ if (impl->position_info.mapped && !new_info.mapped)
XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
- d_xoffset = new_info.x_offset - data->position_info.x_offset;
- d_yoffset = new_info.y_offset - data->position_info.y_offset;
+ d_xoffset = new_info.x_offset - impl->position_info.x_offset;
+ d_yoffset = new_info.y_offset - impl->position_info.y_offset;
if (d_xoffset != 0 || d_yoffset != 0)
{
@@ -566,24 +579,24 @@ gdk_window_premove (GdkWindow *window,
if (d_xoffset < 0)
{
- new_x0 = data->position_info.x + d_xoffset;
- new_x1 = data->position_info.x + data->position_info.width;
+ new_x0 = impl->position_info.x + d_xoffset;
+ new_x1 = impl->position_info.x + impl->position_info.width;
}
else
{
- new_x0 = data->position_info.x;
- new_x1 = data->position_info.x + new_info.width + d_xoffset;
+ new_x0 = impl->position_info.x;
+ new_x1 = impl->position_info.x + new_info.width + d_xoffset;
}
if (d_yoffset < 0)
{
- new_y0 = data->position_info.y + d_yoffset;
- new_y1 = data->position_info.y + data->position_info.height;
+ new_y0 = impl->position_info.y + d_yoffset;
+ new_y1 = impl->position_info.y + impl->position_info.height;
}
else
{
- new_y0 = data->position_info.y;
- new_y1 = data->position_info.y + new_info.height + d_yoffset;
+ new_y0 = impl->position_info.y;
+ new_y1 = impl->position_info.y + new_info.height + d_yoffset;
}
XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
@@ -591,7 +604,7 @@ gdk_window_premove (GdkWindow *window,
new_x0, new_y0, new_x1 - new_x0, new_y1 - new_y0);
}
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_premove (tmp_list->data, &this_pos);
@@ -603,23 +616,26 @@ static void
gdk_window_postmove (GdkWindow *window,
GdkWindowParentPos *parent_pos)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowXData *data = (GdkWindowXData *)private->drawable.klass_data;
+ GdkWindowImplX11 *impl;
+ GdkWindowObject *obj;
GdkXPositionInfo new_info;
GList *tmp_list;
gint d_xoffset, d_yoffset;
GdkWindowParentPos this_pos;
+
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_X11 (obj->impl);
- gdk_window_compute_position (window, parent_pos, &new_info);
+ gdk_window_compute_position (impl, parent_pos, &new_info);
- this_pos.x = parent_pos->x + private->x;
- this_pos.y = parent_pos->y + private->y;
+ this_pos.x = parent_pos->x + obj->x;
+ this_pos.y = parent_pos->y + obj->y;
this_pos.x11_x = parent_pos->x11_x + new_info.x;
this_pos.x11_y = parent_pos->x11_y + new_info.y;
this_pos.clip_rect = new_info.clip_rect;
- d_xoffset = new_info.x_offset - data->position_info.x_offset;
- d_yoffset = new_info.y_offset - data->position_info.y_offset;
+ d_xoffset = new_info.x_offset - impl->position_info.x_offset;
+ d_yoffset = new_info.y_offset - impl->position_info.y_offset;
if (d_xoffset != 0 || d_yoffset != 0)
{
@@ -631,15 +647,15 @@ gdk_window_postmove (GdkWindow *window,
new_info.x, new_info.y, new_info.width, new_info.height);
}
- if (!data->position_info.mapped && new_info.mapped && private->mapped)
+ if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
- if (data->position_info.no_bg)
+ if (impl->position_info.no_bg)
gdk_window_tmp_reset_bg (window);
- data->position_info = new_info;
+ impl->position_info = new_info;
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_postmove (tmp_list->data, &this_pos);
@@ -684,12 +700,13 @@ _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area)
{
- GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+ GdkWindowImplX11 *impl;
GdkRegion *invalidate_region = gdk_region_rectangle (area);
GdkRegion *clip_region;
-
GSList *tmp_list = translate_queue;
+ impl = GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
+
while (tmp_list)
{
GdkWindowQueueItem *item = tmp_list->data;
@@ -720,7 +737,7 @@ _gdk_window_process_expose (GdkWindow *window,
}
}
- clip_region = gdk_region_rectangle (&data->position_info.clip_rect);
+ clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);
gdk_region_intersect (invalidate_region, clip_region);
if (!gdk_region_empty (invalidate_region))
@@ -733,12 +750,15 @@ _gdk_window_process_expose (GdkWindow *window,
static void
gdk_window_tmp_unset_bg (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+ GdkWindowImplX11 *impl;
+ GdkWindowObject *obj;
+
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_X11 (obj->impl);
- data->position_info.no_bg = TRUE;
+ impl->position_info.no_bg = TRUE;
- if (private->bg_pixmap != GDK_NO_BG)
+ if (obj->bg_pixmap != GDK_NO_BG)
XSetWindowBackgroundPixmap (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window), None);
}
@@ -746,22 +766,25 @@ gdk_window_tmp_unset_bg (GdkWindow *window)
static void
gdk_window_tmp_reset_bg (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+ GdkWindowImplX11 *impl;
+ GdkWindowObject *obj;
- data->position_info.no_bg = FALSE;
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_X11 (obj->impl);
- if (private->bg_pixmap == GDK_NO_BG)
+ impl->position_info.no_bg = FALSE;
+
+ if (obj->bg_pixmap == GDK_NO_BG)
return;
- if (private->bg_pixmap)
+ if (obj->bg_pixmap)
{
Pixmap xpixmap;
- if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG)
+ if (obj->bg_pixmap == GDK_PARENT_RELATIVE_BG)
xpixmap = ParentRelative;
else
- xpixmap = GDK_DRAWABLE_XID (private->bg_pixmap);
+ xpixmap = GDK_DRAWABLE_XID (obj->bg_pixmap);
XSetWindowBackgroundPixmap (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window), xpixmap);
@@ -770,28 +793,31 @@ gdk_window_tmp_reset_bg (GdkWindow *window)
{
XSetWindowBackground (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
- private->bg_color.pixel);
+ obj->bg_color.pixel);
}
}
static void
gdk_window_clip_changed (GdkWindow *window, GdkRectangle *old_clip, GdkRectangle *new_clip)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+ GdkWindowImplX11 *impl;
+ GdkWindowObject *obj;
GdkRegion *old_clip_region;
GdkRegion *new_clip_region;
-
- if (private->input_only)
+
+ if (((GdkWindowObject *)window)->input_only)
return;
-
+
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_X11 (obj->impl);
+
old_clip_region = gdk_region_rectangle (old_clip);
new_clip_region = gdk_region_rectangle (new_clip);
/* Trim invalid region of window to new clip rectangle
*/
- if (private->update_area)
- gdk_region_intersect (private->update_area, new_clip_region);
+ if (obj->update_area)
+ gdk_region_intersect (obj->update_area, new_clip_region);
/* Invalidate newly exposed portion of window
*/
diff --git a/gdk/x11/gdkglobals-x11.c b/gdk/x11/gdkglobals-x11.c
index 9a3d6c5f95..52d284861c 100644
--- a/gdk/x11/gdkglobals-x11.c
+++ b/gdk/x11/gdkglobals-x11.c
@@ -50,6 +50,6 @@ GdkICPrivate *gdk_xim_ic; /* currently using IC */
#endif /* USE_XIM */
GdkWindow *gdk_xim_window; /* currently using Widow */
-GdkWindowPrivate *gdk_xgrab_window = NULL; /* Window that currently holds the
- * x pointer grab
- */
+GdkWindowObject *gdk_xgrab_window = NULL; /* Window that currently holds the
+ * x pointer grab
+ */
diff --git a/gdk/x11/gdkim-x11.c b/gdk/x11/gdkim-x11.c
index 0d309a768d..f07f9b50c6 100644
--- a/gdk/x11/gdkim-x11.c
+++ b/gdk/x11/gdkim-x11.c
@@ -625,7 +625,7 @@ gdk_ic_new (GdkICAttr *attr, GdkICAttributesType mask)
}
if (attr->client_window == NULL ||
- GDK_DRAWABLE_DESTROYED (attr->client_window))
+ GDK_WINDOW_DESTROYED (attr->client_window))
{
g_warning ("Client_window is null or already destroyed.\n");
return NULL;
@@ -1084,7 +1084,7 @@ gdk_ic_set_attr (GdkIC *ic,
if (mask & GDK_IC_PREEDIT_PIXMAP)
{
if (attr->preedit_pixmap != NULL &&
- GDK_DRAWABLE_DESTROYED (attr->preedit_pixmap))
+ GDK_WINDOW_DESTROYED (attr->preedit_pixmap))
{
g_warning ("Preedit pixmap is already destroyed.\n");
error |= GDK_IC_PREEDIT_PIXMAP;
@@ -1171,7 +1171,7 @@ gdk_ic_set_attr (GdkIC *ic,
if (mask & GDK_IC_STATUS_PIXMAP)
{
if (attr->status_pixmap != NULL &&
- GDK_DRAWABLE_DESTROYED (attr->status_pixmap))
+ GDK_WINDOW_DESTROYED (attr->status_pixmap))
{
g_warning ("Preedit pixmap is already destroyed.\n");
error |= GDK_IC_STATUS_PIXMAP;
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
index 2972e7a4ee..e9730dba2e 100644
--- a/gdk/x11/gdkimage-x11.c
+++ b/gdk/x11/gdkimage-x11.c
@@ -58,37 +58,70 @@
#include "gdkprivate.h"
#include "gdkprivate-x11.h"
-static void gdk_x11_image_destroy (GdkImage *image);
-static void gdk_image_put_normal (GdkImage *image,
- GdkDrawable *drawable,
- GdkGC *gc,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_image_put_shared (GdkImage *image,
- GdkDrawable *drawable,
- GdkGC *gc,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-
-static GdkImageClass image_class_normal = {
- gdk_x11_image_destroy,
- gdk_image_put_normal
-};
-
-static GdkImageClass image_class_shared = {
- gdk_x11_image_destroy,
- gdk_image_put_shared
-};
-
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,
+ "GdkImage",
+ &object_info);
+ }
+
+ return object_type;
+}
+
+static void
+gdk_image_init (GdkImage *image)
+{
+ image->windowing_data = g_new0 (GdkImagePrivateX11, 1);
+
+}
+
+static void
+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;
+}
+
+static void
+gdk_image_finalize (GObject *object)
+{
+ GdkImage *image = GDK_IMAGE (object);
+
+ gdk_x11_image_destroy (image);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
void
@@ -111,12 +144,10 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
{
Visual *xvisual;
GdkImage *image;
- GdkImagePrivateX *private;
- private = g_new(GdkImagePrivateX, 1);
- image = (GdkImage *) private;
+ GdkImagePrivateX11 *private;
+ image = GDK_IMAGE (g_type_create_instance (gdk_image_get_type ()));
+ private = PRIVATE_DATA (image);
private->xdisplay = gdk_display;
- private->base.ref_count = 1;
- private->base.klass = &image_class_normal;
image->type = GDK_IMAGE_NORMAL;
image->visual = visual;
image->width = w;
@@ -160,7 +191,7 @@ gdk_image_check_xshm(Display *display)
}
void
-gdk_image_init (void)
+_gdk_windowing_image_init (void)
{
if (gdk_use_xshm)
{
@@ -178,7 +209,7 @@ gdk_image_new (GdkImageType type,
gint height)
{
GdkImage *image;
- GdkImagePrivateX *private;
+ GdkImagePrivateX11 *private;
#ifdef USE_SHM
XShmSegmentInfo *x_shm_info;
#endif /* USE_SHM */
@@ -194,10 +225,10 @@ gdk_image_new (GdkImageType type,
break;
default:
- private = g_new (GdkImagePrivateX, 1);
- image = (GdkImage*) private;
+ image = GDK_IMAGE (g_type_create_instance (gdk_image_get_type ()));
+
+ private = PRIVATE_DATA (image);
- private->base.ref_count = 1;
private->xdisplay = gdk_display;
image->type = type;
@@ -214,8 +245,6 @@ gdk_image_new (GdkImageType type,
#ifdef USE_SHM
if (gdk_use_xshm)
{
- private->base.klass = &image_class_shared;
-
private->x_shm_info = g_new (XShmSegmentInfo, 1);
x_shm_info = private->x_shm_info;
@@ -305,8 +334,6 @@ gdk_image_new (GdkImageType type,
return NULL;
#endif /* USE_SHM */
case GDK_IMAGE_NORMAL:
- private->base.klass = &image_class_normal;
-
private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
ZPixmap, 0, 0, width, height, 32, 0);
@@ -342,18 +369,16 @@ gdk_image_get (GdkWindow *window,
gint height)
{
GdkImage *image;
- GdkImagePrivateX *private;
+ GdkImagePrivateX11 *private;
- g_return_val_if_fail (window != NULL, NULL);
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
- private = g_new (GdkImagePrivateX, 1);
- image = (GdkImage*) private;
+ image = GDK_IMAGE (g_type_create_instance (gdk_image_get_type ()));
+ private = PRIVATE_DATA (image);
- private->base.ref_count = 1;
- private->base.klass = &image_class_normal;
private->xdisplay = gdk_display;
private->ximage = XGetImage (private->xdisplay,
GDK_DRAWABLE_XID (window),
@@ -387,11 +412,11 @@ gdk_image_get_pixel (GdkImage *image,
gint y)
{
guint32 pixel;
- GdkImagePrivateX *private;
+ GdkImagePrivateX11 *private;
- g_return_val_if_fail (image != NULL, 0);
+ g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
- private = (GdkImagePrivateX *) image;
+ private = PRIVATE_DATA (image);
pixel = XGetPixel (private->ximage, x, y);
@@ -404,11 +429,11 @@ gdk_image_put_pixel (GdkImage *image,
gint y,
guint32 pixel)
{
- GdkImagePrivateX *private;
+ GdkImagePrivateX11 *private;
- g_return_if_fail (image != NULL);
+ g_return_if_fail (GDK_IS_IMAGE (image));
- private = (GdkImagePrivateX *) image;
+ private = PRIVATE_DATA (image);
pixel = XPutPixel (private->ximage, x, y, pixel);
}
@@ -416,14 +441,21 @@ gdk_image_put_pixel (GdkImage *image,
static void
gdk_x11_image_destroy (GdkImage *image)
{
- GdkImagePrivateX *private;
+ GdkImagePrivateX11 *private;
#ifdef USE_SHM
XShmSegmentInfo *x_shm_info;
#endif /* USE_SHM */
- g_return_if_fail (image != NULL);
+ g_return_if_fail (GDK_IS_IMAGE (image));
- private = (GdkImagePrivateX*) 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;
+
switch (image->type)
{
case GDK_IMAGE_NORMAL:
@@ -441,7 +473,8 @@ gdk_x11_image_destroy (GdkImage *image)
shmdt (x_shm_info->shmaddr);
g_free (private->x_shm_info);
-
+ private->x_shm_info = NULL;
+
image_list = g_list_remove (image_list, image);
#else /* USE_SHM */
g_error ("trying to destroy shared memory image when gdk was compiled without shared memory support");
@@ -453,65 +486,6 @@ gdk_x11_image_destroy (GdkImage *image)
g_assert_not_reached ();
}
- g_free (image);
-}
-
-static void
-gdk_image_put_normal (GdkImage *image,
- GdkDrawable *drawable,
- GdkGC *gc,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkImagePrivateX *image_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
- image_private = (GdkImagePrivateX*) image;
-
- g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
-
- XPutImage (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
- GDK_GC_GET_XGC (gc), image_private->ximage,
- xsrc, ysrc, xdest, ydest, width, height);
-}
-
-static void
-gdk_image_put_shared (GdkImage *image,
- GdkDrawable *drawable,
- GdkGC *gc,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
-#ifdef USE_SHM
- GdkImagePrivateX *image_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- if (GDK_DRAWABLE_DESTROYED (drawable))
- return;
- image_private = (GdkImagePrivateX*) image;
-
- g_return_if_fail (image->type == GDK_IMAGE_SHARED);
-
- XShmPutImage (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
- GDK_GC_GET_XGC (gc), image_private->ximage,
- xsrc, ysrc, xdest, ydest, width, height, False);
-#else /* USE_SHM */
- g_error ("trying to draw shared memory image when gdk was compiled without shared memory support");
-#endif /* USE_SHM */
+ g_free (private);
+ image->windowing_data = NULL;
}
diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c
index cb2dd269c7..4ee51b3154 100644
--- a/gdk/x11/gdkinput.c
+++ b/gdk/x11/gdkinput.c
@@ -115,7 +115,7 @@ gdk_input_motion_events (GdkWindow *window,
g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
if (deviceid == GDK_CORE_POINTER)
@@ -200,15 +200,15 @@ void
gdk_input_set_extension_events (GdkWindow *window, gint mask,
GdkExtensionMode mode)
{
- GdkWindowPrivate *window_private;
+ GdkWindowObject *window_private;
GList *tmp_list;
GdkInputWindow *iw;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- window_private = (GdkWindowPrivate*) window;
- if (GDK_DRAWABLE_DESTROYED (window))
+ window_private = (GdkWindowObject*) window;
+ if (GDK_WINDOW_DESTROYED (window))
return;
if (mode == GDK_EXTENSION_EVENTS_NONE)
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
index 7ce8a3b35d..b266a67e22 100644
--- a/gdk/x11/gdkmain-x11.c
+++ b/gdk/x11/gdkmain-x11.c
@@ -49,6 +49,7 @@
#include "gdkprivate-x11.h"
#include "gdkinternals.h"
#include "gdkinputprivate.h"
+#include <pango/pangox.h>
typedef struct _GdkPredicate GdkPredicate;
typedef struct _GdkErrorTrap GdkErrorTrap;
@@ -246,12 +247,12 @@ gdk_pointer_grab (GdkWindow * window,
cursor_private = (GdkCursorPrivate*) cursor;
- xwindow = GDK_DRAWABLE_XID (window);
+ xwindow = GDK_WINDOW_XID (window);
- if (!confine_to || GDK_DRAWABLE_DESTROYED (confine_to))
+ if (!confine_to || GDK_WINDOW_DESTROYED (confine_to))
xconfine_to = None;
else
- xconfine_to = GDK_DRAWABLE_XID (confine_to);
+ xconfine_to = GDK_WINDOW_XID (confine_to);
if (!cursor)
xcursor = None;
@@ -277,8 +278,8 @@ gdk_pointer_grab (GdkWindow * window,
if (return_val == Success)
{
- if (!GDK_DRAWABLE_DESTROYED (window))
- return_val = XGrabPointer (GDK_DRAWABLE_XDISPLAY (window),
+ if (!GDK_WINDOW_DESTROYED (window))
+ return_val = XGrabPointer (GDK_WINDOW_XDISPLAY (window),
xwindow,
owner_events,
xevent_mask,
@@ -291,7 +292,7 @@ gdk_pointer_grab (GdkWindow * window,
}
if (return_val == GrabSuccess)
- gdk_xgrab_window = (GdkWindowPrivate *)window;
+ gdk_xgrab_window = (GdkWindowObject *)window;
return return_val;
}
@@ -370,9 +371,9 @@ gdk_keyboard_grab (GdkWindow * window,
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
- if (!GDK_DRAWABLE_DESTROYED (window))
- return XGrabKeyboard (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ if (!GDK_WINDOW_DESTROYED (window))
+ return XGrabKeyboard (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
owner_events,
GrabModeAsync, GrabModeAsync,
time);
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
index 326d0702be..b8ee30872a 100644
--- a/gdk/x11/gdkpixmap-x11.c
+++ b/gdk/x11/gdkpixmap-x11.c
@@ -32,7 +32,8 @@
#include <unistd.h>
#include <X11/Xlib.h>
-#include "gdkpixmap.h"
+#include <gdk/gdkpixmap.h>
+#include "gdkpixmap-x11.h"
#include "gdkprivate-x11.h"
typedef struct
@@ -49,42 +50,92 @@ typedef struct
gulong pixels[1];
} _GdkPixmapInfo;
-GdkDrawableClass _gdk_x11_pixmap_class;
+static void gdk_pixmap_impl_x11_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
-static void
-gdk_x11_pixmap_destroy (GdkPixmap *pixmap)
-{
- XFreePixmap (GDK_DRAWABLE_XDISPLAY (pixmap), GDK_DRAWABLE_XID (pixmap));
- gdk_xid_table_remove (GDK_DRAWABLE_XID (pixmap));
+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_finalize (GObject *object);
- g_free (GDK_DRAWABLE_XDATA (pixmap));
-}
+static gpointer parent_class = NULL;
-static GdkDrawable *
-gdk_x11_pixmap_alloc (void)
+GType
+gdk_pixmap_impl_x11_get_type (void)
{
- GdkDrawable *drawable;
- GdkDrawablePrivate *private;
-
- static GdkDrawableClass klass;
- static gboolean initialized = FALSE;
+ static GType object_type = 0;
- if (!initialized)
+ if (!object_type)
{
- initialized = TRUE;
+ 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,
+ };
- klass = _gdk_x11_drawable_class;
- klass.destroy = gdk_x11_pixmap_destroy;
+ object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_X11,
+ "GdkPixmapImplX11",
+ &object_info);
}
+
+ return object_type;
+}
- drawable = gdk_drawable_alloc ();
- private = (GdkDrawablePrivate *)drawable;
- private->klass = &klass;
- private->klass_data = g_new (GdkDrawableXData, 1);
- private->window_type = GDK_DRAWABLE_PIXMAP;
+GType
+_gdk_pixmap_impl_get_type (void)
+{
+ return gdk_pixmap_impl_x11_get_type ();
+}
+
+static void
+gdk_pixmap_impl_x11_init (GdkPixmapImplX11 *impl)
+{
+ impl->width = 1;
+ impl->height = 1;
+}
+
+static void
+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->finalize = gdk_pixmap_impl_x11_finalize;
+
+ drawable_class->get_size = gdk_pixmap_impl_x11_get_size;
+}
+
+static void
+gdk_pixmap_impl_x11_finalize (GObject *object)
+{
+ GdkPixmapImplX11 *impl = GDK_PIXMAP_IMPL_X11 (object);
+ GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_X11 (impl)->wrapper);
+
+ XFreePixmap (GDK_PIXMAP_XDISPLAY (wrapper), GDK_PIXMAP_XID (wrapper));
+ gdk_xid_table_remove (GDK_PIXMAP_XID (wrapper));
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
- return drawable;
+static void
+gdk_pixmap_impl_x11_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height)
+{
+ if (width)
+ *width = GDK_PIXMAP_IMPL_X11 (drawable)->width;
+ if (height)
+ *height = GDK_PIXMAP_IMPL_X11 (drawable)->height;
}
GdkPixmap*
@@ -94,8 +145,9 @@ gdk_pixmap_new (GdkWindow *window,
gint depth)
{
GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
-
+ GdkDrawableImplX11 *draw_impl;
+ GdkPixmapImplX11 *pix_impl;
+
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
@@ -103,24 +155,27 @@ gdk_pixmap_new (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
if (depth == -1)
- depth = gdk_drawable_get_visual (window)->depth;
+ depth = gdk_drawable_get_depth (GDK_DRAWABLE (window));
- pixmap = gdk_x11_pixmap_alloc ();
- private = (GdkDrawablePrivate *)pixmap;
-
- GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
- GDK_DRAWABLE_XDATA (private)->xid = XCreatePixmap (GDK_DRAWABLE_XDISPLAY (pixmap),
- GDK_DRAWABLE_XID (window),
- width, height, depth);
- private->width = width;
- private->height = height;
- private->depth = depth;
+ pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ pix_impl = GDK_PIXMAP_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+
+ draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (window);
+ draw_impl->xid = XCreatePixmap (GDK_PIXMAP_XDISPLAY (pixmap),
+ GDK_WINDOW_XID (window),
+ width, height, depth);
+
+ pix_impl->width = width;
+ pix_impl->height = height;
+ GDK_PIXMAP_OBJECT (pixmap)->depth = depth;
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
+ gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
return pixmap;
}
@@ -132,8 +187,9 @@ gdk_bitmap_create_from_data (GdkWindow *window,
gint height)
{
GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
-
+ GdkDrawableImplX11 *draw_impl;
+ GdkPixmapImplX11 *pix_impl;
+
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
@@ -141,23 +197,25 @@ gdk_bitmap_create_from_data (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
- pixmap = gdk_x11_pixmap_alloc ();
- private = (GdkDrawablePrivate *)pixmap;
+ pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ pix_impl = GDK_PIXMAP_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (pixmap);
- private->width = width;
- private->height = height;
- private->depth = 1;
+ pix_impl->width = width;
+ pix_impl->height = height;
+ GDK_PIXMAP_OBJECT (pixmap)->depth = 1;
- GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
- GDK_DRAWABLE_XDATA (private)->xid = XCreateBitmapFromData (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
- (char *)data, width, height);
-
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
+ draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (window);
+ draw_impl->xid = XCreateBitmapFromData (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ (char *)data, width, height);
+ gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
+
return pixmap;
}
@@ -171,7 +229,8 @@ gdk_pixmap_create_from_data (GdkWindow *window,
GdkColor *bg)
{
GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
+ GdkDrawableImplX11 *draw_impl;
+ GdkPixmapImplX11 *pix_impl;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (data != NULL, NULL);
@@ -183,26 +242,28 @@ gdk_pixmap_create_from_data (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
if (depth == -1)
depth = gdk_drawable_get_visual (window)->depth;
- pixmap = gdk_x11_pixmap_alloc ();
- private = (GdkDrawablePrivate *)pixmap;
-
- private->width = width;
- private->height = height;
- private->depth = depth;
+ pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ pix_impl = GDK_PIXMAP_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+
+ pix_impl->width = width;
+ pix_impl->height = height;
+ GDK_PIXMAP_OBJECT (pixmap)->depth = depth;
- GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
- GDK_DRAWABLE_XDATA (private)->xid = XCreatePixmapFromBitmapData (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
- (char *)data, width, height,
- fg->pixel, bg->pixel, depth);
+ draw_impl->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
+ draw_impl->xid = XCreatePixmapFromBitmapData (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ (char *)data, width, height,
+ fg->pixel, bg->pixel, depth);
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
+ gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
return pixmap;
}
@@ -483,7 +544,7 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
visual = gdk_drawable_get_visual (window);
}
else
- visual = ((GdkColormapPrivate *)colormap)->visual;
+ visual = colormap->visual;
buffer = (*get_buf) (op_header, handle);
if (buffer == NULL)
@@ -779,7 +840,8 @@ GdkPixmap*
gdk_pixmap_foreign_new (GdkNativeWindow anid)
{
GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
+ GdkDrawableImplX11 *draw_impl;
+ GdkPixmapImplX11 *pix_impl;
Pixmap xpixmap;
Window root_return;
unsigned int x_ret, y_ret, w_ret, h_ret, bw_ret, depth_ret;
@@ -797,18 +859,21 @@ gdk_pixmap_foreign_new (GdkNativeWindow anid)
xpixmap, &root_return,
&x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
return NULL;
-
- pixmap = gdk_x11_pixmap_alloc ();
- private = (GdkDrawablePrivate *)pixmap;
- GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DISPLAY ();
- GDK_DRAWABLE_XDATA (private)->xid = xpixmap;
+ pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ pix_impl = GDK_PIXMAP_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+
+
+ draw_impl->xdisplay = GDK_DISPLAY ();
+ draw_impl->xid = xpixmap;
- private->width = w_ret;
- private->height = h_ret;
- private->depth = depth_ret;
+ pix_impl->width = w_ret;
+ pix_impl->height = h_ret;
+ GDK_PIXMAP_OBJECT (pixmap)->depth = depth_ret;
- gdk_xid_table_insert(&GDK_DRAWABLE_XID (pixmap), pixmap);
+ gdk_xid_table_insert(&GDK_PIXMAP_XID (pixmap), pixmap);
return pixmap;
}
diff --git a/gdk/x11/gdkpixmap-x11.h b/gdk/x11/gdkpixmap-x11.h
new file mode 100644
index 0000000000..0087553ba7
--- /dev/null
+++ b/gdk/x11/gdkpixmap-x11.h
@@ -0,0 +1,70 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GDK_PIXMAP_X11_H__
+#define __GDK_PIXMAP_X11_H__
+
+#include <gdk/x11/gdkdrawable-x11.h>
+#include <gdk/gdkpixmap.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Pixmap implementation for X11
+ */
+
+typedef struct _GdkPixmapImplX11 GdkPixmapImplX11;
+typedef struct _GdkPixmapImplX11Class GdkPixmapImplX11Class;
+
+#define GDK_TYPE_PIXMAP_IMPL_X11 (gdk_pixmap_impl_x11_get_type ())
+#define GDK_PIXMAP_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP_IMPL_X11, GdkPixmapImplX11))
+#define GDK_PIXMAP_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP_IMPL_X11, GdkPixmapImplX11Class))
+#define GDK_IS_PIXMAP_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP_IMPL_X11))
+#define GDK_IS_PIXMAP_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP_IMPL_X11))
+#define GDK_PIXMAP_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP_IMPL_X11, GdkPixmapImplX11Class))
+
+struct _GdkPixmapImplX11
+{
+ GdkDrawableImplX11 parent_instance;
+
+ gint width;
+ gint height;
+};
+
+struct _GdkPixmapImplX11Class
+{
+ GdkDrawableImplX11Class parent_class;
+
+};
+
+GType gdk_pixmap_impl_x11_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GDK_PIXMAP_X11_H__ */
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index e61e7e28c6..5c84355fd7 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -63,16 +63,15 @@ Window gdk_window_xid_at_coords (gint x,
gboolean excl_child);
/* Routines from gdkgeometry-x11.c */
-
-void _gdk_window_init_position (GdkWindow *window);
-void _gdk_window_move_resize_child (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void _gdk_window_process_expose (GdkWindow *window,
- gulong serial,
- GdkRectangle *area);
+void _gdk_window_init_position (GdkWindow *window);
+void _gdk_window_move_resize_child (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void _gdk_window_process_expose (GdkWindow *window,
+ gulong serial,
+ GdkRectangle *area);
extern GdkDrawableClass _gdk_x11_drawable_class;
extern gboolean gdk_use_xshm;
@@ -85,9 +84,9 @@ extern gboolean gdk_null_window_warnings;
extern const int gdk_nevent_masks;
extern const int gdk_event_mask_table[];
-extern GdkWindowPrivate *gdk_xgrab_window; /* Window that currently holds the
- * x pointer grab
- */
+extern GdkWindowObject *gdk_xgrab_window; /* Window that currently holds the
+ * x pointer grab
+ */
#ifdef USE_XIM
extern GdkICPrivate *gdk_xim_ic; /* currently using IC */
diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c
index 58b51a9712..4d338fe95b 100644
--- a/gdk/x11/gdkproperty-x11.c
+++ b/gdk/x11/gdkproperty-x11.c
@@ -117,11 +117,11 @@ gdk_property_get (GdkWindow *window,
if (window)
{
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return FALSE;
- xdisplay = GDK_DRAWABLE_XDISPLAY (window);
- xwindow = GDK_DRAWABLE_XID (window);
+ xdisplay = GDK_WINDOW_XDISPLAY (window);
+ xwindow = GDK_WINDOW_XID (window);
}
else
{
@@ -206,11 +206,11 @@ gdk_property_change (GdkWindow *window,
if (window)
{
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- xdisplay = GDK_DRAWABLE_XDISPLAY (window);
- xwindow = GDK_DRAWABLE_XID (window);
+ xdisplay = GDK_WINDOW_XDISPLAY (window);
+ xwindow = GDK_WINDOW_XID (window);
}
else
{
@@ -234,11 +234,11 @@ gdk_property_delete (GdkWindow *window,
if (window)
{
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- xdisplay = GDK_DRAWABLE_XDISPLAY (window);
- xwindow = GDK_DRAWABLE_XID (window);
+ xdisplay = GDK_WINDOW_XDISPLAY (window);
+ xwindow = GDK_WINDOW_XID (window);
}
else
{
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c
index 31a6eb0b91..f0916db072 100644
--- a/gdk/x11/gdkselection-x11.c
+++ b/gdk/x11/gdkselection-x11.c
@@ -45,11 +45,11 @@ gdk_selection_owner_set (GdkWindow *owner,
if (owner)
{
- if (GDK_DRAWABLE_DESTROYED (owner))
+ if (GDK_WINDOW_DESTROYED (owner))
return FALSE;
- xdisplay = GDK_DRAWABLE_XDISPLAY (owner);
- xwindow = GDK_DRAWABLE_XID (owner);
+ xdisplay = GDK_WINDOW_XDISPLAY (owner);
+ xwindow = GDK_WINDOW_XID (owner);
}
else
{
@@ -80,11 +80,11 @@ gdk_selection_convert (GdkWindow *requestor,
GdkAtom target,
guint32 time)
{
- if (GDK_DRAWABLE_DESTROYED (requestor))
+ if (GDK_WINDOW_DESTROYED (requestor))
return;
- XConvertSelection (GDK_DRAWABLE_XDISPLAY (requestor), selection, target,
- gdk_selection_property, GDK_DRAWABLE_XID (requestor), time);
+ XConvertSelection (GDK_WINDOW_XDISPLAY (requestor), selection, target,
+ gdk_selection_property, GDK_WINDOW_XID (requestor), time);
}
gint
@@ -107,12 +107,12 @@ gdk_selection_property_get (GdkWindow *requestor,
should be) it would be a win to try first with a buffer of
moderate length, to avoid two round trips to the server */
- if (GDK_DRAWABLE_DESTROYED (requestor))
+ if (GDK_WINDOW_DESTROYED (requestor))
return 0;
t = NULL;
- XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (requestor),
- GDK_DRAWABLE_XID (requestor),
+ XGetWindowProperty (GDK_WINDOW_XDISPLAY (requestor),
+ GDK_WINDOW_XID (requestor),
gdk_selection_property, 0, 0, False,
AnyPropertyType, &prop_type, &prop_format,
&nitems, &nbytes, &t);
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index fe6da9b237..8f6964101a 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -37,6 +37,7 @@
#include "gdkregion.h"
#include "gdkinternals.h"
#include "MwmUtil.h"
+#include "gdkwindow-x11.h"
#include <stdlib.h>
#include <stdio.h>
@@ -79,79 +80,192 @@ static void gdk_window_set_static_win_gravity (GdkWindow *window,
gboolean on);
static gboolean gdk_window_have_shape_ext (void);
-GdkDrawableClass _gdk_windowing_window_class;
+static GdkColormap* gdk_window_impl_x11_get_colormap (GdkDrawable *drawable);
+static void gdk_window_impl_x11_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap);
+static void gdk_window_impl_x11_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+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 void
-gdk_x11_window_destroy (GdkDrawable *drawable)
+static gpointer parent_class = NULL;
+
+GType
+gdk_window_impl_x11_get_type (void)
{
- if (!GDK_DRAWABLE_DESTROYED (drawable))
+ static GType object_type = 0;
+
+ if (!object_type)
{
- if (GDK_DRAWABLE_TYPE (drawable) != GDK_WINDOW_FOREIGN)
- {
- g_warning ("losing last reference to undestroyed window\n");
- _gdk_window_destroy (drawable, FALSE);
- }
- else
- /* We use TRUE here, to keep us from actually calling
- * XDestroyWindow() on the window
- */
- _gdk_window_destroy (drawable, TRUE);
+ 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,
+ };
- gdk_xid_table_remove (GDK_DRAWABLE_XID (drawable));
+ object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_X11,
+ "GdkWindowImplX11",
+ &object_info);
}
+
+ return object_type;
+}
+
+GType
+_gdk_window_impl_get_type (void)
+{
+ return gdk_window_impl_x11_get_type ();
+}
- g_free (GDK_DRAWABLE_XDATA (drawable));
+static void
+gdk_window_impl_x11_init (GdkWindowImplX11 *impl)
+{
+ impl->width = 1;
+ impl->height = 1;
}
-static GdkWindow *
-gdk_x11_window_alloc (void)
+static void
+gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
{
- GdkWindow *window;
- GdkWindowPrivate *private;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
- static gboolean initialized = FALSE;
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gdk_window_impl_x11_finalize;
- if (!initialized)
+ drawable_class->set_colormap = gdk_window_impl_x11_set_colormap;
+ drawable_class->get_colormap = gdk_window_impl_x11_get_colormap;
+ drawable_class->get_size = gdk_window_impl_x11_get_size;
+}
+
+static void
+gdk_window_impl_x11_finalize (GObject *object)
+{
+ GdkWindowObject *wrapper;
+ GdkDrawableImplX11 *draw_impl;
+ GdkWindowImplX11 *window_impl;
+
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (object));
+
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (object);
+ window_impl = GDK_WINDOW_IMPL_X11 (object);
+
+ wrapper = (GdkWindowObject*) draw_impl->wrapper;
+
+ if (!GDK_WINDOW_DESTROYED (wrapper))
{
- initialized = TRUE;
+ gdk_xid_table_remove (draw_impl->xid);
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
- _gdk_windowing_window_class = _gdk_x11_drawable_class;
- _gdk_windowing_window_class.destroy = gdk_x11_window_destroy;
+static GdkColormap*
+gdk_window_impl_x11_get_colormap (GdkDrawable *drawable)
+{
+ GdkDrawableImplX11 *drawable_impl;
+ GdkWindowImplX11 *window_impl;
+
+ g_return_val_if_fail (GDK_IS_WINDOW_IMPL_X11 (drawable), NULL);
+
+ drawable_impl = GDK_DRAWABLE_IMPL_X11 (drawable);
+ window_impl = GDK_WINDOW_IMPL_X11 (drawable);
+
+ if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only &&
+ drawable_impl->colormap == NULL)
+ {
+ XWindowAttributes window_attributes;
+
+ XGetWindowAttributes (drawable_impl->xdisplay,
+ drawable_impl->xid,
+ &window_attributes);
+ drawable_impl->colormap =
+ gdk_colormap_lookup (window_attributes.colormap);
}
+
+ return drawable_impl->colormap;
+}
+
+static void
+gdk_window_impl_x11_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap)
+{
+ GdkWindowImplX11 *impl;
+ GdkDrawableImplX11 *draw_impl;
+
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (drawable));
+ g_return_if_fail (gdk_colormap_get_visual (cmap) != gdk_drawable_get_visual (drawable));
- window = _gdk_window_alloc ();
- private = (GdkWindowPrivate *)window;
+ impl = GDK_WINDOW_IMPL_X11 (drawable);
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (drawable);
- private->drawable.klass = &_gdk_window_class;
- private->drawable.klass_data = g_new (GdkWindowXData, 1);
+ GDK_DRAWABLE_GET_CLASS (draw_impl)->set_colormap (drawable, cmap);
+
+ XSetWindowColormap (draw_impl->xdisplay,
+ draw_impl->xid,
+ GDK_COLORMAP_XCOLORMAP (cmap));
- return window;
+ if (((GdkWindowObject*)draw_impl->wrapper)->window_type !=
+ GDK_WINDOW_TOPLEVEL)
+ gdk_window_add_colormap_windows (GDK_WINDOW (draw_impl->wrapper));
+}
+
+
+static void
+gdk_window_impl_x11_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height)
+{
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_X11 (drawable));
+
+ if (width)
+ *width = GDK_WINDOW_IMPL_X11 (drawable)->width;
+ if (height)
+ *height = GDK_WINDOW_IMPL_X11 (drawable)->height;
}
void
-gdk_window_init (void)
+_gdk_windowing_window_init (void)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
+ GdkWindowImplX11 *impl;
+ GdkDrawableImplX11 *draw_impl;
XWindowAttributes xattributes;
unsigned int width;
unsigned int height;
unsigned int border_width;
unsigned int depth;
int x, y;
+
+ g_assert (gdk_parent_root == NULL);
XGetGeometry (gdk_display, gdk_root_window, &gdk_root_window,
&x, &y, &width, &height, &border_width, &depth);
XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
- gdk_parent_root = gdk_x11_window_alloc ();
- private = (GdkWindowPrivate *)gdk_parent_root;
+ gdk_parent_root = GDK_WINDOW (g_type_create_instance (GDK_TYPE_WINDOW));
+ private = (GdkWindowObject *)gdk_parent_root;
+ impl = GDK_WINDOW_IMPL_X11 (private->impl);
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
- GDK_DRAWABLE_XDATA (gdk_parent_root)->xdisplay = gdk_display;
- GDK_DRAWABLE_XDATA (gdk_parent_root)->xid = gdk_root_window;
-
- private->drawable.window_type = GDK_WINDOW_ROOT;
- private->drawable.width = width;
- private->drawable.height = height;
+ draw_impl->xdisplay = gdk_display;
+ draw_impl->xid = gdk_root_window;
+ draw_impl->wrapper = GDK_DRAWABLE (private);
+
+ private->window_type = GDK_WINDOW_ROOT;
+ private->depth = depth;
+ impl->width = width;
+ impl->height = height;
gdk_xid_table_insert (&gdk_root_window, gdk_parent_root);
}
@@ -164,8 +278,10 @@ gdk_window_new (GdkWindow *parent,
gint attributes_mask)
{
GdkWindow *window;
- GdkWindowPrivate *private;
- GdkWindowPrivate *parent_private;
+ GdkWindowObject *private;
+ GdkWindowObject *parent_private;
+ GdkWindowImplX11 *impl;
+ GdkDrawableImplX11 *draw_impl;
GdkVisual *visual;
Window xparent;
@@ -186,19 +302,24 @@ gdk_window_new (GdkWindow *parent,
if (!parent)
parent = gdk_parent_root;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
- parent_private = (GdkWindowPrivate*) parent;
- if (GDK_DRAWABLE_DESTROYED (parent))
+ parent_private = (GdkWindowObject*) parent;
+ if (GDK_WINDOW_DESTROYED (parent))
return NULL;
- xparent = GDK_DRAWABLE_XID (parent);
+ xparent = GDK_WINDOW_XID (parent);
- window = gdk_x11_window_alloc ();
- private = (GdkWindowPrivate *)window;
-
- GDK_DRAWABLE_XDATA (window)->xdisplay = GDK_DRAWABLE_XDISPLAY (parent);
+ window = GDK_WINDOW (g_type_create_instance (GDK_TYPE_WINDOW));
+ private = (GdkWindowObject *)window;
+ impl = GDK_WINDOW_IMPL_X11 (private->impl);
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (window);
+
+ draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (parent);
- private->parent = parent;
+ private->parent = (GdkWindowObject *)parent;
xattributes_mask = 0;
@@ -214,12 +335,12 @@ gdk_window_new (GdkWindow *parent,
private->x = x;
private->y = y;
- private->drawable.width = (attributes->width > 1) ? (attributes->width) : (1);
- private->drawable.height = (attributes->height > 1) ? (attributes->height) : (1);
- private->drawable.window_type = attributes->window_type;
+ impl->width = (attributes->width > 1) ? (attributes->width) : (1);
+ impl->height = (attributes->height > 1) ? (attributes->height) : (1);
+ private->window_type = attributes->window_type;
- _gdk_window_init_position (window);
- if (GDK_WINDOW_XDATA (window)->position_info.big)
+ _gdk_window_init_position (GDK_WINDOW (private));
+ if (impl->position_info.big)
private->guffaw_gravity = TRUE;
if (attributes_mask & GDK_WA_VISUAL)
@@ -259,16 +380,26 @@ gdk_window_new (GdkWindow *parent,
depth = visual->depth;
private->input_only = FALSE;
- private->drawable.depth = depth;
+ private->depth = depth;
if (attributes_mask & GDK_WA_COLORMAP)
- private->drawable.colormap = attributes->colormap;
+ {
+ draw_impl->colormap = attributes->colormap;
+ gdk_colormap_ref (attributes->colormap);
+ }
else
{
if ((((GdkVisualPrivate*)gdk_visual_get_system ())->xvisual) == xvisual)
- private->drawable.colormap = gdk_colormap_get_system ();
+ {
+ draw_impl->colormap =
+ gdk_colormap_get_system ();
+ gdk_colormap_ref (draw_impl->colormap);
+ }
else
- private->drawable.colormap = gdk_colormap_new (visual, False);
+ {
+ draw_impl->colormap =
+ gdk_colormap_new (visual, FALSE);
+ }
}
private->bg_color.pixel = BlackPixel (gdk_display, gdk_screen);
@@ -286,29 +417,29 @@ gdk_window_new (GdkWindow *parent,
xattributes_mask |= CWBitGravity;
- switch (private->drawable.window_type)
+ switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
- xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+ xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
xparent = gdk_root_window;
break;
case GDK_WINDOW_CHILD:
- xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+ xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
break;
case GDK_WINDOW_DIALOG:
- xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+ xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
xparent = gdk_root_window;
break;
case GDK_WINDOW_TEMP:
- xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+ xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
xattributes_mask |= CWColormap;
xparent = gdk_root_window;
@@ -321,29 +452,26 @@ gdk_window_new (GdkWindow *parent,
case GDK_WINDOW_ROOT:
g_error ("cannot make windows of type GDK_WINDOW_ROOT");
break;
- case GDK_WINDOW_PIXMAP:
- g_error ("cannot make windows of type GDK_WINDOW_PIXMAP (use gdk_pixmap_new)");
- break;
}
}
else
{
depth = 0;
+ private->depth = 0;
class = InputOnly;
private->input_only = TRUE;
- private->drawable.colormap = NULL;
+ draw_impl->colormap = NULL;
}
- GDK_DRAWABLE_XDATA (private)->xid = XCreateWindow (GDK_DRAWABLE_XDISPLAY (parent),
- xparent,
- x, y, private->drawable.width, private->drawable.height,
- 0, depth, class, xvisual,
- xattributes_mask, &xattributes);
+ draw_impl->xid = XCreateWindow (GDK_WINDOW_XDISPLAY (parent),
+ xparent,
+ x, y,
+ impl->width, impl->height,
+ 0, depth, class, xvisual,
+ xattributes_mask, &xattributes);
+
gdk_drawable_ref (window);
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (window), window);
-
- if (private->drawable.colormap)
- gdk_colormap_ref (private->drawable.colormap);
+ gdk_xid_table_insert (&GDK_WINDOW_XID (window), window);
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
@@ -352,22 +480,22 @@ gdk_window_new (GdkWindow *parent,
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
- switch (private->drawable.window_type)
+ switch (GDK_WINDOW_TYPE (private))
{
case GDK_WINDOW_DIALOG:
- XSetTransientForHint (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetTransientForHint (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
xparent);
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP:
- XSetWMProtocols (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetWMProtocols (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
gdk_wm_window_protocols, 2);
break;
case GDK_WINDOW_CHILD:
if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
- (private->drawable.colormap != gdk_colormap_get_system ()) &&
- (private->drawable.colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
+ (draw_impl->colormap != gdk_colormap_get_system ()) &&
+ (draw_impl->colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
{
GDK_NOTE (MISC, g_message ("adding colormap window\n"));
gdk_window_add_colormap_windows (window);
@@ -380,8 +508,8 @@ gdk_window_new (GdkWindow *parent,
}
size_hints.flags = PSize;
- size_hints.width = private->drawable.width;
- size_hints.height = private->drawable.height;
+ size_hints.width = impl->width;
+ size_hints.height = impl->height;
wm_hints.flags = InputHint | StateHint | WindowGroupHint;
wm_hints.window_group = gdk_leader_window;
@@ -392,19 +520,19 @@ gdk_window_new (GdkWindow *parent,
* attention to PSize, and even if they do, is this the
* correct value???
*/
- XSetWMNormalHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&size_hints);
- XSetWMHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetWMHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&wm_hints);
if (!wm_client_leader_atom)
wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
- XChangeProperty (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
wm_client_leader_atom,
XA_WINDOW, 32, PropModeReplace,
(guchar*) &gdk_leader_window, 1);
@@ -414,8 +542,8 @@ gdk_window_new (GdkWindow *parent,
else
title = g_get_prgname ();
- XmbSetWMProperties (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XmbSetWMProperties (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
title, title,
NULL, 0,
NULL, NULL, NULL);
@@ -425,8 +553,8 @@ gdk_window_new (GdkWindow *parent,
class_hint = XAllocClassHint ();
class_hint->res_name = attributes->wmclass_name;
class_hint->res_class = attributes->wmclass_class;
- XSetClassHint (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetClassHint (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
class_hint);
XFree (class_hint);
}
@@ -438,8 +566,10 @@ GdkWindow *
gdk_window_foreign_new (GdkNativeWindow anid)
{
GdkWindow *window;
- GdkWindowPrivate *private;
- GdkWindowPrivate *parent_private;
+ GdkWindowObject *private;
+ GdkWindowObject *parent_private;
+ GdkWindowImplX11 *impl;
+ GdkDrawableImplX11 *draw_impl;
XWindowAttributes attrs;
Window root, parent;
Window *children = NULL;
@@ -461,29 +591,33 @@ gdk_window_foreign_new (GdkNativeWindow anid)
if (children)
XFree (children);
- window = gdk_x11_window_alloc ();
- private = (GdkWindowPrivate *)window;
-
+ window = GDK_WINDOW (g_type_create_instance (GDK_TYPE_WINDOW));
+ private = (GdkWindowObject *)window;
+ impl = GDK_WINDOW_IMPL_X11 (private->impl);
+ draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (window);
+
private->parent = gdk_xid_table_lookup (parent);
- parent_private = (GdkWindowPrivate *)private->parent;
+ parent_private = (GdkWindowObject *)private->parent;
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
-
- GDK_DRAWABLE_XDATA (window)->xid = anid;
- GDK_DRAWABLE_XDATA (window)->xdisplay = gdk_display;
+
+ draw_impl->xid = anid;
+ draw_impl->xdisplay = gdk_display;
private->x = attrs.x;
private->y = attrs.y;
- private->drawable.width = attrs.width;
- private->drawable.height = attrs.height;
- private->drawable.window_type = GDK_WINDOW_FOREIGN;
- private->drawable.destroyed = FALSE;
+ impl->width = attrs.width;
+ impl->height = attrs.height;
+ private->window_type = GDK_WINDOW_FOREIGN;
+ private->destroyed = FALSE;
private->mapped = (attrs.map_state != IsUnmapped);
+ private->depth = attrs.depth;
gdk_drawable_ref (window);
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (window), window);
+ gdk_xid_table_insert (&GDK_WINDOW_XID (window), window);
return window;
}
@@ -493,12 +627,14 @@ _gdk_windowing_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
if (private->extension_events != 0)
gdk_input_window_destroy (window);
- if (private->drawable.window_type == GDK_WINDOW_FOREIGN)
+ if (private->window_type == GDK_WINDOW_FOREIGN)
{
if (!foreign_destroy && (private->parent != NULL))
{
@@ -513,21 +649,21 @@ _gdk_windowing_window_destroy (GdkWindow *window,
gdk_window_reparent (window, NULL, 0, 0);
xevent.type = ClientMessage;
- xevent.window = GDK_DRAWABLE_XID (window);
+ xevent.window = GDK_WINDOW_XID (window);
xevent.message_type = gdk_wm_protocols;
xevent.format = 32;
xevent.data.l[0] = gdk_wm_delete_window;
xevent.data.l[1] = CurrentTime;
- XSendEvent (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSendEvent (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
False, 0, (XEvent *)&xevent);
gdk_flush ();
gdk_error_trap_pop ();
}
}
else if (!recursing && !foreign_destroy)
- XDestroyWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+ XDestroyWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
}
/* This function is called when the XWindow is really gone.
@@ -537,68 +673,68 @@ gdk_window_destroy_notify (GdkWindow *window)
{
g_return_if_fail (window != NULL);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
- if (GDK_DRAWABLE_TYPE(window) != GDK_WINDOW_FOREIGN)
- g_warning ("GdkWindow %#lx unexpectedly destroyed", GDK_DRAWABLE_XID (window));
+ if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
+ g_warning ("GdkWindow %#lx unexpectedly destroyed", GDK_WINDOW_XID (window));
_gdk_window_destroy (window, TRUE);
}
- gdk_xid_table_remove (GDK_DRAWABLE_XID (window));
+ gdk_xid_table_remove (GDK_WINDOW_XID (window));
gdk_drawable_unref (window);
}
void
gdk_window_show (GdkWindow *window)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
- g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowPrivate*) window;
- if (!private->drawable.destroyed)
+ private = (GdkWindowObject*) window;
+ if (!private->destroyed)
{
private->mapped = TRUE;
- XRaiseWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window));
+ XRaiseWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window));
- if (GDK_WINDOW_XDATA (window)->position_info.mapped)
- XMapWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window));
+ if (GDK_WINDOW_IMPL_X11 (private->impl)->position_info.mapped)
+ XMapWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window));
}
}
void
gdk_window_hide (GdkWindow *window)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
g_return_if_fail (window != NULL);
- private = (GdkWindowPrivate*) window;
- if (!private->drawable.destroyed)
+ private = (GdkWindowObject*) window;
+ if (!private->destroyed)
{
private->mapped = FALSE;
_gdk_window_clear_update_area (window);
- XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window));
+ XUnmapWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window));
}
}
void
gdk_window_withdraw (GdkWindow *window)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
g_return_if_fail (window != NULL);
- private = (GdkWindowPrivate*) window;
- if (!private->drawable.destroyed)
- XWithdrawWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window), 0);
+ private = (GdkWindowObject*) window;
+ if (!private->destroyed)
+ XWithdrawWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), 0);
}
void
@@ -606,13 +742,16 @@ gdk_window_move (GdkWindow *window,
gint x,
gint y)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ GdkWindowImplX11 *impl;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
+ impl = GDK_WINDOW_IMPL_X11 (private->impl);
+
gdk_window_move_resize (window, x, y,
- private->drawable.width, private->drawable.height);
+ impl->width, impl->height);
}
void
@@ -620,7 +759,7 @@ gdk_window_resize (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -630,17 +769,17 @@ gdk_window_resize (GdkWindow *window,
if (height < 1)
height = 1;
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindowObject*) window;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
- if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+ if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
_gdk_window_move_resize_child (window, private->x, private->y,
width, height);
else
{
- XResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XResizeWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
width, height);
private->resize_count += 1;
}
@@ -654,7 +793,7 @@ gdk_window_move_resize (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -664,16 +803,16 @@ gdk_window_move_resize (GdkWindow *window,
if (height < 1)
height = 1;
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindowObject*) window;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
- if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+ if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
_gdk_window_move_resize_child (window, x, y, width, height);
else
{
- XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
x, y, width, height);
}
}
@@ -685,9 +824,9 @@ gdk_window_reparent (GdkWindow *window,
gint x,
gint y)
{
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *parent_private;
- GdkWindowPrivate *old_parent_private;
+ GdkWindowObject *window_private;
+ GdkWindowObject *parent_private;
+ GdkWindowObject *old_parent_private;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -697,17 +836,17 @@ gdk_window_reparent (GdkWindow *window,
if (!new_parent)
new_parent = gdk_parent_root;
- window_private = (GdkWindowPrivate*) window;
- old_parent_private = (GdkWindowPrivate*)window_private->parent;
- parent_private = (GdkWindowPrivate*) new_parent;
+ window_private = (GdkWindowObject*) window;
+ old_parent_private = (GdkWindowObject*)window_private->parent;
+ parent_private = (GdkWindowObject*) new_parent;
- if (!GDK_DRAWABLE_DESTROYED (window) && !GDK_DRAWABLE_DESTROYED (new_parent))
- XReparentWindow (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (new_parent),
+ if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (new_parent))
+ XReparentWindow (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ GDK_WINDOW_XID (new_parent),
x, y);
- window_private->parent = new_parent;
+ window_private->parent = (GdkWindowObject *)new_parent;
if (old_parent_private)
old_parent_private->children = g_list_remove (old_parent_private->children, window);
@@ -730,8 +869,8 @@ _gdk_windowing_window_clear_area (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- XClearArea (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+ if (!GDK_WINDOW_DESTROYED (window))
+ XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
x, y, width, height, False);
}
@@ -745,8 +884,8 @@ _gdk_windowing_window_clear_area_e (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- XClearArea (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+ if (!GDK_WINDOW_DESTROYED (window))
+ XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
x, y, width, height, True);
}
@@ -756,8 +895,8 @@ gdk_window_raise (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- XRaiseWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+ if (!GDK_WINDOW_DESTROYED (window))
+ XRaiseWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
}
void
@@ -766,8 +905,8 @@ gdk_window_lower (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- XLowerWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+ if (!GDK_WINDOW_DESTROYED (window))
+ XLowerWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
}
void
@@ -785,7 +924,7 @@ gdk_window_set_hints (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
size_hints.flags = 0;
@@ -814,8 +953,8 @@ gdk_window_set_hints (GdkWindow *window,
/* FIXME: Would it be better to delete this property of
* flags == 0? It would save space on the server
*/
- XSetWMNormalHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&size_hints);
}
@@ -829,7 +968,7 @@ gdk_window_set_geometry_hints (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
size_hints.flags = 0;
@@ -901,8 +1040,8 @@ gdk_window_set_geometry_hints (GdkWindow *window,
/* FIXME: Would it be better to delete this property of
* geom_mask == 0? It would save space on the server
*/
- XSetWMNormalHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&size_hints);
}
@@ -913,9 +1052,9 @@ gdk_window_set_title (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- XmbSetWMProperties (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ if (!GDK_WINDOW_DESTROYED (window))
+ XmbSetWMProperties (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
title, title, NULL, 0, NULL, NULL, NULL);
}
@@ -926,14 +1065,14 @@ gdk_window_set_role (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
if (role)
- XChangeProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE), XA_STRING,
8, PropModeReplace, role, strlen (role));
else
- XDeleteProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+ XDeleteProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE));
}
}
@@ -942,33 +1081,33 @@ void
gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
- GdkWindowPrivate *private;
- GdkWindowPrivate *parent_private;
+ GdkWindowObject *private;
+ GdkWindowObject *parent_private;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowPrivate*) window;
- parent_private = (GdkWindowPrivate*) parent;
+ private = (GdkWindowObject*) window;
+ parent_private = (GdkWindowObject*) parent;
- if (!GDK_DRAWABLE_DESTROYED (window) && !GDK_DRAWABLE_DESTROYED (parent))
- XSetTransientForHint (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (parent));
+ if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (parent))
+ XSetTransientForHint (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ GDK_WINDOW_XID (parent));
}
void
gdk_window_set_background (GdkWindow *window,
GdkColor *color)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- XSetWindowBackground (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window), color->pixel);
+ if (!GDK_WINDOW_DESTROYED (window))
+ XSetWindowBackground (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), color->pixel);
private->bg_color = *color;
@@ -986,7 +1125,7 @@ gdk_window_set_back_pixmap (GdkWindow *window,
GdkPixmap *pixmap,
gboolean parent_relative)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
Pixmap xpixmap;
g_return_if_fail (window != NULL);
@@ -1009,7 +1148,7 @@ gdk_window_set_back_pixmap (GdkWindow *window,
{
gdk_pixmap_ref (pixmap);
private->bg_pixmap = pixmap;
- xpixmap = GDK_DRAWABLE_XID (pixmap);
+ xpixmap = GDK_PIXMAP_XID (pixmap);
}
else
{
@@ -1018,9 +1157,9 @@ gdk_window_set_back_pixmap (GdkWindow *window,
}
}
- if (!GDK_DRAWABLE_DESTROYED (window))
- XSetWindowBackgroundPixmap (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window), xpixmap);
+ if (!GDK_WINDOW_DESTROYED (window))
+ XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), xpixmap);
}
void
@@ -1040,9 +1179,9 @@ gdk_window_set_cursor (GdkWindow *window,
else
xcursor = cursor_private->xcursor;
- if (!GDK_DRAWABLE_DESTROYED (window))
- XDefineCursor (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ if (!GDK_WINDOW_DESTROYED (window))
+ XDefineCursor (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
xcursor);
}
@@ -1067,10 +1206,10 @@ gdk_window_get_geometry (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
- XGetGeometry (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XGetGeometry (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
if (x)
@@ -1098,10 +1237,10 @@ gdk_window_get_origin (GdkWindow *window,
g_return_val_if_fail (window != NULL, 0);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
- return_val = XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
gdk_root_window,
0, 0, &tx, &ty,
&child);
@@ -1136,13 +1275,13 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
if (!atom)
atom = gdk_atom_intern ("ENLIGHTENMENT_DESKTOP", FALSE);
- win = GDK_DRAWABLE_XID (window);
+ win = GDK_WINDOW_XID (window);
- while (XQueryTree (GDK_DRAWABLE_XDISPLAY (window), win, &root, &parent,
+ while (XQueryTree (GDK_WINDOW_XDISPLAY (window), win, &root, &parent,
&child, (unsigned int *)&num_children))
{
if ((child) && (num_children > 0))
@@ -1157,7 +1296,7 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
break;
data_return = NULL;
- XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (window), win, atom, 0, 0,
+ XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), win, atom, 0, 0,
False, XA_CARDINAL, &type_return, &format_return,
&number_return, &bytes_after_return, &data_return);
if (type_return == XA_CARDINAL)
@@ -1167,8 +1306,8 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
}
}
- return_val = XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
win,
0, 0, &tx, &ty,
&root);
@@ -1187,7 +1326,7 @@ gdk_window_get_root_origin (GdkWindow *window,
gint *x,
gint *y)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
Window xwindow;
Window xparent;
Window root;
@@ -1197,25 +1336,25 @@ gdk_window_get_root_origin (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindowObject*) window;
if (x)
*x = 0;
if (y)
*y = 0;
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
- private = (GdkWindowPrivate*) private->parent;
- if (GDK_DRAWABLE_DESTROYED (window))
+ while (private->parent && ((GdkWindowObject*) private->parent)->parent)
+ private = (GdkWindowObject*) private->parent;
+ if (GDK_WINDOW_DESTROYED (window))
return;
- xparent = GDK_DRAWABLE_XID (window);
+ xparent = GDK_WINDOW_XID (window);
do
{
xwindow = xparent;
- if (!XQueryTree (GDK_DRAWABLE_XDISPLAY (window), xwindow,
+ if (!XQueryTree (GDK_WINDOW_XDISPLAY (window), xwindow,
&root, &xparent,
&children, &nchildren))
return;
@@ -1230,7 +1369,7 @@ gdk_window_get_root_origin (GdkWindow *window,
unsigned int ww, wh, wb, wd;
int wx, wy;
- if (XGetGeometry (GDK_DRAWABLE_XDISPLAY (window), xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
+ if (XGetGeometry (GDK_WINDOW_XDISPLAY (window), xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
{
if (x)
*x = wx;
@@ -1263,9 +1402,9 @@ gdk_window_get_pointer (GdkWindow *window,
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
return_val = NULL;
- if (!GDK_DRAWABLE_DESTROYED (window) &&
- XQueryPointer (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ if (!GDK_WINDOW_DESTROYED (window) &&
+ XQueryPointer (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&root, &child, &rootx, &rooty, &winx, &winy, &xmask))
{
if (child)
@@ -1320,45 +1459,6 @@ gdk_window_at_pointer (gint *win_x,
return window;
}
-GList*
-gdk_window_get_children (GdkWindow *window)
-{
- GdkWindow *child;
- GList *children;
- Window root;
- Window parent;
- Window *xchildren;
- unsigned int nchildren;
- unsigned int i;
-
- g_return_val_if_fail (window != NULL, NULL);
- g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
-
- if (GDK_DRAWABLE_DESTROYED (window))
- return NULL;
-
- XQueryTree (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
- &root, &parent, &xchildren, &nchildren);
-
- children = NULL;
-
- if (nchildren > 0)
- {
- for (i = 0; i < nchildren; i++)
- {
- child = gdk_window_lookup (xchildren[i]);
- if (child)
- children = g_list_prepend (children, child);
- }
-
- if (xchildren)
- XFree (xchildren);
- }
-
- return children;
-}
-
GdkEventMask
gdk_window_get_events (GdkWindow *window)
{
@@ -1369,12 +1469,12 @@ gdk_window_get_events (GdkWindow *window)
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return 0;
else
{
- XGetWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XGetWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&attrs);
event_mask = 0;
@@ -1398,7 +1498,7 @@ gdk_window_set_events (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
xevent_mask = StructureNotifyMask;
for (i = 0; i < gdk_nevent_masks; i++)
@@ -1407,8 +1507,8 @@ gdk_window_set_events (GdkWindow *window,
xevent_mask |= gdk_event_mask_table[i];
}
- XSelectInput (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSelectInput (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
xevent_mask);
}
}
@@ -1425,19 +1525,19 @@ gdk_window_add_colormap_windows (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window));
toplevel = gdk_window_get_toplevel (window);
- if (GDK_DRAWABLE_DESTROYED (toplevel))
+ if (GDK_WINDOW_DESTROYED (toplevel))
return;
old_windows = NULL;
- if (!XGetWMColormapWindows (GDK_DRAWABLE_XDISPLAY (toplevel),
- GDK_DRAWABLE_XID (toplevel),
+ if (!XGetWMColormapWindows (GDK_WINDOW_XDISPLAY (toplevel),
+ GDK_WINDOW_XID (toplevel),
&old_windows, &count))
{
count = 0;
}
for (i = 0; i < count; i++)
- if (old_windows[i] == GDK_DRAWABLE_XID (window))
+ if (old_windows[i] == GDK_WINDOW_XID (window))
{
XFree (old_windows);
return;
@@ -1447,10 +1547,10 @@ gdk_window_add_colormap_windows (GdkWindow *window)
for (i = 0; i < count; i++)
new_windows[i] = old_windows[i];
- new_windows[count] = GDK_DRAWABLE_XID (window);
+ new_windows[count] = GDK_WINDOW_XID (window);
- XSetWMColormapWindows (GDK_DRAWABLE_XDISPLAY (toplevel),
- GDK_DRAWABLE_XID (toplevel),
+ XSetWMColormapWindows (GDK_WINDOW_XDISPLAY (toplevel),
+ GDK_WINDOW_XID (toplevel),
new_windows, count + 1);
g_free (new_windows);
@@ -1492,14 +1592,14 @@ gdk_window_shape_combine_mask (GdkWindow *window,
g_return_if_fail (GDK_IS_WINDOW (window));
#ifdef HAVE_SHAPE_EXT
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
if (gdk_window_have_shape_ext ())
{
if (mask)
{
- pixmap = GDK_DRAWABLE_XID (mask);
+ pixmap = GDK_PIXMAP_XID (mask);
}
else
{
@@ -1508,8 +1608,8 @@ gdk_window_shape_combine_mask (GdkWindow *window,
pixmap = None;
}
- XShapeCombineMask (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XShapeCombineMask (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
ShapeBounding,
x, y,
pixmap,
@@ -1527,11 +1627,11 @@ gdk_window_set_override_redirect (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
{
attr.override_redirect = (override_redirect == FALSE)?False:True;
- XChangeWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
CWOverrideRedirect,
&attr);
}
@@ -1548,34 +1648,34 @@ gdk_window_set_icon (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- wm_hints = XGetWMHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window));
+ wm_hints = XGetWMHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window));
if (!wm_hints)
wm_hints = XAllocWMHints ();
if (icon_window != NULL)
{
wm_hints->flags |= IconWindowHint;
- wm_hints->icon_window = GDK_DRAWABLE_XID (icon_window);
+ wm_hints->icon_window = GDK_WINDOW_XID (icon_window);
}
if (pixmap != NULL)
{
wm_hints->flags |= IconPixmapHint;
- wm_hints->icon_pixmap = GDK_DRAWABLE_XID (pixmap);
+ wm_hints->icon_pixmap = GDK_PIXMAP_XID (pixmap);
}
if (mask != NULL)
{
wm_hints->flags |= IconMaskHint;
- wm_hints->icon_mask = GDK_DRAWABLE_XID (mask);
+ wm_hints->icon_mask = GDK_PIXMAP_XID (mask);
}
- XSetWMHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window), wm_hints);
+ XSetWMHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), wm_hints);
XFree (wm_hints);
}
@@ -1589,10 +1689,10 @@ gdk_window_set_icon_name (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- res = XmbTextListToTextProperty (GDK_DRAWABLE_XDISPLAY (window),
+ res = XmbTextListToTextProperty (GDK_WINDOW_XDISPLAY (window),
&name, 1, XStdICCTextStyle,
&property);
if (res < 0)
@@ -1601,8 +1701,8 @@ gdk_window_set_icon_name (GdkWindow *window,
return;
}
- XSetWMIconName (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XSetWMIconName (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
&property);
if (property.value)
@@ -1620,19 +1720,19 @@ gdk_window_set_group (GdkWindow *window,
g_return_if_fail (leader != NULL);
g_return_if_fail (GDK_IS_WINDOW (leader));
- if (GDK_DRAWABLE_DESTROYED (window) || GDK_DRAWABLE_DESTROYED (leader))
+ if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (leader))
return;
- wm_hints = XGetWMHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window));
+ wm_hints = XGetWMHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window));
if (!wm_hints)
wm_hints = XAllocWMHints ();
wm_hints->flags |= WindowGroupHint;
- wm_hints->window_group = GDK_DRAWABLE_XID (leader);
+ wm_hints->window_group = GDK_WINDOW_XID (leader);
- XSetWMHints (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window), wm_hints);
+ XSetWMHints (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), wm_hints);
XFree (wm_hints);
}
@@ -1647,14 +1747,14 @@ gdk_window_set_mwm_hints (GdkWindow *window,
gulong nitems;
gulong bytes_after;
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
if (!hints_atom)
- hints_atom = XInternAtom (GDK_DRAWABLE_XDISPLAY (window),
+ hints_atom = XInternAtom (GDK_WINDOW_XDISPLAY (window),
_XA_MOTIF_WM_HINTS, FALSE);
- XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+ XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
False, AnyPropertyType, &type, &format, &nitems,
&bytes_after, (guchar **)&hints);
@@ -1675,7 +1775,7 @@ gdk_window_set_mwm_hints (GdkWindow *window,
}
}
- XChangeProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+ XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
hints_atom, hints_atom, 32, PropModeReplace,
(guchar *)hints, sizeof (MotifWmHints)/sizeof (long));
@@ -2032,10 +2132,10 @@ gdk_window_set_child_shapes (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window));
#ifdef HAVE_SHAPE_EXT
- if (!GDK_DRAWABLE_DESTROYED (window) &&
+ if (!GDK_WINDOW_DESTROYED (window) &&
gdk_window_have_shape_ext ())
- gdk_propagate_shapes (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window), FALSE);
+ gdk_propagate_shapes (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), FALSE);
#endif
}
@@ -2046,10 +2146,10 @@ gdk_window_merge_child_shapes (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window));
#ifdef HAVE_SHAPE_EXT
- if (!GDK_DRAWABLE_DESTROYED (window) &&
+ if (!GDK_WINDOW_DESTROYED (window) &&
gdk_window_have_shape_ext ())
- gdk_propagate_shapes (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window), TRUE);
+ gdk_propagate_shapes (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), TRUE);
#endif
}
@@ -2125,8 +2225,8 @@ gdk_window_set_static_bit_gravity (GdkWindow *window, gboolean on)
xattributes.bit_gravity = StaticGravity;
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = on ? StaticGravity : ForgetGravity;
- XChangeWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
CWBitGravity, &xattributes);
}
@@ -2139,8 +2239,8 @@ gdk_window_set_static_win_gravity (GdkWindow *window, gboolean on)
xattributes.win_gravity = on ? StaticGravity : NorthWestGravity;
- XChangeWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
- GDK_DRAWABLE_XID (window),
+ XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
CWWinGravity, &xattributes);
}
@@ -2160,7 +2260,7 @@ gboolean
gdk_window_set_static_gravities (GdkWindow *window,
gboolean use_static)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GList *tmp_list;
g_return_val_if_fail (window != NULL, FALSE);
@@ -2174,7 +2274,7 @@ gdk_window_set_static_gravities (GdkWindow *window,
private->guffaw_gravity = use_static;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
gdk_window_set_static_bit_gravity (window, use_static);
@@ -2262,7 +2362,6 @@ gdk_window_xid_at_coords (gint x,
gboolean excl_child)
{
GdkWindow *window;
- GdkDrawablePrivate *private;
Display *xdisplay;
Window *list = NULL;
Window root, child = 0, parent_win = 0, root_win = 0;
@@ -2270,9 +2369,8 @@ gdk_window_xid_at_coords (gint x,
int i;
window = gdk_parent_root;
- private = (GdkDrawablePrivate*) window;
- xdisplay = GDK_DRAWABLE_XDISPLAY (private);
- root = GDK_DRAWABLE_XID (private);
+ xdisplay = GDK_WINDOW_XDISPLAY (window);
+ root = GDK_WINDOW_XID (window);
num = g_list_length (excludes);
XGrabServer (xdisplay);
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
new file mode 100644
index 0000000000..3e35c5a162
--- /dev/null
+++ b/gdk/x11/gdkwindow-x11.h
@@ -0,0 +1,89 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GDK_WINDOW_X11_H__
+#define __GDK_WINDOW_X11_H__
+
+#include <gdk/x11/gdkdrawable-x11.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _GdkXPositionInfo GdkXPositionInfo;
+
+struct _GdkXPositionInfo
+{
+ gint x;
+ gint y;
+ gint width;
+ gint height;
+ gint x_offset; /* Offsets to add to X coordinates within window */
+ gint y_offset; /* to get GDK coodinates within window */
+ gboolean big : 1;
+ gboolean mapped : 1;
+ gboolean no_bg : 1; /* Set when the window background is temporarily
+ * unset during resizing and scaling */
+ GdkRectangle clip_rect; /* visible rectangle of window */
+};
+
+
+/* Window implementation for X11
+ */
+
+typedef struct _GdkWindowImplX11 GdkWindowImplX11;
+typedef struct _GdkWindowImplX11Class GdkWindowImplX11Class;
+
+#define GDK_TYPE_WINDOW_IMPL_X11 (gdk_window_impl_x11_get_type ())
+#define GDK_WINDOW_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11))
+#define GDK_WINDOW_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class))
+#define GDK_IS_WINDOW_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_X11))
+#define GDK_IS_WINDOW_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_X11))
+#define GDK_WINDOW_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class))
+
+struct _GdkWindowImplX11
+{
+ GdkDrawableImplX11 parent_instance;
+
+ gint width;
+ gint height;
+
+ GdkXPositionInfo position_info;
+};
+
+struct _GdkWindowImplX11Class
+{
+ GdkDrawableImplX11Class parent_class;
+
+};
+
+GType gdk_window_impl_x11_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GDK_WINDOW_X11_H__ */
diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
index 29d8e8fb4d..a418e25e27 100644
--- a/gdk/x11/gdkx.h
+++ b/gdk/x11/gdkx.h
@@ -33,59 +33,20 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-typedef struct _GdkGCXData GdkGCXData;
-typedef struct _GdkDrawableXData GdkDrawableXData;
-typedef struct _GdkWindowXData GdkWindowXData;
-typedef struct _GdkXPositionInfo GdkXPositionInfo;
-typedef struct _GdkColormapPrivateX GdkColormapPrivateX;
-typedef struct _GdkCursorPrivate GdkCursorPrivate;
-typedef struct _GdkFontPrivateX GdkFontPrivateX;
-typedef struct _GdkImagePrivateX GdkImagePrivateX;
-typedef struct _GdkVisualPrivate GdkVisualPrivate;
+#include <gdk/x11/gdkwindow-x11.h>
+#include <gdk/x11/gdkpixmap-x11.h>
+
+typedef struct _GdkGCXData GdkGCXData;
+typedef struct _GdkColormapPrivateX11 GdkColormapPrivateX11;
+typedef struct _GdkCursorPrivate GdkCursorPrivate;
+typedef struct _GdkFontPrivateX GdkFontPrivateX;
+typedef struct _GdkImagePrivateX11 GdkImagePrivateX11;
+typedef struct _GdkVisualPrivate GdkVisualPrivate;
#ifdef USE_XIM
typedef struct _GdkICPrivate GdkICPrivate;
#endif /* USE_XIM */
-#define GDK_DRAWABLE_XDATA(win) ((GdkDrawableXData *)(((GdkDrawablePrivate*)(win))->klass_data))
-#define GDK_WINDOW_XDATA(win) ((GdkWindowXData *)(((GdkDrawablePrivate*)(win))->klass_data))
-#define GDK_GC_XDATA(gc) ((GdkGCXData *)(((GdkGCPrivate*)(gc))->klass_data))
-
-struct _GdkGCXData
-{
- GC xgc;
- Display *xdisplay;
- GdkRegion *clip_region;
- guint dirty_mask;
-};
-
-struct _GdkDrawableXData
-{
- Window xid;
- Display *xdisplay;
-};
-
-struct _GdkXPositionInfo
-{
- gint x;
- gint y;
- gint width;
- gint height;
- gint x_offset; /* Offsets to add to X coordinates within window */
- gint y_offset; /* to get GDK coodinates within window */
- gboolean big : 1;
- gboolean mapped : 1;
- gboolean no_bg : 1; /* Set when the window background is temporarily
- * unset during resizing and scaling */
- GdkRectangle clip_rect; /* visible rectangle of window */
-};
-
-struct _GdkWindowXData
-{
- GdkDrawableXData drawable_data;
- GdkXPositionInfo position_info;
-};
-
struct _GdkCursorPrivate
{
GdkCursor cursor;
@@ -110,10 +71,8 @@ struct _GdkVisualPrivate
Visual *xvisual;
};
-struct _GdkColormapPrivateX
+struct _GdkColormapPrivateX11
{
- GdkColormapPrivate base;
-
Colormap xcolormap;
Display *xdisplay;
gint private_val;
@@ -123,10 +82,8 @@ struct _GdkColormapPrivateX
time_t last_sync_time;
};
-struct _GdkImagePrivateX
+struct _GdkImagePrivateX11
{
- GdkImagePrivate base;
-
XImage *ximage;
Display *xdisplay;
gpointer x_shm_info;
@@ -144,25 +101,56 @@ struct _GdkICPrivate
#endif /* USE_XIM */
+
+typedef struct _GdkGCX11 GdkGCX11;
+typedef struct _GdkGCX11Class GdkGCX11Class;
+
+#define GDK_TYPE_GC_X11 (gdk_gc_x11_get_type ())
+#define GDK_GC_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_X11, GdkGCX11))
+#define GDK_GC_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_X11, GdkGCX11Class))
+#define GDK_IS_GC_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_X11))
+#define GDK_IS_GC_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_X11))
+#define GDK_GC_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_X11, GdkGCX11Class))
+
+struct _GdkGCX11
+{
+ GdkGC parent_instance;
+
+ GC xgc;
+ Display *xdisplay;
+ GdkRegion *clip_region;
+ guint dirty_mask;
+};
+
+struct _GdkGCX11Class
+{
+ GdkGCClass parent_class;
+
+};
+
+GType gdk_gc_x11_get_type (void);
+
#define GDK_ROOT_WINDOW() gdk_root_window
#define GDK_ROOT_PARENT() ((GdkWindow *)gdk_parent_root)
#define GDK_DISPLAY() gdk_display
-#define GDK_DRAWABLE_XDISPLAY(win) (GDK_DRAWABLE_XDATA(win)->xdisplay)
-#define GDK_DRAWABLE_XID(win) (GDK_DRAWABLE_XDATA(win)->xid)
-#define GDK_IMAGE_XDISPLAY(image) (((GdkImagePrivate*) image)->xdisplay)
-#define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivate*) image)->ximage)
-#define GDK_GC_XDISPLAY(gc) (GDK_GC_XDATA(gc)->xdisplay)
-#define GDK_COLORMAP_XDISPLAY(cmap) (((GdkColormapPrivateX *)cmap)->xdisplay)
-#define GDK_COLORMAP_XCOLORMAP(cmap) (((GdkColormapPrivateX *)cmap)->xcolormap)
-#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate*) vis)->xvisual)
-#define GDK_FONT_XDISPLAY(font) (((GdkFontPrivate*) font)->xdisplay)
+#define GDK_WINDOW_XDISPLAY(win) (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xdisplay)
+#define GDK_WINDOW_XID(win) (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xid)
+#define GDK_PIXMAP_XDISPLAY(win) (GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)win)->impl)->xdisplay)
+#define GDK_PIXMAP_XID(win) (GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)win)->impl)->xid)
+#define GDK_DRAWABLE_XDISPLAY(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XDISPLAY (win) : GDK_PIXMAP_XDISPLAY (win))
+#define GDK_DRAWABLE_XID(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XID (win) : GDK_PIXMAP_XID (win))
+#define GDK_IMAGE_XDISPLAY(image) (((GdkImagePrivateX11 *) GDK_IMAGE (image)->windowing_data)->xdisplay)
+#define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivateX11 *) GDK_IMAGE (image)->windowing_data)->ximage)
+#define GDK_GC_XDISPLAY(gc) (GDK_GC_X11(gc)->xdisplay)
+#define GDK_COLORMAP_XDISPLAY(cmap) (((GdkColormapPrivateX11 *)GDK_COLORMAP (cmap)->windowing_data)->xdisplay)
+#define GDK_COLORMAP_XCOLORMAP(cmap) (((GdkColormapPrivateX11 *)GDK_COLORMAP (cmap)->windowing_data)->xcolormap)
+#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
+#define GDK_FONT_XDISPLAY(font) (((GdkFontPrivate *) font)->xdisplay)
#define GDK_FONT_XFONT(font) (((GdkFontPrivateX *)font)->xfont)
-#define GDK_GC_XGC(gc) (GDK_GC_XDATA(gc)->xgc)
-#define GDK_GC_GET_XGC(gc) (GDK_GC_XDATA(gc)->dirty_mask ? _gdk_x11_gc_flush (gc) : GDK_GC_XGC (gc))
-
-#define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
-#define GDK_WINDOW_XDISPLAY GDK_DRAWABLE_XDISPLAY
+#define GDK_GC_XGC(gc) (GDK_GC_X11(gc)->xgc)
+#define GDK_GC_GET_XGC(gc) (GDK_GC_X11(gc)->dirty_mask ? _gdk_x11_gc_flush (gc) : GDK_GC_XGC (gc))
+#define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
extern Display *gdk_display;
extern Window gdk_root_window;
diff --git a/gtk/gtk-boxed.defs b/gtk/gtk-boxed.defs
index c36b2fdca2..23f82b65cf 100644
--- a/gtk/gtk-boxed.defs
+++ b/gtk/gtk-boxed.defs
@@ -16,10 +16,6 @@
(define-boxed GtkSelectionData
)
-(define-boxed GtkStyle
- gtk_style_ref
- gtk_style_unref)
-
(define-boxed GtkCTreeNode
)
@@ -29,10 +25,6 @@
; gdk_point_copy
; gdk_point_destroy)
-(define-boxed GdkColormap
- gdk_colormap_ref
- gdk_colormap_unref)
-
(define-boxed GdkVisual
gdk_visual_ref
gdk_visual_unref)
@@ -41,13 +33,6 @@
gdk_font_ref
gdk_font_unref)
-(define-boxed GdkWindow
- gdk_window_ref
- gdk_window_unref)
-
-(define-boxed GdkDragContext
- gdk_drag_context_ref
- gdk_drag_context_unref)
(define-boxed GdkEvent
gdk_event_copy
gdk_event_free
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 4b82736f99..bfe338181a 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -247,7 +247,7 @@ gtk_accel_label_size_request (GtkWidget *widget,
pango_layout_get_extents (layout, NULL, &logical_rect);
accel_label->accel_string_width = logical_rect.width / PANGO_SCALE;
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
static gint
@@ -304,7 +304,7 @@ gtk_accel_label_expose_event (GtkWidget *widget,
y,
layout);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
else
{
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 2c9113aed7..65684e7580 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -429,15 +429,15 @@ gtk_button_size_request (GtkWidget *widget,
button = GTK_BUTTON (widget);
requisition->width = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2;
+ GTK_WIDGET (widget)->style->xthickness) * 2;
requisition->height = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
- GTK_WIDGET (widget)->style->klass->ythickness) * 2;
+ GTK_WIDGET (widget)->style->ythickness) * 2;
if (GTK_WIDGET_CAN_DEFAULT (widget))
{
- requisition->width += (GTK_WIDGET (widget)->style->klass->xthickness * 2 +
+ requisition->width += (GTK_WIDGET (widget)->style->xthickness * 2 +
DEFAULT_SPACING);
- requisition->height += (GTK_WIDGET (widget)->style->klass->ythickness * 2 +
+ requisition->height += (GTK_WIDGET (widget)->style->ythickness * 2 +
DEFAULT_SPACING);
}
@@ -478,8 +478,8 @@ gtk_button_size_allocate (GtkWidget *widget,
if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
{
- child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness);
- child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness);
+ child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->xthickness);
+ child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->ythickness);
child_allocation.width = MAX (1, (gint)widget->allocation.width - child_allocation.x * 2 -
border_width * 2);
@@ -488,14 +488,14 @@ gtk_button_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_CAN_DEFAULT (button))
{
- child_allocation.x += (GTK_WIDGET (widget)->style->klass->xthickness +
+ child_allocation.x += (GTK_WIDGET (widget)->style->xthickness +
DEFAULT_LEFT_POS);
- child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness +
+ child_allocation.y += (GTK_WIDGET (widget)->style->ythickness +
DEFAULT_TOP_POS);
child_allocation.width = MAX (1, (gint)child_allocation.width -
- (gint)(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
+ (gint)(GTK_WIDGET (widget)->style->xthickness * 2 + DEFAULT_SPACING));
child_allocation.height = MAX (1, (gint)child_allocation.height -
- (gint)(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
+ (gint)(GTK_WIDGET (widget)->style->xthickness * 2 + DEFAULT_SPACING));
}
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
@@ -560,8 +560,8 @@ gtk_button_paint (GtkWidget *widget,
if (GTK_WIDGET_CAN_DEFAULT (widget))
{
- x += widget->style->klass->xthickness;
- y += widget->style->klass->ythickness;
+ x += widget->style->xthickness;
+ y += widget->style->ythickness;
width -= 2 * x + DEFAULT_SPACING;
height -= 2 * y + DEFAULT_SPACING;
x += DEFAULT_LEFT_POS;
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index bc5708dfce..341379051d 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -962,11 +962,11 @@ gtk_calendar_realize_day_names (GtkWidget *widget)
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- attributes.x = (widget->style->klass->xthickness + INNER_BORDER);
- attributes.y = private_data->header_h + (widget->style->klass->ythickness
+ attributes.x = (widget->style->xthickness + INNER_BORDER);
+ attributes.y = private_data->header_h + (widget->style->ythickness
+ INNER_BORDER);
attributes.width = (widget->allocation.width
- - (widget->style->klass->xthickness + INNER_BORDER)
+ - (widget->style->xthickness + INNER_BORDER)
* 2);
attributes.height = private_data->day_name_h;
private_data->day_name_win = gdk_window_new (widget->window,
@@ -1007,9 +1007,9 @@ gtk_calendar_realize_week_numbers (GtkWidget *widget)
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- attributes.x = + (widget->style->klass->xthickness + INNER_BORDER);
+ attributes.x = + (widget->style->xthickness + INNER_BORDER);
attributes.y = (private_data->header_h + private_data->day_name_h
- + (widget->style->klass->ythickness + INNER_BORDER));
+ + (widget->style->ythickness + INNER_BORDER));
attributes.width = private_data->week_width;
attributes.height = private_data->main_h;
private_data->week_win = gdk_window_new (widget->window,
@@ -1075,11 +1075,11 @@ gtk_calendar_realize (GtkWidget *widget)
attributes.x = private_data->week_width;
else
attributes.x = 0;
- attributes.x += (widget->style->klass->xthickness + INNER_BORDER);
+ attributes.x += (widget->style->xthickness + INNER_BORDER);
attributes.y = (private_data->header_h + private_data->day_name_h
- + (widget->style->klass->ythickness + INNER_BORDER));
+ + (widget->style->ythickness + INNER_BORDER));
attributes.width = (widget->allocation.width - attributes.x
- - (widget->style->klass->xthickness + INNER_BORDER));
+ - (widget->style->xthickness + INNER_BORDER));
attributes.height = private_data->main_h;
private_data->main_win = gdk_window_new (widget->window,
&attributes, attributes_mask);
@@ -1262,7 +1262,7 @@ gtk_calendar_size_request (GtkWidget *widget,
: 0));
- requisition->width = MAX (header_width+4, main_width + (widget->style->klass->xthickness + INNER_BORDER) *2);
+ requisition->width = MAX (header_width+4, main_width + (widget->style->xthickness + INNER_BORDER) *2);
/*
* Calculate the requisition height for the widget.
@@ -1312,9 +1312,9 @@ gtk_calendar_size_request (GtkWidget *widget,
height = (private_data->header_h + private_data->day_name_h
+ private_data->main_h);
- requisition->height = height + (widget->style->klass->ythickness + INNER_BORDER) * 2;
+ requisition->height = height + (widget->style->ythickness + INNER_BORDER) * 2;
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
static void
@@ -1336,17 +1336,17 @@ gtk_calendar_size_allocate (GtkWidget *widget,
if (calendar->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
{
private_data->day_width = (private_data->min_day_width
- * ((allocation->width - (widget->style->klass->xthickness + INNER_BORDER) * 2
+ * ((allocation->width - (widget->style->xthickness + INNER_BORDER) * 2
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 7) - CALENDAR_XSEP * 2))
/ (7 * private_data->min_day_width + private_data->max_week_char_width * 2));
- private_data->week_width = ((allocation->width - (widget->style->klass->xthickness + INNER_BORDER) * 2
+ private_data->week_width = ((allocation->width - (widget->style->xthickness + INNER_BORDER) * 2
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 7) - CALENDAR_XSEP * 2 )
- private_data->day_width * 7 + CALENDAR_MARGIN + CALENDAR_XSEP);
}
else
{
private_data->day_width = (allocation->width
- - (widget->style->klass->xthickness + INNER_BORDER) * 2
+ - (widget->style->xthickness + INNER_BORDER) * 2
- (CALENDAR_MARGIN * 2)
- (DAY_XSEP * 7))/7;
private_data->week_width = 0;
@@ -1390,25 +1390,25 @@ gtk_calendar_size_allocate (GtkWidget *widget,
private_data->header_h - 7);
if (private_data->day_name_win)
gdk_window_move_resize (private_data->day_name_win,
- widget->style->klass->xthickness + INNER_BORDER,
- private_data->header_h + (widget->style->klass->ythickness + INNER_BORDER),
- allocation->width - (widget->style->klass->xthickness + INNER_BORDER) * 2,
+ widget->style->xthickness + INNER_BORDER,
+ private_data->header_h + (widget->style->ythickness + INNER_BORDER),
+ allocation->width - (widget->style->xthickness + INNER_BORDER) * 2,
private_data->day_name_h);
if (private_data->week_win)
gdk_window_move_resize (private_data->week_win,
- (widget->style->klass->xthickness + INNER_BORDER),
+ (widget->style->xthickness + INNER_BORDER),
private_data->header_h + private_data->day_name_h
- + (widget->style->klass->ythickness + INNER_BORDER),
+ + (widget->style->ythickness + INNER_BORDER),
private_data->week_width,
private_data->main_h);
gdk_window_move_resize (private_data->main_win,
(private_data->week_width ? private_data->week_width + CALENDAR_XSEP :0)
- + (widget->style->klass->xthickness + INNER_BORDER),
+ + (widget->style->xthickness + INNER_BORDER),
private_data->header_h + private_data->day_name_h
- + (widget->style->klass->ythickness + INNER_BORDER),
+ + (widget->style->ythickness + INNER_BORDER),
allocation->width
- (private_data->week_width ? private_data->week_width + CALENDAR_XSEP :0)
- - (widget->style->klass->xthickness + INNER_BORDER) * 2,
+ - (widget->style->xthickness + INNER_BORDER) * 2,
private_data->main_h);
}
}
@@ -1602,7 +1602,7 @@ gtk_calendar_paint_header (GtkWidget *widget)
gtk_calendar_paint_arrow (widget, ARROW_YEAR_LEFT);
gtk_calendar_paint_arrow (widget, ARROW_YEAR_RIGHT);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
static void
@@ -1690,7 +1690,7 @@ gtk_calendar_paint_day_names (GtkWidget *widget)
layout);
}
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
static void
@@ -1779,7 +1779,7 @@ gtk_calendar_paint_week_numbers (GtkWidget *widget)
gdk_draw_layout (private_data->week_win, gc, x_loc, y_loc, layout);
}
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
static void
@@ -1924,8 +1924,7 @@ gtk_calendar_paint_day (GtkWidget *widget,
private_data->day_width-1, day_height-1);
}
- pango_layout_unref (layout);
-
+ g_object_unref (G_OBJECT (layout));
}
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index d149fdbc09..74afbf104e 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -247,7 +247,7 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
width = 8;
height = 8;
x = (GTK_CONTAINER (check_menu_item)->border_width +
- widget->style->klass->xthickness + 2);
+ widget->style->xthickness + 2);
y = (widget->allocation.height - height) / 2;
if (check_menu_item->active ||
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 84e0b93951..d4f79c012a 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -2044,7 +2044,7 @@ new_column_width (GtkCList *clist,
gint column,
gint *x)
{
- gint xthickness = GTK_WIDGET (clist)->style->klass->xthickness;
+ gint xthickness = GTK_WIDGET (clist)->style->xthickness;
gint width;
gint cx;
gint dx;
@@ -2530,7 +2530,7 @@ _gtk_clist_create_cell_layout (GtkCList *clist,
GTK_CELL_PIXTEXT (*cell)->text :
GTK_CELL_TEXT (*cell)->text), -1);
- pango_context_unref (context);
+ g_object_unref (G_OBJECT (context));
return layout;
@@ -2562,7 +2562,7 @@ cell_size_request (GtkCList *clist,
requisition->width = logical_rect.width / PANGO_SCALE;
requisition->height = logical_rect.height / PANGO_SCALE;
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
else
{
@@ -3028,7 +3028,7 @@ gtk_clist_set_row_height (GtkCList *clist,
g_free (lang);
g_object_unref (G_OBJECT (font));
- pango_context_unref (context);
+ g_object_unref (G_OBJECT (context));
if (!GTK_CLIST_ROW_HEIGHT_SET(clist))
clist->row_height = (metrics.ascent + metrics.descent) / PANGO_SCALE;
@@ -4511,9 +4511,9 @@ gtk_clist_realize (GtkWidget *widget)
/* clist-window */
attributes.x = (clist->internal_allocation.x +
- widget->style->klass->xthickness);
+ widget->style->xthickness);
attributes.y = (clist->internal_allocation.y +
- widget->style->klass->ythickness +
+ widget->style->ythickness +
clist->column_title_area.height);
attributes.width = clist->clist_window_width;
attributes.height = clist->clist_window_height;
@@ -4801,9 +4801,9 @@ gtk_clist_draw (GtkWidget *widget,
GTK_STATE_NORMAL, clist->shadow_type,
0, 0,
clist->clist_window_width +
- (2 * widget->style->klass->xthickness),
+ (2 * widget->style->xthickness),
clist->clist_window_height +
- (2 * widget->style->klass->ythickness) +
+ (2 * widget->style->ythickness) +
clist->column_title_area.height);
gdk_window_clear_area (clist->clist_window, 0, 0, 0, 0);
@@ -4840,9 +4840,9 @@ gtk_clist_expose (GtkWidget *widget,
GTK_STATE_NORMAL, clist->shadow_type,
0, 0,
clist->clist_window_width +
- (2 * widget->style->klass->xthickness),
+ (2 * widget->style->xthickness),
clist->clist_window_height +
- (2 * widget->style->klass->ythickness) +
+ (2 * widget->style->ythickness) +
clist->column_title_area.height);
/* exposure events on the list */
@@ -5441,11 +5441,11 @@ gtk_clist_size_request (GtkWidget *widget,
MAX (clist->column_title_area.height,
child_requisition.height);
}
-
- requisition->width += (widget->style->klass->xthickness +
+
+ requisition->width += (widget->style->xthickness +
GTK_CONTAINER (widget)->border_width) * 2;
requisition->height += (clist->column_title_area.height +
- (widget->style->klass->ythickness +
+ (widget->style->ythickness +
GTK_CONTAINER (widget)->border_width) * 2);
/* if (!clist->hadjustment) */
@@ -5491,14 +5491,14 @@ gtk_clist_size_allocate (GtkWidget *widget,
/* allocate clist window assuming no scrollbars */
clist_allocation.x = (clist->internal_allocation.x +
- widget->style->klass->xthickness);
+ widget->style->xthickness);
clist_allocation.y = (clist->internal_allocation.y +
- widget->style->klass->ythickness +
+ widget->style->ythickness +
clist->column_title_area.height);
clist_allocation.width = MAX (1, (gint)clist->internal_allocation.width -
- (2 * (gint)widget->style->klass->xthickness));
+ (2 * (gint)widget->style->xthickness));
clist_allocation.height = MAX (1, (gint)clist->internal_allocation.height -
- (2 * (gint)widget->style->klass->ythickness) -
+ (2 * (gint)widget->style->ythickness) -
(gint)clist->column_title_area.height);
clist->clist_window_width = clist_allocation.width;
@@ -5514,8 +5514,8 @@ gtk_clist_size_allocate (GtkWidget *widget,
}
/* position the window which holds the column title buttons */
- clist->column_title_area.x = widget->style->klass->xthickness;
- clist->column_title_area.y = widget->style->klass->ythickness;
+ clist->column_title_area.x = widget->style->xthickness;
+ clist->column_title_area.y = widget->style->ythickness;
clist->column_title_area.width = clist_allocation.width;
if (GTK_WIDGET_REALIZED (widget))
@@ -5921,7 +5921,7 @@ draw_row (GtkCList *clist,
offset,
row_rectangle.y + row_center_offset + clist_row->cell[i].vertical,
layout);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
gdk_gc_set_clip_rectangle (fg_gc, NULL);
}
break;
@@ -6016,7 +6016,7 @@ draw_xor_line (GtkCList *clist)
gdk_draw_line (widget->window, clist->xor_gc,
clist->x_drag,
- widget->style->klass->ythickness,
+ widget->style->ythickness,
clist->x_drag,
clist->column_title_area.height +
clist->clist_window_height + 1);
@@ -7484,7 +7484,7 @@ drag_dest_cell (GtkCList *clist,
dest_info->insert_pos = GTK_CLIST_DRAG_NONE;
y -= (GTK_CONTAINER (clist)->border_width +
- widget->style->klass->ythickness +
+ widget->style->ythickness +
clist->column_title_area.height);
dest_info->cell.row = ROW_FROM_YPIXEL (clist, y);
@@ -7495,8 +7495,9 @@ drag_dest_cell (GtkCList *clist,
}
if (dest_info->cell.row < -1)
dest_info->cell.row = -1;
+
+ x -= GTK_CONTAINER (widget)->border_width + widget->style->xthickness;
- x -= GTK_CONTAINER (widget)->border_width + widget->style->klass->xthickness;
dest_info->cell.column = COLUMN_FROM_XPIXEL (clist, x);
if (dest_info->cell.row >= 0)
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index fc0f267b01..32b19ae622 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -325,17 +325,17 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
list_requisition.height += EMPTY_LIST_HEIGHT;
alloc_width = (widget->allocation.width -
- 2 * popwin->child->style->klass->xthickness -
+ 2 * popwin->child->style->xthickness -
2 * GTK_CONTAINER (popwin->child)->border_width -
2 * GTK_CONTAINER (combo->popup)->border_width -
2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width -
- 2 * GTK_BIN (popup)->child->style->klass->xthickness);
+ 2 * GTK_BIN (popup)->child->style->xthickness);
- work_height = (2 * popwin->child->style->klass->ythickness +
+ work_height = (2 * popwin->child->style->ythickness +
2 * GTK_CONTAINER (popwin->child)->border_width +
2 * GTK_CONTAINER (combo->popup)->border_width +
2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width +
- 2 * GTK_BIN (popup)->child->style->klass->xthickness);
+ 2 * GTK_BIN (popup)->child->style->xthickness);
do
{
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index ec2eca9736..ab2164c5c1 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -59,9 +59,6 @@ struct _GtkChildArgInfo
guint seq_id;
};
-/* The global list of toplevel windows */
-static GList *toplevel_list = NULL;
-
static void gtk_container_base_class_init (GtkContainerClass *klass);
static void gtk_container_class_init (GtkContainerClass *klass);
static void gtk_container_init (GtkContainer *container);
diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c
index 91db6ecd58..619959d4df 100644
--- a/gtk/gtkctree.c
+++ b/gtk/gtkctree.c
@@ -1880,7 +1880,7 @@ draw_row (GtkCList *clist,
row_rectangle.y + row_center_offset + clist_row->cell[i].vertical,
layout);
gdk_gc_set_clip_rectangle (fg_gc, NULL);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
break;
default:
@@ -1901,7 +1901,7 @@ draw_row (GtkCList *clist,
&intersect_rectangle))
{
if (layout)
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
continue;
}
@@ -1955,7 +1955,7 @@ draw_row (GtkCList *clist,
row_rectangle.y + row_center_offset + clist_row->cell[i].vertical,
layout);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
gdk_gc_set_clip_rectangle (fg_gc, NULL);
}
@@ -2820,7 +2820,7 @@ cell_size_request (GtkCList *clist,
requisition->width = logical_rect.width / PANGO_SCALE;
requisition->height = logical_rect.height / PANGO_SCALE;
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
else
{
@@ -5879,7 +5879,7 @@ drag_dest_cell (GtkCList *clist,
dest_info->insert_pos = GTK_CLIST_DRAG_NONE;
y -= (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->ythickness + clist->column_title_area.height);
+ widget->style->ythickness + clist->column_title_area.height);
dest_info->cell.row = ROW_FROM_YPIXEL (clist, y);
if (dest_info->cell.row >= clist->rows)
@@ -5889,8 +5889,9 @@ drag_dest_cell (GtkCList *clist,
}
if (dest_info->cell.row < -1)
dest_info->cell.row = -1;
+
+ x -= GTK_CONTAINER (widget)->border_width + widget->style->xthickness;
- x -= GTK_CONTAINER (widget)->border_width + widget->style->klass->xthickness;
dest_info->cell.column = COLUMN_FROM_XPIXEL (clist, x);
if (dest_info->cell.row >= 0)
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 5de66cfa2f..0cd1bf863c 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -993,8 +993,8 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
info->proxy_data = NULL;
info->dropped = FALSE;
info->proxy_drop_wait = FALSE;
- g_dataset_set_data_full (context,
- "gtk-info",
+ g_object_set_qdata_full (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"),
info,
gtk_drag_dest_info_destroy);
}
@@ -1127,7 +1127,7 @@ gtk_drag_selection_received (GtkWidget *widget,
drop_widget = data;
context = gtk_object_get_data (GTK_OBJECT (widget), "drag-context");
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context), g_quark_from_static_string ("gtk-info"));
if (info->proxy_data &&
info->proxy_data->target == selection_data->target)
@@ -1345,7 +1345,9 @@ gtk_drag_proxy_begin (GtkWidget *widget,
source_info->proxy_dest = dest_info;
- g_dataset_set_data (source_info->context, "gtk-info", source_info);
+ g_object_set_qdata (G_OBJECT (source_info->context),
+ g_quark_from_static_string ("gtk-info"),
+ source_info);
gtk_signal_connect (GTK_OBJECT (source_info->ipc_widget),
"selection_get",
@@ -1396,7 +1398,8 @@ gtk_drag_dest_leave (GtkWidget *widget,
if (site->do_proxy)
{
- GtkDragDestInfo *info = g_dataset_get_data (context, "gtk-info");
+ GtkDragDestInfo *info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (info->proxy_source && !info->dropped)
gdk_drag_abort (info->proxy_source->context, time);
@@ -1437,7 +1440,8 @@ gtk_drag_dest_motion (GtkWidget *widget,
GdkWindow *dest_window;
GdkDragProtocol proto;
- GtkDragDestInfo *info = g_dataset_get_data (context, "gtk-info");
+ GtkDragDestInfo *info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (!info->proxy_source)
gtk_drag_proxy_begin (widget, info);
@@ -1534,7 +1538,8 @@ gtk_drag_dest_drop (GtkWidget *widget,
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
g_return_val_if_fail (site != NULL, FALSE);
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
g_return_val_if_fail (info != NULL, FALSE);
info->drop_x = x;
@@ -1677,7 +1682,8 @@ gtk_drag_begin (GtkWidget *widget,
info->context = gdk_drag_begin (info->ipc_widget->window, targets);
g_list_free (targets);
- g_dataset_set_data (info->context, "gtk-info", info);
+ g_object_set_qdata (G_OBJECT (info->context),
+ g_quark_from_static_string ("gtk-info"), info);
info->button = button;
info->target_list = target_list;
@@ -1913,7 +1919,8 @@ gtk_drag_set_icon_window (GdkDragContext *context,
g_return_if_fail (context != NULL);
g_return_if_fail (widget != NULL);
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
gtk_drag_remove_icon (info);
info->icon_window = widget;
@@ -2106,7 +2113,8 @@ gtk_drag_source_handle_event (GtkWidget *widget,
g_return_if_fail (event != NULL);
context = event->dnd.context;
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (!info)
return;
@@ -2285,7 +2293,8 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
/* Mark the context as dead, so if the destination decides
* to respond really late, we still are OK.
*/
- g_dataset_set_data (info->context, "gtk-info", NULL);
+ g_object_set_qdata (G_OBJECT (info->context),
+ g_quark_from_static_string ("gtk-info"), NULL);
gtk_timeout_add (ANIM_STEP_TIME, gtk_drag_anim_timeout, anim);
}
}
@@ -2419,7 +2428,8 @@ gtk_drag_source_event_cb (GtkWidget *widget,
i, event);
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (!info->icon_window)
{
@@ -2594,7 +2604,7 @@ gtk_drag_source_info_destroy (gpointer data)
gtk_target_list_unref (info->target_list);
- g_dataset_set_data (info->context, "gtk-info", NULL);
+ g_object_set_qdata (G_OBJECT (info->context), g_quark_from_static_string ("gtk-info"), NULL);
gdk_drag_context_unref (info->context);
if (info->drop_timeout)
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 9dfe3e3e2c..25e2dbdc9b 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -510,7 +510,7 @@ gtk_entry_finalize (GObject *object)
entry = GTK_ENTRY (object);
if (entry->layout)
- pango_layout_unref (entry->layout);
+ g_object_unref (G_OBJECT (entry->layout));
gtk_object_unref (GTK_OBJECT (entry->im_context));
@@ -568,8 +568,8 @@ gtk_entry_realize (GtkWidget *widget)
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, entry);
- attributes.x = widget->style->klass->xthickness;
- attributes.y = widget->style->klass->ythickness;
+ attributes.x = widget->style->xthickness;
+ attributes.y = widget->style->ythickness;
attributes.width = widget->allocation.width - attributes.x * 2;
attributes.height = requisition.height - attributes.y * 2;
attributes.cursor = entry->cursor = gdk_cursor_new (GDK_XTERM);
@@ -668,12 +668,12 @@ gtk_entry_size_request (GtkWidget *widget,
g_return_if_fail (requisition != NULL);
entry = GTK_ENTRY (widget);
-
+
/* We do this to deal with direction changes - should that be a signal?
*/
if (entry->layout)
{
- pango_layout_unref (entry->layout);
+ g_object_unref (G_OBJECT (entry->layout));
entry->layout = NULL;
}
@@ -691,9 +691,9 @@ gtk_entry_size_request (GtkWidget *widget,
entry->ascent = metrics.ascent;
- requisition->width = MIN_ENTRY_WIDTH + (widget->style->klass->xthickness + INNER_BORDER) * 2;
+ requisition->width = MIN_ENTRY_WIDTH + (widget->style->xthickness + INNER_BORDER) * 2;
requisition->height = ((metrics.ascent + metrics.descent) / PANGO_SCALE +
- (widget->style->klass->ythickness + INNER_BORDER) * 2);
+ (widget->style->ythickness + INNER_BORDER) * 2);
}
static void
@@ -725,10 +725,10 @@ gtk_entry_size_allocate (GtkWidget *widget,
allocation->y + (allocation->height - requisition.height) / 2,
allocation->width, requisition.height);
gdk_window_move_resize (entry->text_area,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- allocation->width - widget->style->klass->xthickness * 2,
- requisition.height - widget->style->klass->ythickness * 2);
+ widget->style->xthickness,
+ widget->style->ythickness,
+ allocation->width - widget->style->xthickness * 2,
+ requisition.height - widget->style->ythickness * 2);
}
@@ -752,8 +752,8 @@ gtk_entry_draw (GtkWidget *widget,
{
GdkRectangle tmp_area = *area;
- tmp_area.x -= widget->style->klass->xthickness;
- tmp_area.y -= widget->style->klass->xthickness;
+ tmp_area.x -= widget->style->xthickness;
+ tmp_area.y -= widget->style->xthickness;
gdk_window_begin_paint_rect (entry->text_area, &tmp_area);
gtk_widget_draw_focus (widget);
@@ -1377,7 +1377,7 @@ entry_adjust_scroll (GtkEntry *entry)
g_return_if_fail (GTK_IS_ENTRY (entry));
widget = GTK_WIDGET (entry);
- text_area_width = widget->allocation.width - 2 * (widget->style->klass->xthickness + INNER_BORDER);
+ text_area_width = widget->allocation.width - 2 * (widget->style->xthickness + INNER_BORDER);
if (!entry->layout)
return;
diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c
index 90c249268a..34a9f95165 100644
--- a/gtk/gtkfontsel.c
+++ b/gtk/gtkfontsel.c
@@ -348,7 +348,7 @@ gtk_font_selection_finalize (GObject *object)
fontsel = GTK_FONT_SELECTION (object);
- pango_context_unref (fontsel->context);
+ g_object_unref (G_OBJECT (fontsel->context));
pango_font_description_free (fontsel->font_desc);
if (fontsel->font)
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 03f1be3fb2..dc58e68f82 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -374,10 +374,10 @@ gtk_frame_paint (GtkWidget *widget,
{
frame = GTK_FRAME (widget);
- x = frame->child_allocation.x - widget->style->klass->xthickness;
- y = frame->child_allocation.y - widget->style->klass->ythickness;
- width = frame->child_allocation.width + 2 * widget->style->klass->xthickness;
- height = frame->child_allocation.height + 2 * widget->style->klass->ythickness;
+ x = frame->child_allocation.x - widget->style->xthickness;
+ y = frame->child_allocation.y - widget->style->ythickness;
+ width = frame->child_allocation.width + 2 * widget->style->xthickness;
+ height = frame->child_allocation.height + 2 * widget->style->ythickness;
if (frame->label_widget)
{
@@ -393,7 +393,7 @@ gtk_frame_paint (GtkWidget *widget,
else
xalign = 1 - frame->label_xalign;
- height_extra = MAX (0, child_requisition.height - widget->style->klass->xthickness);
+ height_extra = MAX (0, child_requisition.height - widget->style->xthickness);
y -= height_extra * (1 - frame->label_yalign);
height += height_extra * (1 - frame->label_yalign);
@@ -478,7 +478,7 @@ gtk_frame_size_request (GtkWidget *widget,
requisition->width = child_requisition.width;
requisition->height =
- MAX (0, child_requisition.height - GTK_WIDGET (widget)->style->klass->xthickness);
+ MAX (0, child_requisition.height - GTK_WIDGET (widget)->style->xthickness);
}
else
{
@@ -495,9 +495,9 @@ gtk_frame_size_request (GtkWidget *widget,
}
requisition->width += (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2;
+ GTK_WIDGET (widget)->style->xthickness) * 2;
requisition->height += (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2;
+ GTK_WIDGET (widget)->style->ythickness) * 2;
}
static void
@@ -602,19 +602,19 @@ gtk_frame_real_compute_child_allocation (GtkFrame *frame,
if (frame->label_widget)
{
gtk_widget_get_child_requisition (frame->label_widget, &child_requisition);
- top_margin = MAX (child_requisition.height, widget->style->klass->ythickness);
+ top_margin = MAX (child_requisition.height, widget->style->ythickness);
}
else
- top_margin = widget->style->klass->ythickness;
+ top_margin = widget->style->ythickness;
child_allocation->x = (GTK_CONTAINER (frame)->border_width +
- widget->style->klass->xthickness);
+ widget->style->xthickness);
child_allocation->width = MAX(1, (gint)allocation->width - child_allocation->x * 2);
child_allocation->y = (GTK_CONTAINER (frame)->border_width + top_margin);
child_allocation->height = MAX (1, ((gint)allocation->height - child_allocation->y -
(gint)GTK_CONTAINER (frame)->border_width -
- (gint)widget->style->klass->ythickness));
+ (gint)widget->style->ythickness));
child_allocation->x += allocation->x;
child_allocation->y += allocation->y;
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index ef2d7ad0c2..3060dfb53c 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -515,9 +515,9 @@ gtk_handle_box_size_request (GtkWidget *widget,
{
if (hb->handle_position == GTK_POS_LEFT ||
hb->handle_position == GTK_POS_RIGHT)
- requisition->height += widget->style->klass->ythickness;
+ requisition->height += widget->style->ythickness;
else
- requisition->width += widget->style->klass->xthickness;
+ requisition->width += widget->style->xthickness;
}
}
else
diff --git a/gtk/gtkhruler.c b/gtk/gtkhruler.c
index 701aeb2139..8ddc5399bd 100644
--- a/gtk/gtkhruler.c
+++ b/gtk/gtkhruler.c
@@ -92,8 +92,8 @@ gtk_hruler_init (GtkHRuler *hruler)
GtkWidget *widget;
widget = GTK_WIDGET (hruler);
- widget->requisition.width = widget->style->klass->xthickness * 2 + 1;
- widget->requisition.height = widget->style->klass->ythickness * 2 + RULER_HEIGHT;
+ widget->requisition.width = widget->style->xthickness * 2 + 1;
+ widget->requisition.height = widget->style->ythickness * 2 + RULER_HEIGHT;
}
@@ -166,8 +166,8 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
font = widget->style->font;
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
+ xthickness = widget->style->xthickness;
+ ythickness = widget->style->ythickness;
digit_height = ink_rect.height / PANGO_SCALE + 2;
digit_offset = ink_rect.y;
@@ -269,7 +269,7 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
}
}
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
static void
@@ -293,8 +293,8 @@ gtk_hruler_draw_pos (GtkRuler *ruler)
widget = GTK_WIDGET (ruler);
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
+ xthickness = widget->style->xthickness;
+ ythickness = widget->style->ythickness;
width = widget->allocation.width;
height = widget->allocation.height - ythickness * 2;
diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c
index 30044b8bb2..b1e0f8c8fb 100644
--- a/gtk/gtkhscale.c
+++ b/gtk/gtkhscale.c
@@ -321,10 +321,10 @@ gtk_hscale_size_request (GtkWidget *widget,
scale = GTK_SCALE (widget);
requisition->width = (SCALE_CLASS (scale)->slider_length +
- widget->style->klass->xthickness) * 2;
+ widget->style->xthickness) * 2;
requisition->height = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->ythickness * 2);
-
+ widget->style->ythickness * 2);
+
if (scale->draw_value)
{
gint value_width, value_height;
@@ -393,7 +393,7 @@ gtk_hscale_pos_trough (GtkHScale *hscale,
*w = widget->allocation.width;
*h = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->ythickness * 2);
+ widget->style->ythickness * 2);
if (scale->draw_value)
{
@@ -586,7 +586,7 @@ gtk_hscale_draw_value (GtkScale *scale)
GTK_WIDGET (scale)->style->fg_gc [state_type],
x, y, layout);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
}
diff --git a/gtk/gtkhscrollbar.c b/gtk/gtkhscrollbar.c
index 95eb6eca3f..73099b558e 100644
--- a/gtk/gtkhscrollbar.c
+++ b/gtk/gtkhscrollbar.c
@@ -165,9 +165,9 @@ gtk_hscrollbar_init (GtkHScrollbar *hscrollbar)
requisition->width = (RANGE_CLASS (widget)->min_slider_size +
RANGE_CLASS (widget)->stepper_size +
RANGE_CLASS (widget)->stepper_slider_spacing +
- widget->style->klass->xthickness) * 2;
+ widget->style->xthickness) * 2;
requisition->height = (RANGE_CLASS (widget)->slider_width +
- widget->style->klass->ythickness * 2);
+ widget->style->ythickness * 2);
}
GtkWidget*
@@ -217,21 +217,21 @@ gtk_hscrollbar_realize (GtkWidget *widget)
range->trough = widget->window;
gdk_window_ref (range->trough);
- attributes.x = widget->style->klass->xthickness;
- attributes.y = widget->style->klass->ythickness;
+ attributes.x = widget->style->xthickness;
+ attributes.y = widget->style->ythickness;
attributes.width = RANGE_CLASS (widget)->stepper_size;
attributes.height = RANGE_CLASS (widget)->stepper_size;
range->step_back = gdk_window_new (range->trough, &attributes, attributes_mask);
attributes.x = (widget->allocation.width -
- widget->style->klass->xthickness -
+ widget->style->xthickness -
RANGE_CLASS (widget)->stepper_size);
range->step_forw = gdk_window_new (range->trough, &attributes, attributes_mask);
attributes.x = 0;
- attributes.y = widget->style->klass->ythickness;
+ attributes.y = widget->style->ythickness;
attributes.width = RANGE_CLASS (widget)->min_slider_size;
attributes.height = RANGE_CLASS (widget)->slider_width;
attributes.event_mask |= (GDK_BUTTON_MOTION_MASK |
@@ -279,16 +279,16 @@ gtk_hscrollbar_size_allocate (GtkWidget *widget,
allocation->y + (allocation->height - widget->requisition.height) / 2,
allocation->width, widget->requisition.height);
gdk_window_move_resize (range->step_back,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
+ widget->style->xthickness,
+ widget->style->ythickness,
RANGE_CLASS (widget)->stepper_size,
- widget->requisition.height - widget->style->klass->ythickness * 2);
+ widget->requisition.height - widget->style->ythickness * 2);
gdk_window_move_resize (range->step_forw,
- allocation->width - widget->style->klass->xthickness -
+ allocation->width - widget->style->xthickness -
RANGE_CLASS (widget)->stepper_size,
- widget->style->klass->ythickness,
+ widget->style->ythickness,
RANGE_CLASS (widget)->stepper_size,
- widget->requisition.height - widget->style->klass->ythickness * 2);
+ widget->requisition.height - widget->style->ythickness * 2);
gtk_range_slider_update (GTK_RANGE (widget));
}
diff --git a/gtk/gtkhseparator.c b/gtk/gtkhseparator.c
index 7d28457938..7fc9bafd65 100644
--- a/gtk/gtkhseparator.c
+++ b/gtk/gtkhseparator.c
@@ -72,7 +72,7 @@ static void
gtk_hseparator_init (GtkHSeparator *hseparator)
{
GTK_WIDGET (hseparator)->requisition.width = 1;
- GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->klass->ythickness;
+ GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->ythickness;
}
GtkWidget*
@@ -96,7 +96,7 @@ gtk_hseparator_expose (GtkWidget *widget,
widget->allocation.x,
widget->allocation.x + widget->allocation.width,
widget->allocation.y + (widget->allocation.height -
- widget->style->klass->ythickness) / 2);
+ widget->style->ythickness) / 2);
return FALSE;
}
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 823dcb4970..47b9680639 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -265,7 +265,7 @@ gtk_label_set_justify (GtkLabel *label,
if (label->layout)
{
/* No real need to be this drastic, but easier than duplicating the code */
- pango_layout_unref (label->layout);
+ g_object_unref (G_OBJECT (label->layout));
label->layout = NULL;
}
@@ -313,7 +313,7 @@ gtk_label_finalize (GObject *object)
g_free (label->pattern);
if (label->layout)
- pango_layout_unref (label->layout);
+ g_object_unref (G_OBJECT (label->layout));
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -401,7 +401,7 @@ gtk_label_size_request (GtkWidget *widget,
label->layout)
{
label->rtl = !label->rtl;
- pango_layout_unref (label->layout);
+ g_object_unref (G_OBJECT (label->layout));
label->layout = NULL;
}
@@ -546,7 +546,7 @@ gtk_label_style_set (GtkWidget *widget,
if (previous_style && label->layout)
{
- pango_layout_unref (label->layout);
+ g_object_unref (G_OBJECT (label->layout));
label->layout = NULL;
}
}
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index 8482cde215..b06aa32aac 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -403,7 +403,7 @@ gtk_list_item_size_request (GtkWidget *widget,
bin = GTK_BIN (widget);
requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness) * 2;
+ widget->style->xthickness) * 2;
requisition->height = GTK_CONTAINER (widget)->border_width * 2;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
@@ -437,7 +437,7 @@ gtk_list_item_size_allocate (GtkWidget *widget,
if (bin->child)
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness);
+ widget->style->xthickness);
child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.width = allocation->width - child_allocation.x * 2;
child_allocation.height = allocation->height - child_allocation.y * 2;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 7de4f13f30..3362785216 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -862,9 +862,9 @@ gtk_menu_size_request (GtkWidget *widget,
requisition->width += max_toggle_size + max_accel_width;
requisition->width += (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->xthickness) * 2;
+ widget->style->xthickness) * 2;
requisition->height += (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->ythickness) * 2;
+ widget->style->ythickness) * 2;
children = menu_shell->children;
while (children)
@@ -903,9 +903,9 @@ gtk_menu_size_allocate (GtkWidget *widget,
if (menu_shell->children)
{
child_allocation.x = (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->xthickness);
+ widget->style->xthickness);
child_allocation.y = (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->ythickness);
+ widget->style->ythickness);
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
children = menu_shell->children;
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index ecaeb3a03d..78a1e91532 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -257,10 +257,10 @@ gtk_menu_bar_size_request (GtkWidget *widget,
}
requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->xthickness +
+ widget->style->xthickness +
BORDER_SPACING) * 2;
requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->ythickness +
+ widget->style->ythickness +
BORDER_SPACING) * 2;
if (nchildren > 0)
@@ -296,12 +296,12 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
if (menu_shell->children)
{
child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->xthickness +
+ widget->style->xthickness +
BORDER_SPACING);
offset = child_allocation.x; /* Window edge to menubar start */
child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->ythickness +
+ widget->style->ythickness +
BORDER_SPACING);
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index c8e0cfd2f0..9459a8d1a4 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -348,10 +348,10 @@ gtk_menu_item_size_request (GtkWidget *widget,
menu_item = GTK_MENU_ITEM (widget);
requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness +
+ widget->style->xthickness +
BORDER_SPACING) * 2;
requisition->height = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->ythickness) * 2;
+ widget->style->ythickness) * 2;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
@@ -393,10 +393,10 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
if (bin->child)
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness +
+ widget->style->xthickness +
BORDER_SPACING);
child_allocation.y = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->ythickness);
+ widget->style->ythickness);
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index be49dc6ea2..54819e0608 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -647,8 +647,8 @@ gtk_notebook_size_request (GtkWidget *widget,
if (notebook->show_border || notebook->show_tabs)
{
- widget->requisition.width += widget->style->klass->xthickness * 2;
- widget->requisition.height += widget->style->klass->ythickness * 2;
+ widget->requisition.width += widget->style->xthickness * 2;
+ widget->requisition.height += widget->style->ythickness * 2;
if (notebook->show_tabs)
{
@@ -672,10 +672,10 @@ gtk_notebook_size_request (GtkWidget *widget,
page->requisition.width =
child_requisition.width +
- 2 * widget->style->klass->xthickness;
+ 2 * widget->style->xthickness;
page->requisition.height =
child_requisition.height +
- 2 * widget->style->klass->ythickness;
+ 2 * widget->style->ythickness;
switch (notebook->tab_pos)
{
@@ -880,12 +880,12 @@ gtk_notebook_size_allocate (GtkWidget *widget,
if (notebook->show_tabs || notebook->show_border)
{
- child_allocation.x += widget->style->klass->xthickness;
- child_allocation.y += widget->style->klass->ythickness;
+ child_allocation.x += widget->style->xthickness;
+ child_allocation.y += widget->style->ythickness;
child_allocation.width = MAX (1, (gint)child_allocation.width -
- (gint) widget->style->klass->xthickness * 2);
+ (gint) widget->style->xthickness * 2);
child_allocation.height = MAX (1, (gint)child_allocation.height -
- (gint) widget->style->klass->ythickness * 2);
+ (gint) widget->style->ythickness * 2);
if (notebook->show_tabs && notebook->children && notebook->cur_page)
{
@@ -1881,28 +1881,28 @@ gtk_notebook_expose_tabs (GtkNotebook *notebook)
case GTK_POS_BOTTOM:
event.area.y = (widget->allocation.height - border -
page->allocation.height -
- widget->style->klass->ythickness);
+ widget->style->ythickness);
if (page != notebook->cur_page)
- event.area.y -= widget->style->klass->ythickness;
+ event.area.y -= widget->style->ythickness;
case GTK_POS_TOP:
event.area.width = widget->allocation.width - 2 * border;
event.area.height = (page->allocation.height +
- widget->style->klass->ythickness);
+ widget->style->ythickness);
if (page != notebook->cur_page)
- event.area.height += widget->style->klass->ythickness;
+ event.area.height += widget->style->ythickness;
break;
case GTK_POS_RIGHT:
event.area.x = (widget->allocation.width - border -
page->allocation.width -
- widget->style->klass->xthickness);
+ widget->style->xthickness);
if (page != notebook->cur_page)
- event.area.x -= widget->style->klass->xthickness;
+ event.area.x -= widget->style->xthickness;
case GTK_POS_LEFT:
event.area.width = (page->allocation.width +
- widget->style->klass->xthickness);
+ widget->style->xthickness);
event.area.height = widget->allocation.height - 2 * border;
if (page != notebook->cur_page)
- event.area.width += widget->style->klass->xthickness;
+ event.area.width += widget->style->xthickness;
break;
}
gtk_widget_event (widget, (GdkEvent *) &event);
@@ -2238,14 +2238,14 @@ gtk_notebook_paint (GtkWidget *widget,
switch (notebook->tab_pos)
{
case GTK_POS_TOP:
- y += page->allocation.height + widget->style->klass->ythickness;
+ y += page->allocation.height + widget->style->ythickness;
case GTK_POS_BOTTOM:
- height -= page->allocation.height + widget->style->klass->ythickness;
+ height -= page->allocation.height + widget->style->ythickness;
break;
case GTK_POS_LEFT:
- x += page->allocation.width + widget->style->klass->xthickness;
+ x += page->allocation.width + widget->style->xthickness;
case GTK_POS_RIGHT:
- width -= page->allocation.width + widget->style->klass->xthickness;
+ width -= page->allocation.width + widget->style->xthickness;
break;
}
gtk_paint_box (widget->style, widget->window,
@@ -2511,17 +2511,17 @@ gtk_notebook_set_shape (GtkNotebook *notebook)
{
case GTK_POS_TOP:
y += page->allocation.height +
- widget->style->klass->ythickness;
+ widget->style->ythickness;
case GTK_POS_BOTTOM:
height -= page->allocation.height +
- widget->style->klass->ythickness;
+ widget->style->ythickness;
break;
case GTK_POS_LEFT:
x += page->allocation.width +
- widget->style->klass->xthickness;
+ widget->style->xthickness;
case GTK_POS_RIGHT:
width -= page->allocation.width +
- widget->style->klass->xthickness;
+ widget->style->xthickness;
break;
}
}
@@ -2536,11 +2536,11 @@ gtk_notebook_set_shape (GtkNotebook *notebook)
{
if (notebook->tab_pos == GTK_POS_LEFT)
{
- x -= widget->style->klass->xthickness * 2;
- width += widget->style->klass->xthickness * 2;
+ x -= widget->style->xthickness * 2;
+ width += widget->style->xthickness * 2;
}
else if (notebook->tab_pos == GTK_POS_RIGHT)
- width += widget->style->klass->xthickness * 2;
+ width += widget->style->xthickness * 2;
}
switch (notebook->tab_pos)
{
@@ -3061,8 +3061,8 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
widget = GTK_WIDGET (notebook);
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
+ xthickness = widget->style->xthickness;
+ ythickness = widget->style->ythickness;
/* If the size of the notebook tabs change, we need to queue
* a redraw on the tab area
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index f5cff3bf4d..7bb65919a5 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -296,13 +296,13 @@ gtk_option_menu_size_request (GtkWidget *widget,
option_menu = GTK_OPTION_MENU (widget);
requisition->width = ((GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2 +
+ GTK_WIDGET (widget)->style->xthickness) * 2 +
option_menu->width +
OPTION_INDICATOR_WIDTH +
OPTION_INDICATOR_SPACING * 5 +
CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING + 2);
requisition->height = ((GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->ythickness) * 2 +
+ GTK_WIDGET (widget)->style->ythickness) * 2 +
option_menu->height +
CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING + 2);
@@ -332,9 +332,9 @@ gtk_option_menu_size_allocate (GtkWidget *widget,
if (child && GTK_WIDGET_VISIBLE (child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) + 1;
+ GTK_WIDGET (widget)->style->xthickness) + 1;
child_allocation.y = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->ythickness) + 1;
+ GTK_WIDGET (widget)->style->ythickness) + 1;
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2 -
OPTION_INDICATOR_WIDTH - OPTION_INDICATOR_SPACING * 5 -
CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING - 2);
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index ae6397e51a..000cf6b94f 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -212,7 +212,7 @@ gtk_plug_realize (GtkWidget *widget)
widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
}
- GDK_DRAWABLE_TYPE (window) = GDK_WINDOW_TOPLEVEL;
+ GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
gdk_window_set_user_data (widget->window, window);
widget->style = gtk_style_attach (widget->style, widget->window);
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 5fc2971377..a6cdade7d0 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -279,19 +279,19 @@ gtk_progress_bar_real_update (GtkProgress *progress)
pbar->activity_pos += pbar->activity_step;
if (pbar->activity_pos + size >=
widget->allocation.width -
- widget->style->klass->xthickness)
+ widget->style->xthickness)
{
pbar->activity_pos = widget->allocation.width -
- widget->style->klass->xthickness - size;
+ widget->style->xthickness - size;
pbar->activity_dir = 1;
}
}
else
{
pbar->activity_pos -= pbar->activity_step;
- if (pbar->activity_pos <= widget->style->klass->xthickness)
+ if (pbar->activity_pos <= widget->style->xthickness)
{
- pbar->activity_pos = widget->style->klass->xthickness;
+ pbar->activity_pos = widget->style->xthickness;
pbar->activity_dir = 0;
}
}
@@ -305,19 +305,19 @@ gtk_progress_bar_real_update (GtkProgress *progress)
pbar->activity_pos += pbar->activity_step;
if (pbar->activity_pos + size >=
widget->allocation.height -
- widget->style->klass->ythickness)
+ widget->style->ythickness)
{
pbar->activity_pos = widget->allocation.height -
- widget->style->klass->ythickness - size;
+ widget->style->ythickness - size;
pbar->activity_dir = 1;
}
}
else
{
pbar->activity_pos -= pbar->activity_step;
- if (pbar->activity_pos <= widget->style->klass->ythickness)
+ if (pbar->activity_pos <= widget->style->ythickness)
{
- pbar->activity_pos = widget->style->klass->ythickness;
+ pbar->activity_pos = widget->style->ythickness;
pbar->activity_dir = 0;
}
}
@@ -367,7 +367,7 @@ gtk_progress_bar_size_request (GtkWidget *widget,
pango_layout_set_text (layout, buf, -1);
pango_layout_get_extents (layout, NULL, &logical_rect);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
g_free (buf);
}
@@ -377,11 +377,11 @@ gtk_progress_bar_size_request (GtkWidget *widget,
if (progress->show_text && pbar->bar_style != GTK_PROGRESS_DISCRETE)
{
requisition->width = MAX (MIN_HORIZONTAL_BAR_WIDTH,
- 2 * widget->style->klass->xthickness + 3 +
+ 2 * widget->style->xthickness + 3 +
logical_rect.width / PANGO_SCALE + 2 * TEXT_SPACING);
requisition->height = MAX (MIN_HORIZONTAL_BAR_HEIGHT,
- 2 * widget->style->klass->ythickness + 3 +
+ 2 * widget->style->ythickness + 3 +
logical_rect.height / PANGO_SCALE + 2 * TEXT_SPACING);
}
else
@@ -395,11 +395,11 @@ gtk_progress_bar_size_request (GtkWidget *widget,
if (progress->show_text && pbar->bar_style != GTK_PROGRESS_DISCRETE)
{
requisition->width = MAX (MIN_VERTICAL_BAR_WIDTH,
- 2 * widget->style->klass->xthickness + 3 +
+ 2 * widget->style->xthickness + 3 +
logical_rect.width / PANGO_SCALE + 2 * TEXT_SPACING);
requisition->height = MAX (MIN_VERTICAL_BAR_HEIGHT,
- 2 * widget->style->klass->ythickness + 3 +
+ 2 * widget->style->ythickness + 3 +
logical_rect.height / PANGO_SCALE + 2 * TEXT_SPACING);
}
else
@@ -429,14 +429,14 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
{
- pbar->activity_pos = widget->style->klass->xthickness;
+ pbar->activity_pos = widget->style->xthickness;
pbar->activity_dir = 0;
}
else
{
pbar->activity_pos = widget->allocation.width -
- widget->style->klass->xthickness - (widget->allocation.height -
- widget->style->klass->ythickness * 2);
+ widget->style->xthickness - (widget->allocation.height -
+ widget->style->ythickness * 2);
pbar->activity_dir = 1;
}
}
@@ -446,14 +446,14 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_TOP_TO_BOTTOM)
{
- pbar->activity_pos = widget->style->klass->ythickness;
+ pbar->activity_pos = widget->style->ythickness;
pbar->activity_dir = 0;
}
else
{
pbar->activity_pos = widget->allocation.height -
- widget->style->klass->ythickness - (widget->allocation.width -
- widget->style->klass->xthickness * 2);
+ widget->style->ythickness - (widget->allocation.width -
+ widget->style->xthickness * 2);
pbar->activity_dir = 1;
}
}
@@ -482,10 +482,10 @@ gtk_progress_bar_paint (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
space = widget->allocation.width -
- 2 * widget->style->klass->xthickness;
+ 2 * widget->style->xthickness;
else
space = widget->allocation.height -
- 2 * widget->style->klass->ythickness;
+ 2 * widget->style->ythickness;
percentage = gtk_progress_get_current_percentage (progress);
@@ -511,9 +511,9 @@ gtk_progress_bar_paint (GtkProgress *progress)
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
pbar->activity_pos,
- widget->style->klass->ythickness,
+ widget->style->ythickness,
size,
- widget->allocation.height - widget->style->klass->ythickness * 2);
+ widget->allocation.height - widget->style->ythickness * 2);
return;
}
else
@@ -524,9 +524,9 @@ gtk_progress_bar_paint (GtkProgress *progress)
progress->offscreen_pixmap,
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
- widget->style->klass->xthickness,
+ widget->style->xthickness,
pbar->activity_pos,
- widget->allocation.width - widget->style->klass->xthickness * 2,
+ widget->allocation.width - widget->style->xthickness * 2,
size);
return;
}
@@ -547,14 +547,14 @@ gtk_progress_bar_paint (GtkProgress *progress)
progress->offscreen_pixmap,
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
+ widget->style->xthickness,
+ widget->style->ythickness,
amount,
- widget->allocation.height - widget->style->klass->ythickness * 2);
+ widget->allocation.height - widget->style->ythickness * 2);
}
else
{
- x = widget->style->klass->xthickness;
+ x = widget->style->xthickness;
for (i = 0; i <= pbar->in_block; i++)
{
@@ -566,9 +566,9 @@ gtk_progress_bar_paint (GtkProgress *progress)
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
x,
- widget->style->klass->ythickness,
+ widget->style->ythickness,
block_delta,
- widget->allocation.height - widget->style->klass->ythickness * 2);
+ widget->allocation.height - widget->style->ythickness * 2);
x += block_delta;
}
@@ -584,16 +584,16 @@ gtk_progress_bar_paint (GtkProgress *progress)
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
widget->allocation.width -
- widget->style->klass->xthickness - amount,
- widget->style->klass->ythickness,
+ widget->style->xthickness - amount,
+ widget->style->ythickness,
amount,
widget->allocation.height -
- widget->style->klass->ythickness * 2);
+ widget->style->ythickness * 2);
}
else
{
x = widget->allocation.width -
- widget->style->klass->xthickness;
+ widget->style->xthickness;
for (i = 0; i <= pbar->in_block; i++)
{
@@ -607,10 +607,10 @@ gtk_progress_bar_paint (GtkProgress *progress)
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
x,
- widget->style->klass->ythickness,
+ widget->style->ythickness,
block_delta,
widget->allocation.height -
- widget->style->klass->ythickness * 2);
+ widget->style->ythickness * 2);
}
}
break;
@@ -623,17 +623,17 @@ gtk_progress_bar_paint (GtkProgress *progress)
progress->offscreen_pixmap,
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
- widget->style->klass->xthickness,
+ widget->style->xthickness,
widget->allocation.height -
- widget->style->klass->ythickness - amount,
+ widget->style->ythickness - amount,
widget->allocation.width -
- widget->style->klass->xthickness * 2,
+ widget->style->xthickness * 2,
amount);
}
else
{
y = widget->allocation.height -
- widget->style->klass->ythickness;
+ widget->style->ythickness;
for (i = 0; i <= pbar->in_block; i++)
{
@@ -646,10 +646,10 @@ gtk_progress_bar_paint (GtkProgress *progress)
progress->offscreen_pixmap,
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
- widget->style->klass->xthickness,
+ widget->style->xthickness,
y,
widget->allocation.width -
- widget->style->klass->xthickness * 2,
+ widget->style->xthickness * 2,
block_delta);
}
}
@@ -663,15 +663,15 @@ gtk_progress_bar_paint (GtkProgress *progress)
progress->offscreen_pixmap,
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
+ widget->style->xthickness,
+ widget->style->ythickness,
widget->allocation.width -
- widget->style->klass->xthickness * 2,
+ widget->style->xthickness * 2,
amount);
}
else
{
- y = widget->style->klass->ythickness;
+ y = widget->style->ythickness;
for (i = 0; i <= pbar->in_block; i++)
{
@@ -683,10 +683,10 @@ gtk_progress_bar_paint (GtkProgress *progress)
progress->offscreen_pixmap,
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
NULL, widget, "bar",
- widget->style->klass->xthickness,
+ widget->style->xthickness,
y,
widget->allocation.width -
- widget->style->klass->xthickness * 2,
+ widget->style->xthickness * 2,
block_delta);
y += block_delta;
@@ -714,22 +714,22 @@ gtk_progress_bar_paint (GtkProgress *progress)
pango_layout_set_text (layout, buf, -1);
pango_layout_get_extents (layout, NULL, &logical_rect);
- x = widget->style->klass->xthickness + 1 +
- (widget->allocation.width - 2 * widget->style->klass->xthickness -
+ x = widget->style->xthickness + 1 +
+ (widget->allocation.width - 2 * widget->style->xthickness -
3 - logical_rect.width / PANGO_SCALE)
* progress->x_align;
- y = widget->style->klass->ythickness + 1 +
- (widget->allocation.height - 2 * widget->style->klass->ythickness -
+ y = widget->style->ythickness + 1 +
+ (widget->allocation.height - 2 * widget->style->ythickness -
3 - logical_rect.height / PANGO_SCALE)
* progress->y_align;
- rect.x = widget->style->klass->xthickness + 1;
- rect.y = widget->style->klass->ythickness + 1;
+ rect.x = widget->style->xthickness + 1;
+ rect.y = widget->style->ythickness + 1;
rect.width = widget->allocation.width -
- 2 * widget->style->klass->xthickness - 3;
+ 2 * widget->style->xthickness - 3;
rect.height = widget->allocation.height -
- 2 * widget->style->klass->ythickness - 3;
+ 2 * widget->style->ythickness - 3;
gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state],
&rect);
@@ -740,7 +740,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state],
NULL);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
g_free (buf);
}
}
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
index 4d61ead40a..ed49696ab5 100644
--- a/gtk/gtkradiomenuitem.c
+++ b/gtk/gtkradiomenuitem.c
@@ -284,7 +284,7 @@ gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
width = 8;
height = 8;
x = (GTK_CONTAINER (check_menu_item)->border_width +
- widget->style->klass->xthickness + 2);
+ widget->style->xthickness + 2);
y = (widget->allocation.height - height) / 2;
if (check_menu_item->active ||
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 42a59fe160..bd3521634c 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -427,7 +427,7 @@ gtk_range_default_hslider_update (GtkRange *range)
else if (x > right)
x = right;
- gdk_window_move (range->slider, x, GTK_WIDGET (range)->style->klass->ythickness);
+ gdk_window_move (range->slider, x, GTK_WIDGET (range)->style->ythickness);
}
}
@@ -466,7 +466,7 @@ gtk_range_default_vslider_update (GtkRange *range)
else if (y > bottom)
y = bottom;
- gdk_window_move (range->slider, GTK_WIDGET (range)->style->klass->xthickness, y);
+ gdk_window_move (range->slider, GTK_WIDGET (range)->style->xthickness, y);
}
}
@@ -486,7 +486,7 @@ gtk_range_default_htrough_click (GtkRange *range,
g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE);
g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE);
- ythickness = GTK_WIDGET (range)->style->klass->ythickness;
+ ythickness = GTK_WIDGET (range)->style->ythickness;
gtk_range_trough_hdims (range, &left, &right);
gdk_window_get_size (range->slider, &slider_length, NULL);
@@ -532,7 +532,7 @@ gtk_range_default_vtrough_click (GtkRange *range,
g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE);
g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE);
- xthickness = GTK_WIDGET (range)->style->klass->xthickness;
+ xthickness = GTK_WIDGET (range)->style->xthickness;
gtk_range_trough_vdims (range, &top, &bottom);
gdk_window_get_size (range->slider, NULL, &slider_length);
@@ -1486,8 +1486,8 @@ gtk_range_trough_hdims (GtkRange *range,
gdk_window_get_size (range->trough, &trough_width, NULL);
gdk_window_get_size (range->slider, &slider_length, NULL);
- tleft = GTK_WIDGET (range)->style->klass->xthickness;
- tright = trough_width - slider_length - GTK_WIDGET (range)->style->klass->xthickness;
+ tleft = GTK_WIDGET (range)->style->xthickness;
+ tright = trough_width - slider_length - GTK_WIDGET (range)->style->xthickness;
if (range->step_back)
{
@@ -1523,8 +1523,8 @@ gtk_range_trough_vdims (GtkRange *range,
gdk_window_get_size (range->trough, NULL, &trough_height);
gdk_window_get_size (range->slider, NULL, &slider_length);
- ttop = GTK_WIDGET (range)->style->klass->ythickness;
- tbottom = trough_height - slider_length - GTK_WIDGET (range)->style->klass->ythickness;
+ ttop = GTK_WIDGET (range)->style->ythickness;
+ tbottom = trough_height - slider_length - GTK_WIDGET (range)->style->ythickness;
if (range->step_back)
{
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 84b7b1d675..f8b8e3870c 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -64,7 +64,6 @@
typedef struct _GtkRcSet GtkRcSet;
typedef struct _GtkRcNode GtkRcNode;
typedef struct _GtkRcFile GtkRcFile;
-typedef struct _GtkRcStylePrivate GtkRcStylePrivate;
struct _GtkRcSet
{
@@ -80,68 +79,63 @@ struct _GtkRcFile
gboolean reload;
};
-struct _GtkRcStylePrivate
-{
- GtkRcStyle style;
-
- guint ref_count;
- /* list of RC style lists including this RC style */
- GSList *rc_style_lists;
-};
-
-static guint gtk_rc_style_hash (const char *name);
-static gint gtk_rc_style_compare (const char *a,
- const char *b);
-static guint gtk_rc_styles_hash (const GSList *rc_styles);
-static gint gtk_rc_styles_compare (const GSList *a,
- const GSList *b);
-static GtkRcStyle* gtk_rc_style_find (const char *name);
-static GSList * gtk_rc_styles_match (GSList *rc_styles,
- GSList *sets,
- guint path_length,
- gchar *path,
- gchar *path_reversed);
-static GtkStyle * gtk_rc_style_to_style (GtkRcStyle *rc_style);
-static GtkStyle* gtk_rc_style_init (GSList *rc_styles);
-static void gtk_rc_parse_file (const gchar *filename,
- gboolean reload);
-
-static void gtk_rc_parse_any (const gchar *input_name,
- gint input_fd,
- const gchar *input_string);
-static guint gtk_rc_parse_statement (GScanner *scanner);
-static guint gtk_rc_parse_style (GScanner *scanner);
-static guint gtk_rc_parse_base (GScanner *scanner,
- GtkRcStyle *style);
-static guint gtk_rc_parse_bg (GScanner *scanner,
- GtkRcStyle *style);
-static guint gtk_rc_parse_fg (GScanner *scanner,
- GtkRcStyle *style);
-static guint gtk_rc_parse_text (GScanner *scanner,
- GtkRcStyle *style);
-static guint gtk_rc_parse_bg_pixmap (GScanner *scanner,
- GtkRcStyle *rc_style);
-static guint gtk_rc_parse_font (GScanner *scanner,
- GtkRcStyle *rc_style);
-static guint gtk_rc_parse_fontset (GScanner *scanner,
- GtkRcStyle *rc_style);
-static guint gtk_rc_parse_font_name (GScanner *scanner,
- GtkRcStyle *rc_style);
-static guint gtk_rc_parse_engine (GScanner *scanner,
- GtkRcStyle *rc_style);
-static guint gtk_rc_parse_pixmap_path (GScanner *scanner);
-static void gtk_rc_parse_pixmap_path_string (gchar *pix_path);
-static guint gtk_rc_parse_module_path (GScanner *scanner);
-static void gtk_rc_parse_module_path_string (gchar *mod_path);
-static guint gtk_rc_parse_path_pattern (GScanner *scanner);
-static void gtk_rc_clear_hash_node (gpointer key,
- gpointer data,
- gpointer user_data);
+static guint gtk_rc_style_hash (const char *name);
+static gint gtk_rc_style_compare (const char *a,
+ const char *b);
+static guint gtk_rc_styles_hash (const GSList *rc_styles);
+static gint gtk_rc_styles_compare (const GSList *a,
+ const GSList *b);
+static GtkRcStyle* gtk_rc_style_find (const char *name);
+static GSList * gtk_rc_styles_match (GSList *rc_styles,
+ GSList *sets,
+ guint path_length,
+ gchar *path,
+ gchar *path_reversed);
+static GtkStyle * gtk_rc_style_to_style (GtkRcStyle *rc_style);
+static GtkStyle* gtk_rc_init_style (GSList *rc_styles);
+static void gtk_rc_parse_file (const gchar *filename,
+ gboolean reload);
+static void gtk_rc_parse_any (const gchar *input_name,
+ gint input_fd,
+ const gchar *input_string);
+static guint gtk_rc_parse_statement (GScanner *scanner);
+static guint gtk_rc_parse_style (GScanner *scanner);
+static guint gtk_rc_parse_base (GScanner *scanner,
+ GtkRcStyle *style);
+static guint gtk_rc_parse_bg (GScanner *scanner,
+ GtkRcStyle *style);
+static guint gtk_rc_parse_fg (GScanner *scanner,
+ GtkRcStyle *style);
+static guint gtk_rc_parse_text (GScanner *scanner,
+ GtkRcStyle *style);
+static guint gtk_rc_parse_bg_pixmap (GScanner *scanner,
+ GtkRcStyle *rc_style);
+static guint gtk_rc_parse_font (GScanner *scanner,
+ GtkRcStyle *rc_style);
+static guint gtk_rc_parse_fontset (GScanner *scanner,
+ GtkRcStyle *rc_style);
+static guint gtk_rc_parse_font_name (GScanner *scanner,
+ GtkRcStyle *rc_style);
+static guint gtk_rc_parse_engine (GScanner *scanner,
+ GtkRcStyle *rc_style);
+static guint gtk_rc_parse_pixmap_path (GScanner *scanner);
+static void gtk_rc_parse_pixmap_path_string (gchar *pix_path);
+static guint gtk_rc_parse_module_path (GScanner *scanner);
+static void gtk_rc_parse_module_path_string (gchar *mod_path);
+static guint gtk_rc_parse_path_pattern (GScanner *scanner);
+static void gtk_rc_clear_hash_node (gpointer key,
+ gpointer data,
+ gpointer user_data);
static void gtk_rc_clear_styles (void);
static void gtk_rc_append_default_pixmap_path (void);
static void gtk_rc_append_default_module_path (void);
static void gtk_rc_add_initial_default_files (void);
+static void gtk_rc_style_init (GtkRcStyle *style);
+static void gtk_rc_style_class_init (GtkRcStyleClass *klass);
+static void gtk_rc_style_finalize (GObject *object);
+
+static gpointer parent_class = NULL;
static const GScannerConfig gtk_rc_scanner_config =
{
@@ -726,23 +720,48 @@ gtk_rc_parse (const gchar *filename)
/* Handling of RC styles */
-GtkRcStyle *
-gtk_rc_style_new (void)
+GType
+gtk_rc_style_get_type (void)
{
- GtkRcStylePrivate *new_style;
+ static GType object_type = 0;
- new_style = g_new0 (GtkRcStylePrivate, 1);
- new_style->ref_count = 1;
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (GtkRcStyleClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gtk_rc_style_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GtkRcStyle),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gtk_rc_style_init,
+ };
+
+ object_type = g_type_register_static (G_TYPE_OBJECT,
+ "GtkRcStyle",
+ &object_info);
+ }
+
+ return object_type;
+}
- return (GtkRcStyle *)new_style;
+static void
+gtk_rc_style_init (GtkRcStyle *style)
+{
+
}
-void
-gtk_rc_style_ref (GtkRcStyle *rc_style)
+static void
+gtk_rc_style_class_init (GtkRcStyleClass *klass)
{
- g_return_if_fail (rc_style != NULL);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
- ((GtkRcStylePrivate *)rc_style)->ref_count++;
+ object_class->finalize = gtk_rc_style_finalize;
}
/* Like g_slist_remove, but remove all copies of data */
@@ -783,72 +802,91 @@ gtk_rc_slist_remove_all (GSList *list,
return list;
}
-void
-gtk_rc_style_unref (GtkRcStyle *rc_style)
+static void
+gtk_rc_style_finalize (GObject *object)
{
- GtkRcStylePrivate *private = (GtkRcStylePrivate *)rc_style;
gint i;
+ GSList *tmp_list1, *tmp_list2;
+ GtkRcStyle *rc_style;
- g_return_if_fail (rc_style != NULL);
- g_return_if_fail (private->ref_count > 0);
-
- private->ref_count--;
-
- if (private->ref_count == 0)
+ rc_style = GTK_RC_STYLE (object);
+
+ if (rc_style->engine)
{
- GSList *tmp_list1, *tmp_list2;
-
- if (rc_style->engine)
- {
- rc_style->engine->destroy_rc_style (rc_style);
- gtk_theme_engine_unref (rc_style->engine);
- }
+ rc_style->engine->destroy_rc_style (rc_style);
+ gtk_theme_engine_unref (rc_style->engine);
+ }
- if (rc_style->name)
- g_free (rc_style->name);
- if (rc_style->font_desc)
- pango_font_description_free (rc_style->font_desc);
-
- for (i=0 ; i<5 ; i++)
- if (rc_style->bg_pixmap_name[i])
- g_free (rc_style->bg_pixmap_name[i]);
+ if (rc_style->name)
+ g_free (rc_style->name);
+ if (rc_style->font_desc)
+ pango_font_description_free (rc_style->font_desc);
- /* Now remove all references to this rc_style from
- * realized_style_ht
+ for (i=0 ; i<5 ; i++)
+ if (rc_style->bg_pixmap_name[i])
+ g_free (rc_style->bg_pixmap_name[i]);
+
+ /* Now remove all references to this rc_style from
+ * realized_style_ht
+ */
+ tmp_list1 = rc_style->rc_style_lists;
+ while (tmp_list1)
+ {
+ GSList *rc_styles = tmp_list1->data;
+ GtkStyle *style = g_hash_table_lookup (realized_style_ht, rc_styles);
+ gtk_style_unref (style);
+
+ /* Remove the list of styles from the other rc_styles
+ * in the list
*/
- tmp_list1 = private->rc_style_lists;
- while (tmp_list1)
- {
- GSList *rc_styles = tmp_list1->data;
- GtkStyle *style = g_hash_table_lookup (realized_style_ht, rc_styles);
- gtk_style_unref (style);
+ tmp_list2 = rc_styles;
+ while (tmp_list2)
+ {
+ GtkRcStyle *other_style = tmp_list2->data;
+
+ if (other_style != rc_style)
+ other_style->rc_style_lists =
+ gtk_rc_slist_remove_all (other_style->rc_style_lists, rc_styles);
+
+ tmp_list2 = tmp_list2->next;
+ }
- /* Remove the list of styles from the other rc_styles
- * in the list
- */
- tmp_list2 = rc_styles;
- while (tmp_list2)
- {
- GtkRcStylePrivate *other_style = tmp_list2->data;
+ /* And from the hash table itself
+ */
+ g_hash_table_remove (realized_style_ht, rc_styles);
+ g_slist_free (rc_styles);
- if (other_style != private)
- other_style->rc_style_lists =
- gtk_rc_slist_remove_all (other_style->rc_style_lists, rc_styles);
-
- tmp_list2 = tmp_list2->next;
- }
+ tmp_list1 = tmp_list1->next;
+ }
+ g_slist_free (rc_style->rc_style_lists);
- /* And from the hash table itself
- */
- g_hash_table_remove (realized_style_ht, rc_styles);
- g_slist_free (rc_styles);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
- tmp_list1 = tmp_list1->next;
- }
- g_slist_free (private->rc_style_lists);
+GtkRcStyle *
+gtk_rc_style_new (void)
+{
+ GtkRcStyle *style;
+
+ style = GTK_RC_STYLE (g_type_create_instance (gtk_rc_style_get_type ()));
+
+ return style;
+}
- g_free (private);
- }
+void
+gtk_rc_style_ref (GtkRcStyle *rc_style)
+{
+ g_return_if_fail (GTK_IS_RC_STYLE (rc_style));
+
+ g_object_ref (G_OBJECT (rc_style));
+}
+
+void
+gtk_rc_style_unref (GtkRcStyle *rc_style)
+{
+ g_return_if_fail (GTK_IS_RC_STYLE (rc_style));
+
+ g_object_unref (G_OBJECT (rc_style));
}
static void
@@ -1032,7 +1070,7 @@ gtk_rc_get_style (GtkWidget *widget)
}
if (rc_styles)
- return gtk_rc_style_init (rc_styles);
+ return gtk_rc_init_style (rc_styles);
return NULL;
}
@@ -1288,7 +1326,7 @@ gtk_rc_style_to_style (GtkRcStyle *rc_style)
/* Reuses or frees rc_styles */
static GtkStyle *
-gtk_rc_style_init (GSList *rc_styles)
+gtk_rc_init_style (GSList *rc_styles)
{
gint i;
@@ -1311,7 +1349,6 @@ gtk_rc_style_init (GSList *rc_styles)
while (tmp_styles)
{
GtkRcStyle *rc_style = tmp_styles->data;
- GtkRcStylePrivate *rc_style_private;
for (i=0; i<5; i++)
{
@@ -1359,9 +1396,8 @@ gtk_rc_style_init (GSList *rc_styles)
/* Point from each rc_style to the list of styles */
- rc_style_private = (GtkRcStylePrivate *)rc_style;
- if (!g_slist_find (rc_style_private->rc_style_lists, rc_styles))
- rc_style_private->rc_style_lists = g_slist_prepend (rc_style_private->rc_style_lists, rc_styles);
+ if (!g_slist_find (rc_style->rc_style_lists, rc_styles))
+ rc_style->rc_style_lists = g_slist_prepend (rc_style->rc_style_lists, rc_styles);
tmp_styles = tmp_styles->next;
}
diff --git a/gtk/gtkrc.h b/gtk/gtkrc.h
index 30d623cadd..2991326ca1 100644
--- a/gtk/gtkrc.h
+++ b/gtk/gtkrc.h
@@ -35,6 +35,12 @@
extern "C" {
#endif /* __cplusplus */
+#define GTK_TYPE_RC_STYLE (gtk_rc_style_get_type ())
+#define GTK_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
+#define GTK_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
+#define GTK_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
+#define GTK_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
+#define GTK_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
typedef enum {
GTK_RC_FG = 1 << 0,
@@ -43,8 +49,14 @@ typedef enum {
GTK_RC_BASE = 1 << 3
} GtkRcFlags;
+typedef struct _GtkRcStyleClass GtkRcStyleClass;
+
struct _GtkRcStyle
{
+ GObject parent_instance;
+
+ /*< public >*/
+
gchar *name;
gchar *bg_pixmap_name[5];
PangoFontDescription *font_desc;
@@ -57,6 +69,17 @@ struct _GtkRcStyle
GtkThemeEngine *engine;
gpointer engine_data;
+
+ /*< private >*/
+
+ /* list of RC style lists including this RC style */
+ GSList *rc_style_lists;
+};
+
+struct _GtkRcStyleClass
+{
+ GObjectClass parent_class;
+
};
void gtk_rc_init (void);
@@ -74,6 +97,7 @@ void gtk_rc_add_widget_class_style (GtkRcStyle *rc_style,
void gtk_rc_add_class_style (GtkRcStyle *rc_style,
const gchar *pattern);
+GType gtk_rc_style_get_type (void);
GtkRcStyle* gtk_rc_style_new (void);
void gtk_rc_style_ref (GtkRcStyle *rc_style);
void gtk_rc_style_unref (GtkRcStyle *rc_style);
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index e1099d1ca3..dd23790bd3 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -332,7 +332,7 @@ gtk_scale_get_value_size (GtkScale *scale,
if (height)
*height = MAX (*height, logical_rect.height / PANGO_SCALE);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
else
{
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index 28ffe4dce5..91bd47ec1e 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -150,14 +150,19 @@ void
gtk_socket_steal (GtkSocket *socket, GdkNativeWindow id)
{
GtkWidget *widget;
-
+ gpointer user_data = NULL;
+
widget = GTK_WIDGET (socket);
socket->plug_window = gdk_window_lookup (id);
gdk_error_trap_push ();
+
+ if (socket->plug_window)
+ gdk_window_get_user_data (socket->plug_window,
+ &user_data);
- if (socket->plug_window && socket->plug_window->user_data)
+ if (user_data)
{
/*
GtkWidget *child_widget;
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 3af3a22d71..5bb44643ca 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -427,7 +427,7 @@ gtk_spin_button_realize (GtkWidget *widget)
spin_button = GTK_SPIN_BUTTON (widget);
real_width = widget->allocation.width;
- widget->allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness;
+ widget->allocation.width -= ARROW_SIZE + 2 * widget->style->xthickness;
gtk_widget_set_events (widget, gtk_widget_get_events (widget) |
GDK_KEY_RELEASE_MASK);
GTK_WIDGET_CLASS (parent_class)->realize (widget);
@@ -446,10 +446,10 @@ gtk_spin_button_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.x = (widget->allocation.x + widget->allocation.width - ARROW_SIZE -
- 2 * widget->style->klass->xthickness);
+ 2 * widget->style->xthickness);
attributes.y = widget->allocation.y + (widget->allocation.height -
widget->requisition.height) / 2;
- attributes.width = ARROW_SIZE + 2 * widget->style->klass->xthickness;
+ attributes.width = ARROW_SIZE + 2 * widget->style->xthickness;
attributes.height = widget->requisition.height;
spin_button->panel = gdk_window_new (gtk_widget_get_parent_window (widget),
@@ -496,7 +496,7 @@ gtk_spin_button_size_request (GtkWidget *widget,
GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
requisition->width = MIN_SPIN_BUTTON_WIDTH + ARROW_SIZE
- + 2 * widget->style->klass->xthickness;
+ + 2 * widget->style->xthickness;
}
static void
@@ -510,11 +510,11 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
g_return_if_fail (allocation != NULL);
child_allocation = *allocation;
- if (child_allocation.width > ARROW_SIZE + 2 * widget->style->klass->xthickness)
- child_allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness;
+ if (child_allocation.width > ARROW_SIZE + 2 * widget->style->xthickness)
+ child_allocation.width -= ARROW_SIZE + 2 * widget->style->xthickness;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- child_allocation.x += ARROW_SIZE + 2 * widget->style->klass->xthickness;
+ child_allocation.x += ARROW_SIZE + 2 * widget->style->xthickness;
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, &child_allocation);
@@ -522,15 +522,15 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_REALIZED (widget))
{
- child_allocation.width = ARROW_SIZE + 2 * widget->style->klass->xthickness;
+ child_allocation.width = ARROW_SIZE + 2 * widget->style->xthickness;
child_allocation.height = widget->requisition.height;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
child_allocation.x = (allocation->x + allocation->width - ARROW_SIZE -
- 2 * widget->style->klass->xthickness);
+ 2 * widget->style->xthickness);
else
- child_allocation.x = allocation->x;
-
+ child_allocation.x = allocation->x;
+
child_allocation.y = allocation->y + (allocation->height - widget->requisition.height) / 2;
gdk_window_move_resize (GTK_SPIN_BUTTON (widget)->panel,
@@ -559,7 +559,7 @@ gtk_spin_button_paint (GtkWidget *widget,
GTK_STATE_NORMAL, spin->shadow_type,
area, widget, "spinbutton",
0, 0,
- ARROW_SIZE + 2 * widget->style->klass->xthickness,
+ ARROW_SIZE + 2 * widget->style->xthickness,
widget->requisition.height);
else
{
@@ -648,31 +648,31 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
{
if (spin_button->shadow_type != GTK_SHADOW_NONE)
{
- x = widget->style->klass->xthickness;
- y = widget->style->klass->ythickness;
+ x = widget->style->xthickness;
+ y = widget->style->ythickness;
}
else
{
- x = widget->style->klass->xthickness - 1;
- y = widget->style->klass->ythickness - 1;
+ x = widget->style->xthickness - 1;
+ y = widget->style->ythickness - 1;
}
gtk_paint_arrow (widget->style, spin_button->panel,
state_type, shadow_type,
NULL, widget, "spinbutton",
arrow, TRUE,
x, y, ARROW_SIZE, widget->requisition.height / 2
- - widget->style->klass->ythickness);
+ - widget->style->ythickness);
}
else
{
if (spin_button->shadow_type != GTK_SHADOW_NONE)
{
- x = widget->style->klass->xthickness;
+ x = widget->style->xthickness;
y = widget->requisition.height / 2;
}
else
{
- x = widget->style->klass->xthickness - 1;
+ x = widget->style->xthickness - 1;
y = widget->requisition.height / 2 + 1;
}
gtk_paint_arrow (widget->style, spin_button->panel,
@@ -680,7 +680,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
NULL, widget, "spinbutton",
arrow, TRUE,
x, y, ARROW_SIZE, widget->requisition.height / 2
- - widget->style->klass->ythickness);
+ - widget->style->ythickness);
}
}
}
@@ -913,7 +913,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
{
if (event->y >= 0 && event->x >= 0 &&
event->y <= widget->requisition.height &&
- event->x <= ARROW_SIZE + 2 * widget->style->klass->xthickness)
+ event->x <= ARROW_SIZE + 2 * widget->style->xthickness)
{
if (spin->click_child == GTK_ARROW_UP &&
event->y <= widget->requisition.height / 2)
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index d2fb0f7150..e30acffd77 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -44,10 +44,9 @@
#define M_PI_4 0.78539816339744830962
#endif /* M_PI_4 */
-static void gtk_style_init (GtkStyle *style,
- GdkColormap *colormap,
- gint depth);
-static void gtk_style_destroy (GtkStyle *style);
+static void gtk_style_realize (GtkStyle *style,
+ GdkColormap *colormap,
+ gint depth);
static void gtk_default_draw_hline (GtkStyle *style,
GdkWindow *window,
@@ -299,33 +298,6 @@ static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k);
static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b);
static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s);
-
-static const GtkStyleClass default_class =
-{
- 2,
- 2,
- gtk_default_draw_hline,
- gtk_default_draw_vline,
- gtk_default_draw_shadow,
- gtk_default_draw_polygon,
- gtk_default_draw_arrow,
- gtk_default_draw_diamond,
- gtk_default_draw_oval,
- gtk_default_draw_string,
- gtk_default_draw_box,
- gtk_default_draw_flat_box,
- gtk_default_draw_check,
- gtk_default_draw_option,
- gtk_default_draw_cross,
- gtk_default_draw_ramp,
- gtk_default_draw_tab,
- gtk_default_draw_shadow_gap,
- gtk_default_draw_box_gap,
- gtk_default_draw_extension,
- gtk_default_draw_focus,
- gtk_default_draw_slider,
- gtk_default_draw_handle
-};
GdkFont *default_font = NULL;
static GdkColor gtk_default_normal_fg = { 0, 0, 0, 0 };
@@ -340,69 +312,45 @@ static GdkColor gtk_default_prelight_bg = { 0, 0xea60, 0xea60, 0xea60 };
static GdkColor gtk_default_selected_bg = { 0, 0, 0, 0x9c40 };
static GdkColor gtk_default_insensitive_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
-GtkStyle*
-gtk_style_copy (GtkStyle *style)
+static gpointer parent_class = NULL;
+
+static void gtk_style_init (GtkStyle *style);
+static void gtk_style_class_init (GtkStyleClass *klass);
+static void gtk_style_finalize (GObject *object);
+
+GType
+gtk_style_get_type (void)
{
- GtkStyle *new_style;
- guint i;
-
- g_return_val_if_fail (style != NULL, NULL);
-
- new_style = gtk_style_new ();
-
- for (i = 0; i < 5; i++)
- {
- new_style->fg[i] = style->fg[i];
- new_style->bg[i] = style->bg[i];
- new_style->text[i] = style->text[i];
- new_style->base[i] = style->base[i];
-
- new_style->bg_pixmap[i] = style->bg_pixmap[i];
- }
-
- gdk_font_unref (new_style->font);
- new_style->font = style->font;
- gdk_font_ref (new_style->font);
+ static GType object_type = 0;
- if (style->rc_style)
+ if (!object_type)
{
- new_style->rc_style = style->rc_style;
- gtk_rc_style_ref (style->rc_style);
+ static const GTypeInfo object_info =
+ {
+ sizeof (GtkStyleClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gtk_style_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GtkStyle),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gtk_style_init,
+ };
+
+ object_type = g_type_register_static (G_TYPE_OBJECT,
+ "GtkStyle",
+ &object_info);
}
- if (style->engine)
- {
- new_style->engine = style->engine;
- gtk_theme_engine_ref (new_style->engine);
- new_style->engine->duplicate_style (new_style, style);
- }
-
- return new_style;
+ return object_type;
}
-static GtkStyle*
-gtk_style_duplicate (GtkStyle *style)
-{
- GtkStyle *new_style;
-
- g_return_val_if_fail (style != NULL, NULL);
-
- new_style = gtk_style_copy (style);
-
- style->styles = g_slist_append (style->styles, new_style);
- new_style->styles = style->styles;
-
- return new_style;
-}
-
-GtkStyle*
-gtk_style_new (void)
+static void
+gtk_style_init (GtkStyle *style)
{
- GtkStyle *style;
gint i;
- style = g_new0 (GtkStyle, 1);
-
style->font_desc = pango_font_description_from_string ("Sans 10");
if (!default_font)
@@ -416,11 +364,9 @@ gtk_style_new (void)
style->font = default_font;
gdk_font_ref (style->font);
- style->ref_count = 1;
style->attach_count = 0;
style->colormap = NULL;
style->depth = -1;
- style->klass = (GtkStyleClass *)&default_class;
style->black.red = 0;
style->black.green = 0;
@@ -472,6 +418,147 @@ gtk_style_new (void)
style->text_gc[i] = NULL;
style->base_gc[i] = NULL;
}
+
+ style->xthickness = 2;
+ style->ythickness = 2;
+}
+
+static void
+gtk_style_class_init (GtkStyleClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gtk_style_finalize;
+
+ klass->draw_hline = gtk_default_draw_hline;
+ klass->draw_vline = gtk_default_draw_vline;
+ klass->draw_shadow = gtk_default_draw_shadow;
+ klass->draw_polygon = gtk_default_draw_polygon;
+ klass->draw_arrow = gtk_default_draw_arrow;
+ klass->draw_diamond = gtk_default_draw_diamond;
+ klass->draw_oval = gtk_default_draw_oval;
+ klass->draw_string = gtk_default_draw_string;
+ klass->draw_box = gtk_default_draw_box;
+ klass->draw_flat_box = gtk_default_draw_flat_box;
+ klass->draw_check = gtk_default_draw_check;
+ klass->draw_option = gtk_default_draw_option;
+ klass->draw_cross = gtk_default_draw_cross;
+ klass->draw_ramp = gtk_default_draw_ramp;
+ klass->draw_tab = gtk_default_draw_tab;
+ klass->draw_shadow_gap = gtk_default_draw_shadow_gap;
+ klass->draw_box_gap = gtk_default_draw_box_gap;
+ klass->draw_extension = gtk_default_draw_extension;
+ klass->draw_focus = gtk_default_draw_focus;
+ klass->draw_slider = gtk_default_draw_slider;
+ klass->draw_handle = gtk_default_draw_handle;
+}
+
+static void
+gtk_style_finalize (GObject *object)
+{
+ GtkStyle *style = GTK_STYLE (object);
+
+ g_return_if_fail (style->attach_count == 0);
+
+ if (style->styles)
+ {
+ if (style->styles->data != style)
+ g_slist_remove (style->styles, style);
+ else
+ {
+ GSList *tmp_list = style->styles->next;
+
+ while (tmp_list)
+ {
+ ((GtkStyle*) tmp_list->data)->styles = style->styles->next;
+ tmp_list = tmp_list->next;
+ }
+ g_slist_free_1 (style->styles);
+ }
+ }
+
+ if (style->engine)
+ {
+ style->engine->destroy_style (style);
+ gtk_theme_engine_unref (style->engine);
+ }
+
+ gdk_font_unref (style->font);
+ pango_font_description_free (style->font_desc);
+
+ if (style->rc_style)
+ gtk_rc_style_unref (style->rc_style);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+GtkStyle*
+gtk_style_copy (GtkStyle *style)
+{
+ GtkStyle *new_style;
+ guint i;
+
+ g_return_val_if_fail (style != NULL, NULL);
+
+ new_style = gtk_style_new ();
+
+ for (i = 0; i < 5; i++)
+ {
+ new_style->fg[i] = style->fg[i];
+ new_style->bg[i] = style->bg[i];
+ new_style->text[i] = style->text[i];
+ new_style->base[i] = style->base[i];
+
+ new_style->bg_pixmap[i] = style->bg_pixmap[i];
+ }
+
+ gdk_font_unref (new_style->font);
+ new_style->font = style->font;
+ gdk_font_ref (new_style->font);
+
+ pango_font_description_free (new_style->font_desc);
+ new_style->font_desc = pango_font_description_copy (style->font_desc);
+
+ if (style->rc_style)
+ {
+ new_style->rc_style = style->rc_style;
+ gtk_rc_style_ref (style->rc_style);
+ }
+
+ if (style->engine)
+ {
+ new_style->engine = style->engine;
+ gtk_theme_engine_ref (new_style->engine);
+ new_style->engine->duplicate_style (new_style, style);
+ }
+
+ return new_style;
+}
+
+static GtkStyle*
+gtk_style_duplicate (GtkStyle *style)
+{
+ GtkStyle *new_style;
+
+ g_return_val_if_fail (style != NULL, NULL);
+
+ new_style = gtk_style_copy (style);
+
+ style->styles = g_slist_append (style->styles, new_style);
+ new_style->styles = style->styles;
+
+ return new_style;
+}
+
+GtkStyle*
+gtk_style_new (void)
+{
+ GtkStyle *style;
+
+ style = GTK_STYLE (g_type_create_instance (gtk_style_get_type ()));
return style;
}
@@ -534,7 +621,7 @@ gtk_style_attach (GtkStyle *style,
if (new_style->attach_count == 0)
{
- gtk_style_init (new_style, colormap, depth);
+ gtk_style_realize (new_style, colormap, depth);
break;
}
else if (new_style->colormap == colormap &&
@@ -548,7 +635,7 @@ gtk_style_attach (GtkStyle *style,
if (!new_style)
{
new_style = gtk_style_duplicate (style);
- gtk_style_init (new_style, colormap, depth);
+ gtk_style_realize (new_style, colormap, depth);
}
/* A style gets a refcount from being attached */
@@ -601,28 +688,19 @@ gtk_style_detach (GtkStyle *style)
GtkStyle*
gtk_style_ref (GtkStyle *style)
{
- g_return_val_if_fail (style != NULL, NULL);
- g_return_val_if_fail (style->ref_count > 0, NULL);
-
- style->ref_count += 1;
- return style;
+ return (GtkStyle *) g_object_ref (G_OBJECT (style));
}
void
gtk_style_unref (GtkStyle *style)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->ref_count > 0);
-
- style->ref_count -= 1;
- if (style->ref_count == 0)
- gtk_style_destroy (style);
+ g_object_unref (G_OBJECT (style));
}
static void
-gtk_style_init (GtkStyle *style,
- GdkColormap *colormap,
- gint depth)
+gtk_style_realize (GtkStyle *style,
+ GdkColormap *colormap,
+ gint depth)
{
GdkGCValues gc_values;
GdkGCValuesMask gc_values_mask;
@@ -717,43 +795,6 @@ gtk_style_init (GtkStyle *style,
style->engine->realize_style (style);
}
-static void
-gtk_style_destroy (GtkStyle *style)
-{
- g_return_if_fail (style->attach_count == 0);
-
- if (style->styles)
- {
- if (style->styles->data != style)
- g_slist_remove (style->styles, style);
- else
- {
- GSList *tmp_list = style->styles->next;
-
- while (tmp_list)
- {
- ((GtkStyle*) tmp_list->data)->styles = style->styles->next;
- tmp_list = tmp_list->next;
- }
- g_slist_free_1 (style->styles);
- }
- }
-
- if (style->engine)
- {
- style->engine->destroy_style (style);
- gtk_theme_engine_unref (style->engine);
- }
-
- gdk_font_unref (style->font);
- pango_font_description_free (style->font_desc);
-
- if (style->rc_style)
- gtk_rc_style_unref (style->rc_style);
-
- g_free (style);
-}
-
void
gtk_draw_hline (GtkStyle *style,
GdkWindow *window,
@@ -763,10 +804,9 @@ gtk_draw_hline (GtkStyle *style,
gint y)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_hline != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
- style->klass->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
+ GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
}
@@ -779,10 +819,9 @@ gtk_draw_vline (GtkStyle *style,
gint x)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_vline != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
- style->klass->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x);
+ GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x);
}
@@ -797,10 +836,9 @@ gtk_draw_shadow (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
- style->klass->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -813,10 +851,9 @@ gtk_draw_polygon (GtkStyle *style,
gboolean fill)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_polygon != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL);
- style->klass->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
+ GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
}
void
@@ -832,10 +869,9 @@ gtk_draw_arrow (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_arrow != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
- style->klass->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
}
@@ -850,10 +886,9 @@ gtk_draw_diamond (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_diamond != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
- style->klass->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
@@ -868,10 +903,9 @@ gtk_draw_oval (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_oval != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
- style->klass->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -883,10 +917,9 @@ gtk_draw_string (GtkStyle *style,
const gchar *string)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_string != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
- style->klass->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string);
+ GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string);
}
void
@@ -900,10 +933,9 @@ gtk_draw_box (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_box != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
- style->klass->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -917,10 +949,9 @@ gtk_draw_flat_box (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_flat_box != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
- style->klass->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -934,10 +965,9 @@ gtk_draw_check (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_check != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
- style->klass->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -951,10 +981,9 @@ gtk_draw_option (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_option != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
- style->klass->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -968,10 +997,9 @@ gtk_draw_cross (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_cross != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
- style->klass->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -986,10 +1014,9 @@ gtk_draw_ramp (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_ramp != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
- style->klass->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
}
void
@@ -1003,10 +1030,9 @@ gtk_draw_tab (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_tab != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
- style->klass->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -1023,10 +1049,9 @@ gtk_draw_shadow_gap (GtkStyle *style,
gint gap_width)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow_gap != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
- style->klass->draw_shadow_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
+ GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
}
void
@@ -1043,10 +1068,9 @@ gtk_draw_box_gap (GtkStyle *style,
gint gap_width)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_box_gap != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
- style->klass->draw_box_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
+ GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
}
void
@@ -1061,10 +1085,9 @@ gtk_draw_extension (GtkStyle *style,
GtkPositionType gap_side)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_extension != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
- style->klass->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
+ GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
}
void
@@ -1076,10 +1099,9 @@ gtk_draw_focus (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_focus != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
- style->klass->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -1094,10 +1116,9 @@ gtk_draw_slider (GtkStyle *style,
GtkOrientation orientation)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_slider != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
- style->klass->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
+ GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
}
void
@@ -1112,10 +1133,9 @@ gtk_draw_handle (GtkStyle *style,
GtkOrientation orientation)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_handle != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
- style->klass->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
+ GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
}
void
@@ -1189,7 +1209,7 @@ gtk_style_apply_default_background (GtkStyle *style,
}
if (!style->bg_pixmap[state_type] ||
- gdk_window_get_type (window) == GDK_WINDOW_PIXMAP ||
+ GDK_IS_PIXMAP (window) ||
(!set_bg && style->bg_pixmap[state_type] != (GdkPixmap*) GDK_PARENT_RELATIVE))
{
GdkGC *gc = style->bg_gc[state_type];
@@ -1239,8 +1259,8 @@ gtk_default_draw_hline (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
- thickness_light = style->klass->ythickness / 2;
- thickness_dark = style->klass->ythickness - thickness_light;
+ thickness_light = style->ythickness / 2;
+ thickness_dark = style->ythickness - thickness_light;
if (area)
{
@@ -1296,8 +1316,8 @@ gtk_default_draw_vline (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
- thickness_light = style->klass->xthickness / 2;
- thickness_dark = style->klass->xthickness - thickness_light;
+ thickness_light = style->xthickness / 2;
+ thickness_dark = style->xthickness - thickness_light;
if (area)
{
@@ -2189,7 +2209,7 @@ gtk_default_draw_box (GtkStyle *style,
gdk_window_get_size (window, NULL, &height);
if (!style->bg_pixmap[state_type] ||
- gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
+ GDK_IS_PIXMAP (window))
{
if (area)
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
@@ -2248,7 +2268,7 @@ gtk_default_draw_flat_box (GtkStyle *style,
gc1 = style->bg_gc[state_type];
if (!style->bg_pixmap[state_type] || gc1 != style->bg_gc[state_type] ||
- gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
+ GDK_IS_PIXMAP (window))
{
if (area)
gdk_gc_set_clip_rectangle (gc1, area);
@@ -2893,10 +2913,10 @@ gtk_default_draw_extension (GtkStyle *style,
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
- x + style->klass->xthickness,
+ x + style->xthickness,
y,
- width - (2 * style->klass->xthickness),
- height - (style->klass->ythickness));
+ width - (2 * style->xthickness),
+ height - (style->ythickness));
gdk_draw_line (window, gc1,
x, y, x, y + height - 2);
gdk_draw_line (window, gc2,
@@ -2915,10 +2935,10 @@ gtk_default_draw_extension (GtkStyle *style,
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
- x + style->klass->xthickness,
- y + style->klass->ythickness,
- width - (2 * style->klass->xthickness),
- height - (style->klass->ythickness));
+ x + style->xthickness,
+ y + style->ythickness,
+ width - (2 * style->xthickness),
+ height - (style->ythickness));
gdk_draw_line (window, gc1,
x + 1, y, x + width - 2, y);
gdk_draw_line (window, gc1,
@@ -2938,9 +2958,9 @@ gtk_default_draw_extension (GtkStyle *style,
widget && !GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
x,
- y + style->klass->ythickness,
- width - (style->klass->xthickness),
- height - (2 * style->klass->ythickness));
+ y + style->ythickness,
+ width - (style->xthickness),
+ height - (2 * style->ythickness));
gdk_draw_line (window, gc1,
x, y, x + width - 2, y);
gdk_draw_line (window, gc2,
@@ -2959,10 +2979,10 @@ gtk_default_draw_extension (GtkStyle *style,
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
- x + style->klass->xthickness,
- y + style->klass->ythickness,
- width - (style->klass->xthickness),
- height - (2 * style->klass->ythickness));
+ x + style->xthickness,
+ y + style->ythickness,
+ width - (style->xthickness),
+ height - (2 * style->ythickness));
gdk_draw_line (window, gc1,
x + 1, y, x + width - 1, y);
gdk_draw_line (window, gc1,
@@ -3074,12 +3094,12 @@ gtk_default_draw_slider (GtkStyle *style,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_paint_vline (style, window, state_type, area, widget, detail,
- style->klass->ythickness,
- height - style->klass->ythickness - 1, width / 2);
+ style->ythickness,
+ height - style->ythickness - 1, width / 2);
else
gtk_paint_hline (style, window, state_type, area, widget, detail,
- style->klass->xthickness,
- width - style->klass->xthickness - 1, height / 2);
+ style->xthickness,
+ width - style->xthickness - 1, height / 2);
}
static void
@@ -3155,8 +3175,8 @@ gtk_default_draw_handle (GtkStyle *style,
}
else
{
- xthick = style->klass->xthickness;
- ythick = style->klass->ythickness;
+ xthick = style->xthickness;
+ ythick = style->ythickness;
light_gc = style->light_gc[state_type];
dark_gc = style->dark_gc[state_type];
@@ -3405,10 +3425,9 @@ gtk_paint_hline (GtkStyle *style,
gint y)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_hline != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
- style->klass->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y);
+ GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y);
}
void
@@ -3423,10 +3442,9 @@ gtk_paint_vline (GtkStyle *style,
gint x)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_vline != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
- style->klass->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x);
+ GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x);
}
void
@@ -3443,10 +3461,9 @@ gtk_paint_shadow (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
- style->klass->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3462,10 +3479,9 @@ gtk_paint_polygon (GtkStyle *style,
gboolean fill)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
- style->klass->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
+ GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
}
void
@@ -3484,10 +3500,9 @@ gtk_paint_arrow (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_arrow != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
- style->klass->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
}
void
@@ -3504,10 +3519,9 @@ gtk_paint_diamond (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_diamond != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
- style->klass->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3524,10 +3538,9 @@ gtk_paint_oval (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_oval != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
- style->klass->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3542,10 +3555,9 @@ gtk_paint_string (GtkStyle *style,
const gchar *string)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_string != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
- style->klass->draw_string (style, window, state_type, area, widget, detail, x, y, string);
+ GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string);
}
void
@@ -3562,10 +3574,9 @@ gtk_paint_box (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_box != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
- style->klass->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3582,10 +3593,9 @@ gtk_paint_flat_box (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_flat_box != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
- style->klass->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3602,10 +3612,9 @@ gtk_paint_check (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_check != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
- style->klass->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3622,10 +3631,9 @@ gtk_paint_option (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_option != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
- style->klass->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3642,10 +3650,9 @@ gtk_paint_cross (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_cross != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
- style->klass->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3663,10 +3670,9 @@ gtk_paint_ramp (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_ramp != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
- style->klass->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height);
}
void
@@ -3683,10 +3689,9 @@ gtk_paint_tab (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_tab != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
- style->klass->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
void
@@ -3706,10 +3711,9 @@ gtk_paint_shadow_gap (GtkStyle *style,
gint gap_width)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow_gap != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
- style->klass->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
+ GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
}
@@ -3730,10 +3734,9 @@ gtk_paint_box_gap (GtkStyle *style,
gint gap_width)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_box_gap != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
- style->klass->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
+ GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
}
void
@@ -3751,10 +3754,9 @@ gtk_paint_extension (GtkStyle *style,
GtkPositionType gap_side)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_extension != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
- style->klass->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
+ GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
}
void
@@ -3769,10 +3771,9 @@ gtk_paint_focus (GtkStyle *style,
gint height)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_focus != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
- style->klass->draw_focus (style, window, area, widget, detail, x, y, width, height);
+ GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, area, widget, detail, x, y, width, height);
}
void
@@ -3790,10 +3791,9 @@ gtk_paint_slider (GtkStyle *style,
GtkOrientation orientation)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_slider != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
- style->klass->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
+ GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
}
void
@@ -3811,8 +3811,7 @@ gtk_paint_handle (GtkStyle *style,
GtkOrientation orientation)
{
g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_handle != NULL);
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
- style->klass->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
+ GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
}
diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h
index fca8c21edd..45e028eacc 100644
--- a/gtk/gtkstyle.h
+++ b/gtk/gtkstyle.h
@@ -39,6 +39,13 @@ extern "C" {
typedef struct _GtkStyle GtkStyle;
typedef struct _GtkStyleClass GtkStyleClass;
+#define GTK_TYPE_STYLE (gtk_style_get_type ())
+#define GTK_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_STYLE, GtkStyle))
+#define GTK_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STYLE, GtkStyleClass))
+#define GTK_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_STYLE))
+#define GTK_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STYLE))
+#define GTK_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE, GtkStyleClass))
+
/* Some forward declarations needed to rationalize the header
* files.
*/
@@ -60,8 +67,10 @@ typedef struct _GtkWidget GtkWidget;
struct _GtkStyle
{
- GtkStyleClass *klass;
+ GObject parent_instance;
+ /*< public >*/
+
GdkColor fg[5];
GdkColor bg[5];
GdkColor light[5];
@@ -86,10 +95,12 @@ struct _GtkStyle
GdkGC *white_gc;
GdkPixmap *bg_pixmap[5];
+
+ gint xthickness;
+ gint ythickness;
- /* private */
+ /*< private >*/
- gint ref_count;
gint attach_count;
gint depth;
@@ -107,8 +118,7 @@ struct _GtkStyle
struct _GtkStyleClass
{
- gint xthickness;
- gint ythickness;
+ GObjectClass parent_class;
void (*draw_hline) (GtkStyle *style,
GdkWindow *window,
@@ -346,6 +356,7 @@ struct _GtkStyleClass
GtkOrientation orientation);
};
+GType gtk_style_get_type (void);
GtkStyle* gtk_style_new (void);
GtkStyle* gtk_style_copy (GtkStyle *style);
GtkStyle* gtk_style_attach (GtkStyle *style,
diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c
index ac775cd6cb..5af1baf2f5 100644
--- a/gtk/gtktearoffmenuitem.c
+++ b/gtk/gtktearoffmenuitem.c
@@ -108,10 +108,10 @@ gtk_tearoff_menu_item_size_request (GtkWidget *widget,
tearoff = GTK_TEAROFF_MENU_ITEM (widget);
requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness +
+ widget->style->xthickness +
BORDER_SPACING) * 2;
requisition->height = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->ythickness) * 2;
+ widget->style->ythickness) * 2;
if (tearoff->torn_off)
{
@@ -119,7 +119,7 @@ gtk_tearoff_menu_item_size_request (GtkWidget *widget,
}
else
{
- requisition->height += widget->style->klass->ythickness;
+ requisition->height += widget->style->ythickness;
}
}
@@ -188,7 +188,7 @@ gtk_tearoff_menu_item_paint (GtkWidget *widget,
{
gtk_draw_hline (widget->style, widget->window, GTK_STATE_NORMAL,
x, MIN (x+TEAR_LENGTH, right_max),
- y + (height - widget->style->klass->ythickness)/2);
+ y + (height - widget->style->ythickness)/2);
x += 2 * TEAR_LENGTH;
}
}
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 3b6bfd2aef..341e3b0dff 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1309,8 +1309,8 @@ gtk_text_realize (GtkWidget *widget)
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, text);
- attributes.x = (widget->style->klass->xthickness + TEXT_BORDER_ROOM);
- attributes.y = (widget->style->klass->ythickness + TEXT_BORDER_ROOM);
+ attributes.x = (widget->style->xthickness + TEXT_BORDER_ROOM);
+ attributes.y = (widget->style->ythickness + TEXT_BORDER_ROOM);
attributes.width = MAX (1, (gint)widget->allocation.width - (gint)attributes.x * 2);
attributes.height = MAX (1, (gint)widget->allocation.height - (gint)attributes.y * 2);
@@ -1508,8 +1508,8 @@ clear_focus_area (GtkText *text, gint area_x, gint area_y, gint area_width, gint
{
GtkWidget *widget = GTK_WIDGET (text);
- gint ythick = TEXT_BORDER_ROOM + widget->style->klass->ythickness;
- gint xthick = TEXT_BORDER_ROOM + widget->style->klass->xthickness;
+ gint ythick = TEXT_BORDER_ROOM + widget->style->ythickness;
+ gint xthick = TEXT_BORDER_ROOM + widget->style->xthickness;
gint width, height;
@@ -1537,8 +1537,8 @@ gtk_text_draw_focus (GtkWidget *widget)
if (GTK_WIDGET_DRAWABLE (widget))
{
- gint ythick = widget->style->klass->ythickness;
- gint xthick = widget->style->klass->xthickness;
+ gint ythick = widget->style->ythickness;
+ gint xthick = widget->style->xthickness;
gint xextra = TEXT_BORDER_ROOM;
gint yextra = TEXT_BORDER_ROOM;
@@ -1608,8 +1608,8 @@ gtk_text_size_request (GtkWidget *widget,
g_return_if_fail (GTK_IS_TEXT (widget));
g_return_if_fail (requisition != NULL);
- xthickness = widget->style->klass->xthickness + TEXT_BORDER_ROOM;
- ythickness = widget->style->klass->ythickness + TEXT_BORDER_ROOM;
+ xthickness = widget->style->xthickness + TEXT_BORDER_ROOM;
+ ythickness = widget->style->ythickness + TEXT_BORDER_ROOM;
char_height = MIN_TEXT_HEIGHT_LINES * (widget->style->font->ascent +
widget->style->font->descent);
@@ -1645,11 +1645,11 @@ gtk_text_size_allocate (GtkWidget *widget,
allocation->width, allocation->height);
gdk_window_move_resize (text->text_area,
- widget->style->klass->xthickness + TEXT_BORDER_ROOM,
- widget->style->klass->ythickness + TEXT_BORDER_ROOM,
- MAX (1, (gint)widget->allocation.width - (gint)(widget->style->klass->xthickness +
+ widget->style->xthickness + TEXT_BORDER_ROOM,
+ widget->style->ythickness + TEXT_BORDER_ROOM,
+ MAX (1, (gint)widget->allocation.width - (gint)(widget->style->xthickness +
(gint)TEXT_BORDER_ROOM) * 2),
- MAX (1, (gint)widget->allocation.height - (gint)(widget->style->klass->ythickness +
+ MAX (1, (gint)widget->allocation.height - (gint)(widget->style->ythickness +
(gint)TEXT_BORDER_ROOM) * 2));
#ifdef USE_XIM
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index a6bb822c6e..82a8e83c57 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -209,12 +209,12 @@ gtk_text_layout_destroy (GtkObject *object)
if (layout->ltr_context)
{
- pango_context_unref (layout->ltr_context);
+ g_object_unref (G_OBJECT (layout->ltr_context));
layout->ltr_context = NULL;
}
if (layout->rtl_context)
{
- pango_context_unref (layout->rtl_context);
+ g_object_unref (G_OBJECT (layout->rtl_context));
layout->rtl_context = NULL;
}
@@ -298,16 +298,16 @@ gtk_text_layout_set_contexts (GtkTextLayout *layout,
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
if (layout->ltr_context)
- pango_context_unref (ltr_context);
+ g_object_unref (G_OBJECT (ltr_context));
layout->ltr_context = ltr_context;
- pango_context_ref (ltr_context);
+ g_object_ref (G_OBJECT (ltr_context));
if (layout->rtl_context)
- pango_context_unref (rtl_context);
+ g_object_unref (G_OBJECT (rtl_context));
layout->rtl_context = rtl_context;
- pango_context_ref (rtl_context);
+ g_object_ref (G_OBJECT (rtl_context));
gtk_text_layout_invalidate_all (layout);
}
@@ -1359,7 +1359,7 @@ gtk_text_layout_free_line_display (GtkTextLayout *layout,
{
if (display != layout->one_display_cache)
{
- pango_layout_unref (display->layout);
+ g_object_unref (G_OBJECT (display->layout));
if (display->cursors)
{
diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c
index 0caf021be6..e7f89a35fb 100644
--- a/gtk/gtktexttag.c
+++ b/gtk/gtktexttag.c
@@ -174,11 +174,11 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
GTK_ARG_READWRITE, ARG_BACKGROUND_GDK);
gtk_object_add_arg_type ("GtkTextTag::foreground_gdk", GTK_TYPE_GDK_COLOR,
GTK_ARG_READWRITE, ARG_FOREGROUND_GDK);
- /* FIXME should be GTK_TYPE_GDK_BITMAP but that doesn't exist? */
- gtk_object_add_arg_type ("GtkTextTag::background_stipple", GTK_TYPE_GDK_WINDOW,
+ gtk_object_add_arg_type ("GtkTextTag::background_stipple",
+ GDK_TYPE_PIXMAP,
GTK_ARG_READWRITE, ARG_BACKGROUND_STIPPLE);
- /* FIXME GDK_BITMAP */
- gtk_object_add_arg_type ("GtkTextTag::foreground_stipple", GTK_TYPE_GDK_WINDOW,
+ gtk_object_add_arg_type ("GtkTextTag::foreground_stipple",
+ GDK_TYPE_PIXMAP,
GTK_ARG_READWRITE, ARG_FOREGROUND_STIPPLE);
gtk_object_add_arg_type ("GtkTextTag::font", GTK_TYPE_STRING,
GTK_ARG_READWRITE, ARG_FONT);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 96318efc2c..778442538a 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -2403,8 +2403,8 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
gtk_text_layout_set_contexts (text_view->layout, ltr_context, rtl_context);
- pango_context_unref (ltr_context);
- pango_context_unref (rtl_context);
+ g_object_unref (G_OBJECT (ltr_context));
+ g_object_unref (G_OBJECT (rtl_context));
style = gtk_text_view_style_values_new ();
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 788ac67009..9ae77e89cb 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -344,8 +344,8 @@ gtk_toggle_button_paint (GtkWidget *widget,
if (GTK_WIDGET_CAN_DEFAULT (widget))
{
- x += widget->style->klass->xthickness;
- y += widget->style->klass->ythickness;
+ x += widget->style->xthickness;
+ y += widget->style->ythickness;
width -= 2 * x + DEFAULT_SPACING;
height -= 2 * y + DEFAULT_SPACING;
x += DEFAULT_LEFT_POS;
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 3001cb57f3..d53fbec919 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -391,7 +391,7 @@ gtk_toolbar_paint_space_line (GtkWidget *widget,
SPACE_LINE_END / SPACE_LINE_DIVISION,
child_space->alloc_x +
(toolbar->space_size -
- widget->style->klass->xthickness) / 2);
+ widget->style->xthickness) / 2);
else
gtk_paint_hline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
@@ -402,7 +402,7 @@ gtk_toolbar_paint_space_line (GtkWidget *widget,
SPACE_LINE_END / SPACE_LINE_DIVISION,
child_space->alloc_y +
(toolbar->space_size -
- widget->style->klass->ythickness) / 2);
+ widget->style->ythickness) / 2);
}
static void
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index 63e2d77203..06900650fb 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -499,7 +499,7 @@ gtk_tree_item_size_request (GtkWidget *widget,
item = GTK_TREE_ITEM(widget);
requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness) * 2;
+ widget->style->xthickness) * 2;
requisition->height = GTK_CONTAINER (widget)->border_width * 2;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
@@ -546,7 +546,7 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
if (bin->child)
{
border_width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness);
+ widget->style->xthickness);
child_allocation.x = border_width + GTK_TREE(widget->parent)->current_indent;
child_allocation.y = GTK_CONTAINER (widget)->border_width;
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 481f59425a..ef18bacc74 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -449,8 +449,8 @@ gtk_viewport_realize (GtkWidget *widget)
if (viewport->shadow_type != GTK_SHADOW_NONE)
{
- attributes.x = widget->style->klass->xthickness;
- attributes.y = widget->style->klass->ythickness;
+ attributes.x = widget->style->xthickness;
+ attributes.y = widget->style->ythickness;
}
else
{
@@ -564,8 +564,8 @@ gtk_viewport_draw (GtkWidget *widget,
gtk_viewport_paint (widget, &tmp_area);
- tmp_area.x += viewport->hadjustment->value - widget->style->klass->xthickness;
- tmp_area.y += viewport->vadjustment->value - widget->style->klass->ythickness;
+ tmp_area.x += viewport->hadjustment->value - widget->style->xthickness;
+ tmp_area.y += viewport->vadjustment->value - widget->style->ythickness;
gtk_paint_flat_box(widget->style, viewport->bin_window,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
@@ -654,10 +654,10 @@ gtk_viewport_size_request (GtkWidget *widget,
bin = GTK_BIN (widget);
requisition->width = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2 + 5;
+ GTK_WIDGET (widget)->style->xthickness) * 2 + 5;
requisition->height = (GTK_CONTAINER (widget)->border_width * 2 +
- GTK_WIDGET (widget)->style->klass->ythickness) * 2 + 5;
+ GTK_WIDGET (widget)->style->ythickness) * 2 + 5;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
@@ -698,8 +698,8 @@ gtk_viewport_size_allocate (GtkWidget *widget,
if (viewport->shadow_type != GTK_SHADOW_NONE)
{
- child_allocation.x = GTK_WIDGET (viewport)->style->klass->xthickness;
- child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
+ child_allocation.x = GTK_WIDGET (viewport)->style->xthickness;
+ child_allocation.y = GTK_WIDGET (viewport)->style->ythickness;
}
child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2 - border_width * 2);
diff --git a/gtk/gtkvruler.c b/gtk/gtkvruler.c
index 65aa54204c..655f71e883 100644
--- a/gtk/gtkvruler.c
+++ b/gtk/gtkvruler.c
@@ -92,8 +92,8 @@ gtk_vruler_init (GtkVRuler *vruler)
GtkWidget *widget;
widget = GTK_WIDGET (vruler);
- widget->requisition.width = widget->style->klass->xthickness * 2 + RULER_WIDTH;
- widget->requisition.height = widget->style->klass->ythickness * 2 + 1;
+ widget->requisition.width = widget->style->xthickness * 2 + RULER_WIDTH;
+ widget->requisition.height = widget->style->ythickness * 2 + 1;
}
GtkWidget*
@@ -163,8 +163,9 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
+
+ xthickness = widget->style->xthickness;
+ ythickness = widget->style->ythickness;
layout = gtk_widget_create_pango_layout (widget);
pango_layout_set_text (layout, "012456789", -1);
@@ -266,7 +267,7 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
}
}
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
@@ -291,8 +292,8 @@ gtk_vruler_draw_pos (GtkRuler *ruler)
widget = GTK_WIDGET (ruler);
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
+ xthickness = widget->style->xthickness;
+ ythickness = widget->style->ythickness;
width = widget->allocation.width - xthickness * 2;
height = widget->allocation.height;
diff --git a/gtk/gtkvscale.c b/gtk/gtkvscale.c
index 490b383fba..0432e83eec 100644
--- a/gtk/gtkvscale.c
+++ b/gtk/gtkvscale.c
@@ -326,9 +326,9 @@ gtk_vscale_size_request (GtkWidget *widget,
scale = GTK_SCALE (widget);
requisition->width = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->ythickness * 2);
+ widget->style->ythickness * 2);
requisition->height = (SCALE_CLASS (scale)->slider_length +
- widget->style->klass->xthickness) * 2;
+ widget->style->xthickness) * 2;
if (scale->draw_value)
{
@@ -396,7 +396,7 @@ gtk_vscale_pos_trough (GtkVScale *vscale,
scale = GTK_SCALE (vscale);
*w = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->xthickness * 2);
+ widget->style->xthickness * 2);
*h = widget->allocation.height;
if (scale->draw_value)
@@ -590,7 +590,7 @@ gtk_vscale_draw_value (GtkScale *scale)
GTK_WIDGET (scale)->style->fg_gc [state_type],
x, y, layout);
- pango_layout_unref (layout);
+ g_object_unref (G_OBJECT (layout));
}
}
diff --git a/gtk/gtkvscrollbar.c b/gtk/gtkvscrollbar.c
index af4824353a..ae66d529de 100644
--- a/gtk/gtkvscrollbar.c
+++ b/gtk/gtkvscrollbar.c
@@ -163,11 +163,11 @@ gtk_vscrollbar_init (GtkVScrollbar *vscrollbar)
requisition = &widget->requisition;
requisition->width = (RANGE_CLASS (widget)->slider_width +
- widget->style->klass->xthickness * 2);
+ widget->style->xthickness * 2);
requisition->height = (RANGE_CLASS (widget)->min_slider_size +
RANGE_CLASS (widget)->stepper_size +
RANGE_CLASS (widget)->stepper_slider_spacing +
- widget->style->klass->ythickness) * 2;
+ widget->style->ythickness) * 2;
}
GtkWidget*
@@ -217,20 +217,20 @@ gtk_vscrollbar_realize (GtkWidget *widget)
range->trough = widget->window;
gdk_window_ref (range->trough);
- attributes.x = widget->style->klass->xthickness;
- attributes.y = widget->style->klass->ythickness;
+ attributes.x = widget->style->xthickness;
+ attributes.y = widget->style->ythickness;
attributes.width = RANGE_CLASS (widget)->stepper_size;
attributes.height = RANGE_CLASS (widget)->stepper_size;
range->step_back = gdk_window_new (range->trough, &attributes, attributes_mask);
attributes.y = (widget->allocation.height -
- widget->style->klass->ythickness -
+ widget->style->ythickness -
RANGE_CLASS (widget)->stepper_size);
range->step_forw = gdk_window_new (range->trough, &attributes, attributes_mask);
- attributes.x = widget->style->klass->ythickness;
+ attributes.x = widget->style->ythickness;
attributes.y = 0;
attributes.width = RANGE_CLASS (widget)->slider_width;
attributes.height = RANGE_CLASS (widget)->min_slider_size;
@@ -279,15 +279,15 @@ gtk_vscrollbar_size_allocate (GtkWidget *widget,
allocation->y,
widget->requisition.width, allocation->height);
gdk_window_move_resize (range->step_back,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- widget->requisition.width - widget->style->klass->xthickness * 2,
+ widget->style->xthickness,
+ widget->style->ythickness,
+ widget->requisition.width - widget->style->xthickness * 2,
RANGE_CLASS (widget)->stepper_size);
gdk_window_move_resize (range->step_forw,
- widget->style->klass->xthickness,
- allocation->height - widget->style->klass->ythickness -
+ widget->style->xthickness,
+ allocation->height - widget->style->ythickness -
RANGE_CLASS (widget)->stepper_size,
- widget->requisition.width - widget->style->klass->xthickness * 2,
+ widget->requisition.width - widget->style->xthickness * 2,
RANGE_CLASS (widget)->stepper_size);
gtk_range_slider_update (GTK_RANGE (widget));
diff --git a/gtk/gtkvseparator.c b/gtk/gtkvseparator.c
index f74bdce463..bf537a1bb0 100644
--- a/gtk/gtkvseparator.c
+++ b/gtk/gtkvseparator.c
@@ -71,7 +71,7 @@ gtk_vseparator_class_init (GtkVSeparatorClass *klass)
static void
gtk_vseparator_init (GtkVSeparator *vseparator)
{
- GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->klass->xthickness;
+ GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->xthickness;
GTK_WIDGET (vseparator)->requisition.height = 1;
}
@@ -96,7 +96,7 @@ gtk_vseparator_expose (GtkWidget *widget,
widget->allocation.y,
widget->allocation.y + widget->allocation.height,
widget->allocation.x + (widget->allocation.width -
- widget->style->klass->xthickness) / 2);
+ widget->style->xthickness) / 2);
return FALSE;
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ab7a9fd628..1e15a26a8c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -679,7 +679,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_leave),
gtk_marshal_NONE__POINTER_UINT,
GTK_TYPE_NONE, 2,
- GTK_TYPE_GDK_DRAG_CONTEXT,
+ GDK_TYPE_DRAG_CONTEXT,
GTK_TYPE_UINT);
widget_signals[DRAG_BEGIN] =
gtk_signal_new ("drag_begin",
@@ -688,7 +688,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_begin),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
- GTK_TYPE_GDK_DRAG_CONTEXT);
+ GDK_TYPE_DRAG_CONTEXT);
widget_signals[DRAG_END] =
gtk_signal_new ("drag_end",
GTK_RUN_LAST,
@@ -696,7 +696,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_end),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
- GTK_TYPE_GDK_DRAG_CONTEXT);
+ GDK_TYPE_DRAG_CONTEXT);
widget_signals[DRAG_DATA_DELETE] =
gtk_signal_new ("drag_data_delete",
GTK_RUN_LAST,
@@ -704,7 +704,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_data_delete),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
- GTK_TYPE_GDK_DRAG_CONTEXT);
+ GDK_TYPE_DRAG_CONTEXT);
widget_signals[DRAG_MOTION] =
gtk_signal_new ("drag_motion",
GTK_RUN_LAST,
@@ -712,7 +712,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_motion),
gtk_marshal_BOOL__POINTER_INT_INT_UINT,
GTK_TYPE_BOOL, 4,
- GTK_TYPE_GDK_DRAG_CONTEXT,
+ GDK_TYPE_DRAG_CONTEXT,
GTK_TYPE_INT,
GTK_TYPE_INT,
GTK_TYPE_UINT);
@@ -723,7 +723,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_drop),
gtk_marshal_BOOL__POINTER_INT_INT_UINT,
GTK_TYPE_BOOL, 4,
- GTK_TYPE_GDK_DRAG_CONTEXT,
+ GDK_TYPE_DRAG_CONTEXT,
GTK_TYPE_INT,
GTK_TYPE_INT,
GTK_TYPE_UINT);
@@ -734,7 +734,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_data_get),
gtk_marshal_NONE__POINTER_POINTER_UINT_UINT,
GTK_TYPE_NONE, 4,
- GTK_TYPE_GDK_DRAG_CONTEXT,
+ GDK_TYPE_DRAG_CONTEXT,
GTK_TYPE_SELECTION_DATA,
GTK_TYPE_UINT,
GTK_TYPE_UINT);
@@ -745,7 +745,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_data_received),
gtk_marshal_NONE__POINTER_INT_INT_POINTER_UINT_UINT,
GTK_TYPE_NONE, 6,
- GTK_TYPE_GDK_DRAG_CONTEXT,
+ GDK_TYPE_DRAG_CONTEXT,
GTK_TYPE_INT,
GTK_TYPE_INT,
GTK_TYPE_SELECTION_DATA,
@@ -3250,7 +3250,7 @@ gtk_widget_create_pango_layout (GtkWidget *widget)
context = gtk_widget_create_pango_context (widget);
layout = pango_layout_new (context);
- pango_context_unref (context);
+ g_object_unref (G_OBJECT (context));
return layout;
}
@@ -4499,18 +4499,15 @@ static void
gtk_reset_shapes_recurse (GtkWidget *widget,
GdkWindow *window)
{
- GdkWindowPrivate *private;
gpointer data;
GList *list;
- private = (GdkWindowPrivate*) window;
-
gdk_window_get_user_data (window, &data);
if (data != widget)
return;
gdk_window_shape_combine_mask (window, NULL, 0, 0);
- for (list = private->children; list; list = list->next)
+ for (list = gdk_window_peek_children (window); list; list = list->next)
gtk_reset_shapes_recurse (widget, list->data);
}
diff --git a/modules/linux-fb/Makefile.am b/modules/linux-fb/Makefile.am
index 9289cfbfee..dbfae2dfbe 100644
--- a/modules/linux-fb/Makefile.am
+++ b/modules/linux-fb/Makefile.am
@@ -21,14 +21,17 @@ LDFLAGS = @STRIP_BEGIN@ \
-lm \
@STRIP_END@
-moduledir = $(libdir)/pango/modules
-module_LTLIBRARIES = fb-basic.la
+fb_basic_la_SOURCES = basic.c
fb_basic_la_LDFLAGS = -export-dynamic -avoid-version -module
fb_basic_la_LIBADD = $(PANGO_LIBS) -L$(top_builddir)/gdk/.libs -lgdk-linux-fb
-fb_basic_la_SOURCES = $(sources)
-fb_basic_la_SOURCES = basic.c
+if USE_LINUX_FB
+
+moduledir = $(libdir)/pango/modules
+module_LTLIBRARIES = fb-basic.la
+
+endif
EXTRA_DIST = \
tables-big.i \