Make this compile without framebuffer enabled

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.
This commit is contained in:
Havoc Pennington 2000-06-20 21:04:44 +00:00 committed by Havoc Pennington
parent 2ad30e9fc1
commit df4fc36721
101 changed files with 5449 additions and 2883 deletions

176
ChangeLog
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 (GDK_IS_COLORMAP (colormap), NULL);
g_return_val_if_fail (colormap != NULL, NULL);
private = (GdkColormapPrivate *)colormap;
return private->visual;
return colormap->visual;
}
void

View File

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

View File

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

View File

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

View File

@ -28,31 +28,36 @@
#include "gdkinternals.h"
#include "gdkwindow.h"
GType
gdk_drawable_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) 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
*/
GdkDrawable *
gdk_drawable_alloc (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;
return drawable;
}
void
gdk_drawable_set_data (GdkDrawable *drawable,
@ -60,22 +65,22 @@ gdk_drawable_set_data (GdkDrawable *drawable,
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);
}
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
GdkDrawableType
gdk_drawable_get_type (GdkDrawable *drawable)
{
g_return_val_if_fail (drawable != NULL, (GdkDrawableType) -1);
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 (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (drawable != NULL);
drawable_private = (GdkDrawablePrivate*) drawable;
if (width)
*width = drawable_private->width;
if (height)
*height = drawable_private->height;
GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
}
GdkVisual*
gdk_drawable_get_visual (GdkDrawable *drawable)
{
GdkColormap *colormap;
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (drawable != NULL, NULL);
colormap = gdk_drawable_get_colormap (drawable);
return colormap ? gdk_colormap_get_visual (colormap) : 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 (GDK_IS_DRAWABLE (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_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
@ -200,21 +190,23 @@ gdk_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
GdkDrawablePrivate *drawable_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);
if (width < 0 || height < 0)
{
gint real_width;
gint real_height;
drawable_private = (GdkDrawablePrivate*) drawable;
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gdk_drawable_get_size (drawable, &real_width, &real_height);
if (width < 0)
width = drawable_private->width;
width = real_width;
if (height < 0)
height = drawable_private->height;
height = real_height;
}
((GdkDrawablePrivate *)drawable)->klass->draw_rectangle (drawable, gc, filled, x, y,
GDK_DRAWABLE_GET_CLASS (drawable)->draw_rectangle (drawable, gc, filled, x, y,
width, height);
}
@ -229,23 +221,23 @@ gdk_draw_arc (GdkDrawable *drawable,
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);
if (width < 0 || height < 0)
{
gint real_width;
gint real_height;
drawable_private = (GdkDrawablePrivate*) drawable;
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
gdk_drawable_get_size (drawable, &real_width, &real_height);
if (width < 0)
width = drawable_private->width;
width = real_width;
if (height < 0)
height = drawable_private->height;
height = real_height;
}
((GdkDrawablePrivate *)drawable)->klass->draw_arc (drawable, gc, filled,
GDK_DRAWABLE_GET_CLASS (drawable)->draw_arc (drawable, gc, filled,
x, y, width, height, angle1, angle2);
}
@ -256,13 +248,10 @@ gdk_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
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_polygon (drawable, gc, filled,
GDK_DRAWABLE_GET_CLASS (drawable)->draw_polygon (drawable, gc, filled,
points, npoints);
}
@ -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,19 +323,24 @@ 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 < 0 || height < 0)
{
gint real_width;
gint real_height;
if (width == -1)
width = ((GdkDrawablePrivate *)src)->width;
if (height == -1)
height = ((GdkDrawablePrivate *)src)->height;
gdk_drawable_get_size (src, &real_width, &real_height);
((GdkDrawablePrivate *)drawable)->klass->draw_drawable (drawable, gc, src,
if (width < 0)
width = real_width;
if (height < 0)
height = real_height;
}
GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, src,
xsrc, ysrc, xdest, ydest,
width, height);
}
@ -362,24 +356,16 @@ 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,
GDK_DRAWABLE_GET_CLASS (drawable)->draw_image (drawable, gc, image, xsrc, ysrc,
xdest, ydest, width, height);
}
@ -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);
}

View File

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

View File

@ -29,21 +29,32 @@
#include "gdkgc.h"
#include "gdkprivate.h"
GdkGC*
gdk_gc_alloc (void)
GType
gdk_gc_get_type (void)
{
GdkGCPrivate *private;
static GType object_type = 0;
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;
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,
};
return (GdkGC *)private;
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 = ((GdkDrawablePrivate *)drawable)->klass->create_gc (drawable,
gc = GDK_DRAWABLE_GET_CLASS (drawable)->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);
}

View File

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

View File

@ -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 (GDK_IS_IMAGE (image));
g_return_if_fail (image != NULL);
g_return_if_fail (private->ref_count > 0);
private->ref_count--;
if (private->ref_count == 0)
private->klass->destroy (image);
g_object_unref (G_OBJECT (image));
}

View File

@ -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;
};
GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
struct _GdkImageClass
{
GObjectClass parent_class;
};
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 */

View File

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

View File

@ -48,13 +48,16 @@ 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,
g_object_set_qdata_full (G_OBJECT (context),
g_quark_from_static_string (GDK_INFO_KEY),
info, (GDestroyNotify)gdk_pango_context_destroy);
}
@ -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);

411
gdk/gdkpixmap.c Normal file
View File

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

View File

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

View File

@ -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)
#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 _GdkDrawablePrivate GdkDrawablePrivate;
typedef struct _GdkWindowPrivate GdkWindowPrivate;
typedef struct _GdkImageClass GdkImageClass;
typedef struct _GdkImagePrivate GdkImagePrivate;
typedef struct _GdkGCPrivate GdkGCPrivate;
typedef struct _GdkColormapPrivate GdkColormapPrivate;
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;

View File

@ -31,6 +31,7 @@
*/
#include <glib.h>
#include <pango/pango.h>
#include <glib-object.h>
#ifdef G_OS_WIN32
# ifdef GDK_COMPILATION

File diff suppressed because it is too large Load Diff

View File

@ -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,13 +140,68 @@ 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
*/
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);
@ -141,9 +218,6 @@ void gdk_window_move_resize (GdkWindow *window,
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,
@ -161,18 +235,19 @@ void gdk_window_clear_area_e (GdkWindow *window,
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);

View File

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

View File

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

View File

@ -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,28 +278,27 @@ 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);
@ -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);
}

View File

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

View File

@ -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,45 +123,68 @@ 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;
result = g_new0 (GdkDragContextPrivate, 1);
result->ref_count = 1;
contexts = g_list_prepend (contexts, result);
return (GdkDragContext *)result;
}
void
gdk_drag_context_ref (GdkDragContext *context)
{
g_return_if_fail (context != NULL);
((GdkDragContextPrivate *)context)->ref_count++;
}
void
gdk_drag_context_unref (GdkDragContext *context)
{
GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
g_return_if_fail (context != NULL);
g_return_if_fail (private->ref_count > 0);
private->ref_count--;
if (private->ref_count == 0)
if (!object_type)
{
g_dataset_destroy (private);
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;
}
static void
gdk_drag_context_init (GdkDragContext *dragcontext)
{
GdkDragContextPrivateX11 *private;
private = g_new0 (GdkDragContextPrivateX11, 1);
dragcontext->windowing_data = private;
contexts = g_list_prepend (contexts, dragcontext);
}
static void
gdk_drag_context_class_init (GdkDragContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_drag_context_finalize;
}
static void
gdk_drag_context_finalize (GObject *object)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
GdkDragContextPrivateX11 *private = PRIVATE_DATA (context);
g_list_free (context->targets);
@ -178,9 +203,35 @@ gdk_drag_context_unref (GdkDragContext *context)
if (private->window_cache)
gdk_window_cache_destroy (private->window_cache);
contexts = g_list_remove (contexts, private);
contexts = g_list_remove (contexts, context);
g_free (private);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/* 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));
g_object_ref (G_OBJECT (context));
}
void
gdk_drag_context_unref (GdkDragContext *context)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_object_unref (G_OBJECT (context));
}
static GdkDragContext *
@ -190,13 +241,13 @@ 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 ?
@ -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)
@ -2424,15 +2475,9 @@ xdnd_manage_source_filter (GdkDragContext *context,
{
gint old_warnings = 0; /* quiet gcc */
gboolean is_foreign = GDK_DRAWABLE_TYPE (window);
gdk_error_trap_push ();
if (is_foreign)
{
old_warnings = gdk_error_warnings;
gdk_error_warnings = 0;
}
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;
}

View File

@ -26,8 +26,21 @@
#include "gdkprivate-x11.h"
#include <pango/pangox.h>
#include <config.h>
static void gdk_x11_drawable_destroy (GdkDrawable *drawable);
#include <stdlib.h>
#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
#define USE_SHM
#endif
#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,
@ -91,95 +104,117 @@ static void gdk_x11_draw_glyphs (GdkDrawable *drawable,
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);
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,
};
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)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkDrawableImplX11Class),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_drawable_impl_x11_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDrawableImplX11),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
"GdkDrawableImplX11",
&object_info);
}
return object_type;
}
static void
gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
{
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_class->set_colormap = gdk_x11_set_colormap;
drawable_class->get_colormap = gdk_x11_get_colormap;
drawable_class->get_depth = gdk_x11_get_depth;
}
/*****************************************************
* X11 specific implementations of generic functions *
*****************************************************/
GdkColormap*
gdk_drawable_get_colormap (GdkDrawable *drawable)
static GdkColormap*
gdk_x11_get_colormap (GdkDrawable *drawable)
{
GdkDrawablePrivate *drawable_private;
XWindowAttributes window_attributes;
GdkDrawableImplX11 *impl;
g_return_val_if_fail (drawable != NULL, NULL);
drawable_private = (GdkDrawablePrivate*) drawable;
impl = GDK_DRAWABLE_IMPL_X11 (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);
}
return drawable_private->colormap;
}
return NULL;
return impl->colormap;
}
void
gdk_drawable_set_colormap (GdkDrawable *drawable,
static void
gdk_x11_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap)
{
GdkDrawablePrivate *drawable_private;
GdkColormapPrivateX *colormap_private;
GdkDrawableImplX11 *impl;
g_return_if_fail (drawable != NULL);
g_return_if_fail (colormap != NULL);
drawable_private = (GdkDrawablePrivate *)drawable;
colormap_private = (GdkColormapPrivateX *)colormap;
impl = GDK_DRAWABLE_IMPL_X11 (drawable);
if (!GDK_DRAWABLE_DESTROYED (drawable))
{
if (GDK_IS_WINDOW (drawable))
{
g_return_if_fail (colormap_private->base.visual !=
((GdkColormapPrivate *)(drawable_private->colormap))->visual);
if (impl->colormap == colormap)
return;
XSetWindowColormap (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (drawable),
colormap_private->xcolormap);
}
if (drawable_private->colormap)
gdk_colormap_unref (drawable_private->colormap);
drawable_private->colormap = colormap;
gdk_colormap_ref (drawable_private->colormap);
if (GDK_IS_WINDOW (drawable) &&
drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
gdk_window_add_colormap_windows (drawable);
}
if (impl->colormap)
gdk_colormap_unref (impl->colormap);
impl->colormap = colormap;
if (impl->colormap)
gdk_colormap_ref (impl->colormap);
}
/* Drawing
*/
static void
gdk_x11_drawable_destroy (GdkDrawable *drawable)
{
}
static void
gdk_x11_draw_rectangle (GdkDrawable *drawable,
@ -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,6 +270,10 @@ 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,6 +532,10 @@ 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++)
{
@ -470,8 +543,8 @@ gdk_x11_draw_lines (GdkDrawable *drawable,
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);
}

73
gdk/x11/gdkdrawable-x11.h Normal file
View File

@ -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__ */

View File

@ -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,7 +305,7 @@ 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;
@ -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);

View File

@ -13,7 +13,6 @@ static void gdk_x11_gc_values_to_xvalues (GdkGCValues *values,
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),
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));

View File

@ -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;
GdkWindowImplX11 *impl;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
data = (GdkWindowXData *)private->drawable.klass_data;
impl =
GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
gdk_window_compute_parent_pos (window, &parent_pos);
gdk_window_compute_position (window, &parent_pos, &data->position_info);
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))
return;
obj = GDK_WINDOW_OBJECT (window);
data = (GdkWindowXData *)private->drawable.klass_data;
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
if (GDK_WINDOW_DESTROYED (window))
return;
/* 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;
impl = GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
obj = GDK_WINDOW_OBJECT (window);
dx = x - private->x;
dy = y - private->y;
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;
gdk_window_compute_position (window, parent_pos, &new_info);
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
gdk_window_clip_changed (window, &data->position_info.clip_rect, &new_info.clip_rect);
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;
gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
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;
gdk_window_compute_position (window, parent_pos, &new_info);
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
this_pos.x = parent_pos->x + private->x;
this_pos.y = parent_pos->y + private->y;
gdk_window_compute_position (impl, parent_pos, &new_info);
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;
data->position_info.no_bg = TRUE;
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
if (private->bg_pixmap != GDK_NO_BG)
impl->position_info.no_bg = TRUE;
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
*/

View File

@ -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
GdkWindowObject *gdk_xgrab_window = NULL; /* Window that currently holds the
* x pointer grab
*/

View File

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

View File

@ -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 = 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;
private = (GdkImagePrivateX*) image;
switch (image->type)
{
case GDK_IMAGE_NORMAL:
@ -441,6 +473,7 @@ 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 */
@ -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;
}

View File

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

View File

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

View File

@ -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)
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);
static gpointer parent_class = NULL;
GType
gdk_pixmap_impl_x11_get_type (void)
{
XFreePixmap (GDK_DRAWABLE_XDISPLAY (pixmap), GDK_DRAWABLE_XID (pixmap));
gdk_xid_table_remove (GDK_DRAWABLE_XID (pixmap));
static GType object_type = 0;
g_free (GDK_DRAWABLE_XDATA (pixmap));
}
static GdkDrawable *
gdk_x11_pixmap_alloc (void)
{
GdkDrawable *drawable;
GdkDrawablePrivate *private;
static GdkDrawableClass klass;
static gboolean initialized = FALSE;
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);
}
drawable = gdk_drawable_alloc ();
private = (GdkDrawablePrivate *)drawable;
return object_type;
}
private->klass = &klass;
private->klass_data = g_new (GdkDrawableXData, 1);
private->window_type = GDK_DRAWABLE_PIXMAP;
return drawable;
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);
}
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,7 +145,8 @@ 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);
@ -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;
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);
GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
GDK_DRAWABLE_XDATA (private)->xid = XCreatePixmap (GDK_DRAWABLE_XDISPLAY (pixmap),
GDK_DRAWABLE_XID (window),
draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (window);
draw_impl->xid = XCreatePixmap (GDK_PIXMAP_XDISPLAY (pixmap),
GDK_WINDOW_XID (window),
width, height, depth);
private->width = width;
private->height = height;
private->depth = depth;
gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
pix_impl->width = width;
pix_impl->height = height;
GDK_PIXMAP_OBJECT (pixmap)->depth = depth;
gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
return pixmap;
}
@ -132,7 +187,8 @@ 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);
@ -141,22 +197,24 @@ 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),
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_DRAWABLE_XID (pixmap), pixmap);
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;
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 = depth;
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),
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;
@ -798,17 +860,20 @@ gdk_pixmap_foreign_new (GdkNativeWindow anid)
&x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
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);
GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DISPLAY ();
GDK_DRAWABLE_XDATA (private)->xid = xpixmap;
private->width = w_ret;
private->height = h_ret;
private->depth = depth_ret;
draw_impl->xdisplay = GDK_DISPLAY ();
draw_impl->xid = xpixmap;
gdk_xid_table_insert(&GDK_DRAWABLE_XID (pixmap), pixmap);
pix_impl->width = w_ret;
pix_impl->height = h_ret;
GDK_PIXMAP_OBJECT (pixmap)->depth = depth_ret;
gdk_xid_table_insert(&GDK_PIXMAP_XID (pixmap), pixmap);
return pixmap;
}

70
gdk/x11/gdkpixmap-x11.h Normal file
View File

@ -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__ */

View File

@ -63,7 +63,6 @@ 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,
@ -85,7 +84,7 @@ 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
extern GdkWindowObject *gdk_xgrab_window; /* Window that currently holds the
* x pointer grab
*/

View File

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

View File

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

File diff suppressed because it is too large Load Diff

89
gdk/x11/gdkwindow-x11.h Normal file
View File

@ -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__ */

View File

@ -33,59 +33,20 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <gdk/x11/gdkwindow-x11.h>
#include <gdk/x11/gdkpixmap-x11.h>
typedef struct _GdkGCXData GdkGCXData;
typedef struct _GdkDrawableXData GdkDrawableXData;
typedef struct _GdkWindowXData GdkWindowXData;
typedef struct _GdkXPositionInfo GdkXPositionInfo;
typedef struct _GdkColormapPrivateX GdkColormapPrivateX;
typedef struct _GdkColormapPrivateX11 GdkColormapPrivateX11;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkFontPrivateX GdkFontPrivateX;
typedef struct _GdkImagePrivateX GdkImagePrivateX;
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_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
#define GDK_WINDOW_XDISPLAY GDK_DRAWABLE_XDISPLAY
extern Display *gdk_display;
extern Window gdk_root_window;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 */
@ -5442,10 +5442,10 @@ gtk_clist_size_request (GtkWidget *widget,
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);
@ -7496,7 +7496,8 @@ drag_dest_cell (GtkCList *clist,
if (dest_info->cell.row < -1)
dest_info->cell.row = -1;
x -= GTK_CONTAINER (widget)->border_width + widget->style->klass->xthickness;
x -= GTK_CONTAINER (widget)->border_width + widget->style->xthickness;
dest_info->cell.column = COLUMN_FROM_XPIXEL (clist, x);
if (dest_info->cell.row >= 0)

View File

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

View File

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

View File

@ -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)
@ -5890,7 +5890,8 @@ drag_dest_cell (GtkCList *clist,
if (dest_info->cell.row < -1)
dest_info->cell.row = -1;
x -= GTK_CONTAINER (widget)->border_width + widget->style->klass->xthickness;
x -= GTK_CONTAINER (widget)->border_width + widget->style->xthickness;
dest_info->cell.column = COLUMN_FROM_XPIXEL (clist, x);
if (dest_info->cell.row >= 0)

View File

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

View File

@ -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);
@ -673,7 +673,7 @@ gtk_entry_size_request (GtkWidget *widget,
*/
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;

View File

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

View File

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

View File

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

View File

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

View File

@ -321,9 +321,9 @@ 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)
{
@ -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));
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,6 @@
typedef struct _GtkRcSet GtkRcSet;
typedef struct _GtkRcNode GtkRcNode;
typedef struct _GtkRcFile GtkRcFile;
typedef struct _GtkRcStylePrivate GtkRcStylePrivate;
struct _GtkRcSet
{
@ -80,15 +79,6 @@ 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);
@ -102,10 +92,9 @@ static GSList * gtk_rc_styles_match (GSList *rc_styles,
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 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);
@ -142,6 +131,11 @@ 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,
};
return (GtkRcStyle *)new_style;
object_type = g_type_register_static (G_TYPE_OBJECT,
"GtkRcStyle",
&object_info);
}
return object_type;
}
void
gtk_rc_style_ref (GtkRcStyle *rc_style)
static void
gtk_rc_style_init (GtkRcStyle *style)
{
g_return_if_fail (rc_style != NULL);
((GtkRcStylePrivate *)rc_style)->ref_count++;
}
static void
gtk_rc_style_class_init (GtkRcStyleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gtk_rc_style_finalize;
}
/* Like g_slist_remove, but remove all copies of data */
@ -783,20 +802,14 @@ 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;
g_return_if_fail (rc_style != NULL);
g_return_if_fail (private->ref_count > 0);
private->ref_count--;
if (private->ref_count == 0)
{
GSList *tmp_list1, *tmp_list2;
GtkRcStyle *rc_style;
rc_style = GTK_RC_STYLE (object);
if (rc_style->engine)
{
@ -816,7 +829,7 @@ gtk_rc_style_unref (GtkRcStyle *rc_style)
/* Now remove all references to this rc_style from
* realized_style_ht
*/
tmp_list1 = private->rc_style_lists;
tmp_list1 = rc_style->rc_style_lists;
while (tmp_list1)
{
GSList *rc_styles = tmp_list1->data;
@ -829,9 +842,9 @@ gtk_rc_style_unref (GtkRcStyle *rc_style)
tmp_list2 = rc_styles;
while (tmp_list2)
{
GtkRcStylePrivate *other_style = tmp_list2->data;
GtkRcStyle *other_style = tmp_list2->data;
if (other_style != private)
if (other_style != rc_style)
other_style->rc_style_lists =
gtk_rc_slist_remove_all (other_style->rc_style_lists, rc_styles);
@ -845,10 +858,35 @@ gtk_rc_style_unref (GtkRcStyle *rc_style)
tmp_list1 = tmp_list1->next;
}
g_slist_free (private->rc_style_lists);
g_slist_free (rc_style->rc_style_lists);
g_free (private);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GtkRcStyle *
gtk_rc_style_new (void)
{
GtkRcStyle *style;
style = GTK_RC_STYLE (g_type_create_instance (gtk_rc_style_get_type ()));
return style;
}
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;
}

View File

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

View File

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

View File

@ -150,6 +150,7 @@ void
gtk_socket_steal (GtkSocket *socket, GdkNativeWindow id)
{
GtkWidget *widget;
gpointer user_data = NULL;
widget = GTK_WIDGET (socket);
@ -157,7 +158,11 @@ gtk_socket_steal (GtkSocket *socket, GdkNativeWindow id)
gdk_error_trap_push ();
if (socket->plug_window && socket->plug_window->user_data)
if (socket->plug_window)
gdk_window_get_user_data (socket->plug_window,
&user_data);
if (user_data)
{
/*
GtkWidget *child_widget;

View File

@ -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,12 +522,12 @@ 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;
@ -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)

File diff suppressed because it is too large Load Diff

View File

@ -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,7 +67,9 @@ typedef struct _GtkWidget GtkWidget;
struct _GtkStyle
{
GtkStyleClass *klass;
GObject parent_instance;
/*< public >*/
GdkColor fg[5];
GdkColor bg[5];
@ -87,9 +96,11 @@ struct _GtkStyle
GdkPixmap *bg_pixmap[5];
/* private */
gint xthickness;
gint ythickness;
/*< 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,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More