summaryrefslogtreecommitdiff
path: root/gdk/gdkwindow.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2000-06-20 21:04:44 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-06-20 21:04:44 +0000
commitdf4fc3672127660c1d47e4225297d00abbee84eb (patch)
tree403962726a72ea66e7efa1b25169c03d7a59d362 /gdk/gdkwindow.c
parent2ad30e9fc1a98635ec329b8ff57a8e7a34968f8e (diff)
downloadgdk-pixbuf-df4fc3672127660c1d47e4225297d00abbee84eb.tar.gz
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.
Diffstat (limited to 'gdk/gdkwindow.c')
-rw-r--r--gdk/gdkwindow.c700
1 files changed, 443 insertions, 257 deletions
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ff25f7f70..0f4ce13c8 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -44,63 +44,61 @@ struct _GdkWindowPaint
gint x_offset;
gint y_offset;
};
-
-static void gdk_window_draw_destroy (GdkDrawable *drawable);
-static GdkGC *gdk_window_draw_create_gc (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask mask);
+static GdkGC *gdk_window_create_gc (GdkDrawable *drawable,
+ GdkGCValues *values,
+ GdkGCValuesMask mask);
static void gdk_window_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height);
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
static void gdk_window_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
+ GdkGC *gc,
+ gint filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint angle1,
+ gint angle2);
static void gdk_window_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ gint filled,
+ GdkPoint *points,
+ gint npoints);
static void gdk_window_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const gchar *text,
+ gint text_length);
static void gdk_window_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length);
static void gdk_window_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
+ GdkGC *gc,
+ GdkPixmap *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
static void gdk_window_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
static void gdk_window_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
+ GdkGC *gc,
+ GdkSegment *segs,
+ gint nsegs);
static void gdk_window_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
@@ -112,74 +110,131 @@ static void gdk_window_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs);
+static void gdk_window_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
+
+
+static void gdk_window_real_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+
+static GdkVisual* gdk_window_real_get_visual (GdkDrawable *drawable);
+static gint gdk_window_real_get_depth (GdkDrawable *drawable);
+static void gdk_window_real_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap);
+static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
+
static void gdk_window_free_paint_stack (GdkWindow *window);
-/* All drawing operations on windows are forwarded through the following
- * class to enable the automatic-backing-store feature.
- */
-GdkDrawableClass _gdk_window_class = {
- gdk_window_draw_destroy,
- gdk_window_draw_create_gc,
- gdk_window_draw_rectangle,
- gdk_window_draw_arc,
- gdk_window_draw_polygon,
- gdk_window_draw_text,
- gdk_window_draw_text_wc,
- gdk_window_draw_drawable,
- gdk_window_draw_points,
- gdk_window_draw_segments,
- gdk_window_draw_lines,
- gdk_window_draw_glyphs,
-};
+static void gdk_window_init (GdkWindowObject *window);
+static void gdk_window_class_init (GdkWindowObjectClass *klass);
+static void gdk_window_finalize (GObject *object);
-GdkWindow *
-_gdk_window_alloc (void)
+static gpointer parent_class = NULL;
+
+GType
+gdk_window_object_get_type (void)
{
- GdkWindowPrivate *private = g_new (GdkWindowPrivate, 1);
- GdkWindow *window = (GdkWindow*) private;
-
- window->user_data = NULL;
+ static GType object_type = 0;
- private->drawable.ref_count = 1;
- private->drawable.destroyed = FALSE;
- private->drawable.klass = NULL;
- private->drawable.klass_data = NULL;
- private->drawable.window_type = GDK_WINDOW_CHILD;
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (GdkWindowObjectClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gdk_window_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GdkWindowObject),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gdk_window_init,
+ };
+
+ object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
+ "GdkWindow",
+ &object_info);
+ }
+
+ return object_type;
+}
- private->drawable.width = 1;
- private->drawable.height = 1;
+static void
+gdk_window_init (GdkWindowObject *window)
+{
+ /* 0-initialization is good for all other fields. */
- private->drawable.colormap = NULL;
+ window->window_type = GDK_WINDOW_CHILD;
- private->parent = NULL;
- private->x = 0;
- private->y = 0;
- private->resize_count = 0;
+ window->impl =
+ GDK_DRAWABLE (g_type_create_instance (_gdk_window_impl_get_type ()));
+}
- private->mapped = FALSE;
- private->guffaw_gravity = FALSE;
- private->extension_events = FALSE;
+static void
+gdk_window_class_init (GdkWindowObjectClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
- private->filters = NULL;
- private->children = NULL;
-
- private->bg_color.pixel = 0;
- private->bg_color.red = 0;
- private->bg_color.green = 0;
- private->bg_color.blue = 0;
-
- private->bg_pixmap = NULL;
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gdk_window_finalize;
+
+ drawable_class->create_gc = gdk_window_create_gc;
+ drawable_class->draw_rectangle = gdk_window_draw_rectangle;
+ drawable_class->draw_arc = gdk_window_draw_arc;
+ drawable_class->draw_polygon = gdk_window_draw_polygon;
+ drawable_class->draw_text = gdk_window_draw_text;
+ drawable_class->draw_text_wc = gdk_window_draw_text_wc;
+ drawable_class->draw_drawable = gdk_window_draw_drawable;
+ drawable_class->draw_points = gdk_window_draw_points;
+ drawable_class->draw_segments = gdk_window_draw_segments;
+ drawable_class->draw_lines = gdk_window_draw_lines;
+ drawable_class->draw_glyphs = gdk_window_draw_glyphs;
+ drawable_class->draw_image = gdk_window_draw_image;
+ drawable_class->get_depth = gdk_window_real_get_depth;
+ drawable_class->get_size = gdk_window_real_get_size;
+ drawable_class->set_colormap = gdk_window_real_set_colormap;
+ drawable_class->get_colormap = gdk_window_real_get_colormap;
+ drawable_class->get_visual = gdk_window_real_get_visual;
+}
- private->paint_stack = NULL;
+static void
+gdk_window_finalize (GObject *object)
+{
+ GdkWindow *window = GDK_WINDOW (object);
+ GdkWindowObject *obj = (GdkWindowObject *) object;
+
+ if (!GDK_WINDOW_DESTROYED (window))
+ {
+ if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
+ {
+ g_warning ("losing last reference to undestroyed window\n");
+ _gdk_window_destroy (window, FALSE);
+ }
+ else
+ /* We use TRUE here, to keep us from actually calling
+ * XDestroyWindow() on the window
+ */
+ _gdk_window_destroy (window, TRUE);
+ }
- private->update_area = NULL;
- private->update_freeze_count = 0;
+ g_object_unref (G_OBJECT (obj->impl));
+ obj->impl = NULL;
- return window;
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
- * _gdk_window_destroy_heirarchy:
+ * _gdk_window_destroy_hierarchy:
* @window: a #GdkWindow
* @recursing: If TRUE, then this is being called because a parent
* was destroyed. This generally means that the call to the windowing system
@@ -195,37 +250,37 @@ _gdk_window_alloc (void)
* drop the reference count created by gdk_window_new().
**/
static void
-_gdk_window_destroy_heirarchy (GdkWindow *window,
+_gdk_window_destroy_hierarchy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
- GdkWindowPrivate *private;
- GdkWindowPrivate *temp_private;
+ GdkWindowObject *private;
+ GdkWindowObject *temp_private;
GdkWindow *temp_window;
GList *children;
GList *tmp;
g_return_if_fail (window != NULL);
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindowObject*) window;
- switch (private->drawable.window_type)
+ switch (GDK_WINDOW_TYPE (window))
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
case GDK_WINDOW_FOREIGN:
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
private->mapped = FALSE;
- private->drawable.destroyed = TRUE;
+ private->destroyed = TRUE;
_gdk_windowing_window_destroy (window, recursing, foreign_destroy);
if (private->parent)
{
- GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;
+ GdkWindowObject *parent_private = (GdkWindowObject *)private->parent;
if (parent_private->children)
parent_private->children = g_list_remove (parent_private->children, window);
}
@@ -239,7 +294,7 @@ _gdk_window_destroy_heirarchy (GdkWindow *window,
private->bg_pixmap = NULL;
}
- if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_FOREIGN)
+ if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
{
children = tmp = private->children;
private->children = NULL;
@@ -249,9 +304,9 @@ _gdk_window_destroy_heirarchy (GdkWindow *window,
temp_window = tmp->data;
tmp = tmp->next;
- temp_private = (GdkWindowPrivate*) temp_window;
+ temp_private = (GdkWindowObject*) temp_window;
if (temp_private)
- _gdk_window_destroy_heirarchy (temp_window, TRUE, foreign_destroy);
+ _gdk_window_destroy_hierarchy (temp_window, TRUE, foreign_destroy);
}
g_list_free (children);
@@ -270,22 +325,14 @@ _gdk_window_destroy_heirarchy (GdkWindow *window,
g_list_free (private->filters);
private->filters = NULL;
}
-
- if (private->drawable.colormap)
- {
- gdk_colormap_unref (private->drawable.colormap);
- private->drawable.colormap = NULL;
- }
+
+ gdk_drawable_set_colormap (GDK_DRAWABLE (window), NULL);
}
break;
case GDK_WINDOW_ROOT:
g_error ("attempted to destroy root window");
break;
-
- case GDK_WINDOW_PIXMAP:
- g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
- break;
}
}
@@ -304,13 +351,13 @@ void
_gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy)
{
- _gdk_window_destroy_heirarchy (window, FALSE, foreign_destroy);
+ _gdk_window_destroy_hierarchy (window, FALSE, foreign_destroy);
}
void
gdk_window_destroy (GdkWindow *window)
{
- _gdk_window_destroy_heirarchy (window, FALSE, FALSE);
+ _gdk_window_destroy_hierarchy (window, FALSE, FALSE);
gdk_drawable_unref (window);
}
@@ -320,7 +367,7 @@ gdk_window_set_user_data (GdkWindow *window,
{
g_return_if_fail (window != NULL);
- window->user_data = user_data;
+ ((GdkWindowObject*)window)->user_data = user_data;
}
void
@@ -329,7 +376,15 @@ gdk_window_get_user_data (GdkWindow *window,
{
g_return_if_fail (window != NULL);
- *data = window->user_data;
+ *data = ((GdkWindowObject*)window)->user_data;
+}
+
+GdkWindowType
+gdk_window_get_window_type (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), (GdkWindowType) -1);
+
+ return GDK_WINDOW_TYPE (window);
}
void
@@ -337,41 +392,60 @@ gdk_window_get_position (GdkWindow *window,
gint *x,
gint *y)
{
- GdkWindowPrivate *window_private;
+ GdkWindowObject *obj;
- g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- window_private = (GdkWindowPrivate*) window;
+ obj = (GdkWindowObject*) window;
if (x)
- *x = window_private->x;
+ *x = obj->x;
if (y)
- *y = window_private->y;
+ *y = obj->y;
}
GdkWindow*
gdk_window_get_parent (GdkWindow *window)
{
- g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
- return ((GdkWindowPrivate*) window)->parent;
+ return (GdkWindow*) ((GdkWindowObject*) window)->parent;
}
GdkWindow*
gdk_window_get_toplevel (GdkWindow *window)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *obj;
- g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
- private = (GdkWindowPrivate *)window;
- while (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
- private = (GdkWindowPrivate *)private->parent;
+ obj = (GdkWindowObject *)window;
+ while (GDK_WINDOW_TYPE (obj) == GDK_WINDOW_CHILD)
+ obj = (GdkWindowObject *)obj->parent;
- return (GdkWindow *)window;
+ return GDK_WINDOW (obj);
+}
+
+GList*
+gdk_window_get_children (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return NULL;
+
+ return g_list_copy (GDK_WINDOW_OBJECT (window)->children);
+}
+
+GList *
+gdk_window_peek_children (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return NULL;
+
+ return GDK_WINDOW_OBJECT (window)->children;
}
void
@@ -379,15 +453,15 @@ gdk_window_add_filter (GdkWindow *window,
GdkFilterFunc function,
gpointer data)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
GList *tmp_list;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowPrivate*) window;
- if (private && GDK_DRAWABLE_DESTROYED (window))
+ private = (GdkWindowObject*) window;
+ if (private && GDK_WINDOW_DESTROYED (window))
return;
if (private)
@@ -418,14 +492,14 @@ gdk_window_remove_filter (GdkWindow *window,
GdkFilterFunc function,
gpointer data)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private;
GList *tmp_list, *node;
GdkEventFilter *filter;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowPrivate*) window;
+ private = (GdkWindowObject*) window;
if (private)
tmp_list = private->filters;
@@ -458,7 +532,7 @@ gdk_window_get_toplevels (void)
GList *new_list = NULL;
GList *tmp_list;
- tmp_list = ((GdkWindowPrivate *)gdk_parent_root)->children;
+ tmp_list = ((GdkWindowObject *)gdk_parent_root)->children;
while (tmp_list)
{
new_list = g_list_prepend (new_list, tmp_list->data);
@@ -480,7 +554,7 @@ gdk_window_get_toplevels (void)
gboolean
gdk_window_is_visible (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
@@ -503,19 +577,19 @@ gdk_window_is_visible (GdkWindow *window)
gboolean
gdk_window_is_viewable (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
while (private &&
- (private != (GdkWindowPrivate *)gdk_parent_root) &&
- (private->drawable.window_type != GDK_WINDOW_FOREIGN))
+ (private != (GdkWindowObject *)gdk_parent_root) &&
+ (GDK_WINDOW_TYPE (private) != GDK_WINDOW_FOREIGN))
{
if (!private->mapped)
return FALSE;
- private = (GdkWindowPrivate *)private->parent;
+ private = (GdkWindowObject *)private->parent;
}
return TRUE;
@@ -538,7 +612,7 @@ gdk_window_begin_paint_rect (GdkWindow *window,
static GdkGC *
gdk_window_get_bg_gc (GdkWindow *window, GdkWindowPaint *paint)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
guint gc_mask = 0;
GdkGCValues gc_values;
@@ -549,7 +623,7 @@ gdk_window_get_bg_gc (GdkWindow *window, GdkWindowPaint *paint)
tmp_paint.x_offset += private->x;
tmp_paint.y_offset += private->y;
- return gdk_window_get_bg_gc (private->parent, &tmp_paint);
+ return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
}
else if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG && private->bg_pixmap != GDK_NO_BG)
{
@@ -586,7 +660,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
GdkRegion *region)
{
#ifdef USE_BACKING_STORE
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkRectangle clip_box;
GdkWindowPaint *paint;
GdkRegion *init_region;
@@ -595,7 +669,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
paint = g_new (GdkWindowPaint, 1);
@@ -681,7 +755,7 @@ void
gdk_window_end_paint (GdkWindow *window)
{
#ifdef USE_BACKING_STORE
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowPaint *paint;
GdkGC *tmp_gc;
GdkRectangle clip_box;
@@ -690,7 +764,7 @@ gdk_window_end_paint (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
g_return_if_fail (private->paint_stack != NULL);
@@ -707,11 +781,11 @@ gdk_window_end_paint (GdkWindow *window)
gdk_gc_set_clip_region (tmp_gc, paint->region);
gdk_gc_set_clip_origin (tmp_gc, -x_offset, -y_offset);
- _gdk_windowing_window_class.draw_drawable (window, tmp_gc, paint->pixmap,
- clip_box.x - paint->x_offset,
- clip_box.y - paint->y_offset,
- clip_box.x - x_offset, clip_box.y - y_offset,
- clip_box.width, clip_box.height);
+ gdk_draw_drawable (private->impl, tmp_gc, paint->pixmap,
+ clip_box.x - paint->x_offset,
+ clip_box.y - paint->y_offset,
+ clip_box.x - x_offset, clip_box.y - y_offset,
+ clip_box.width, clip_box.height);
gdk_gc_unref (tmp_gc);
if (private->paint_stack)
@@ -736,7 +810,7 @@ gdk_window_end_paint (GdkWindow *window)
static void
gdk_window_free_paint_stack (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
if (private->paint_stack)
{
@@ -765,7 +839,7 @@ gdk_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
if (private->paint_stack)
{
@@ -779,10 +853,10 @@ gdk_window_get_offsets (GdkWindow *window,
#define OFFSET_GC(gc) \
gint x_offset, y_offset; \
- gint old_clip_x = ((GdkGCPrivate *)gc)->clip_x_origin; \
- gint old_clip_y = ((GdkGCPrivate *)gc)->clip_y_origin; \
- gint old_ts_x = ((GdkGCPrivate *)gc)->ts_x_origin; \
- gint old_ts_y = ((GdkGCPrivate *)gc)->ts_y_origin; \
+ gint old_clip_x = gc->clip_x_origin; \
+ gint old_clip_y = gc->clip_y_origin; \
+ gint old_ts_x = gc->ts_x_origin; \
+ gint old_ts_y = gc->ts_y_origin; \
gdk_window_get_offsets (drawable, &x_offset, &y_offset); \
if (x_offset != 0 || y_offset != 0) \
{ \
@@ -799,18 +873,18 @@ gdk_window_get_offsets (GdkWindow *window,
gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y); \
}
-static void
-gdk_window_draw_destroy (GdkDrawable *drawable)
-{
- _gdk_windowing_window_class.destroy (drawable);
-}
-
static GdkGC *
-gdk_window_draw_create_gc (GdkDrawable *drawable,
- GdkGCValues *values,
- GdkGCValuesMask mask)
+gdk_window_create_gc (GdkDrawable *drawable,
+ GdkGCValues *values,
+ GdkGCValuesMask mask)
{
- return _gdk_windowing_window_class.create_gc (drawable, values, mask);
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return NULL;
+
+ return gdk_gc_new_with_values (((GdkWindowObject *) drawable)->impl,
+ values, mask);
}
static void
@@ -822,8 +896,11 @@ gdk_window_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
if (private->paint_stack)
{
@@ -832,8 +909,8 @@ gdk_window_draw_rectangle (GdkDrawable *drawable,
x - x_offset, y - y_offset, width, height);
}
else
- _gdk_windowing_window_class.draw_rectangle (drawable, gc, filled,
- x - x_offset, y - y_offset, width, height);
+ gdk_draw_rectangle (private->impl, gc, filled,
+ x - x_offset, y - y_offset, width, height);
RESTORE_GC (gc);
}
@@ -849,9 +926,12 @@ gdk_window_draw_arc (GdkDrawable *drawable,
gint angle1,
gint angle2)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -860,9 +940,9 @@ gdk_window_draw_arc (GdkDrawable *drawable,
width, height, angle1, angle2);
}
else
- _gdk_windowing_window_class.draw_arc (drawable, gc, filled,
- x - x_offset, y - y_offset,
- width, height, angle1, angle2);
+ gdk_draw_arc (private->impl, gc, filled,
+ x - x_offset, y - y_offset,
+ width, height, angle1, angle2);
RESTORE_GC (gc);
}
@@ -873,11 +953,14 @@ gdk_window_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
int i;
@@ -899,8 +982,8 @@ gdk_window_draw_polygon (GdkDrawable *drawable,
}
else
- _gdk_windowing_window_class.draw_polygon (drawable, gc, filled, new_points, npoints);
-
+ gdk_draw_polygon (private->impl, gc, filled, new_points, npoints);
+
if (new_points != points)
g_free (new_points);
@@ -916,9 +999,12 @@ gdk_window_draw_text (GdkDrawable *drawable,
const gchar *text,
gint text_length)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -927,8 +1013,8 @@ gdk_window_draw_text (GdkDrawable *drawable,
}
else
- _gdk_windowing_window_class.draw_text (drawable, font, gc,
- x - x_offset, y - y_offset, text, text_length);
+ gdk_draw_text (private->impl, font, gc,
+ x - x_offset, y - y_offset, text, text_length);
RESTORE_GC (gc);
}
@@ -942,9 +1028,12 @@ gdk_window_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text,
gint text_length)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -952,9 +1041,9 @@ gdk_window_draw_text_wc (GdkDrawable *drawable,
x - x_offset, y - y_offset, text, text_length);
}
else
- _gdk_windowing_window_class.draw_text_wc (drawable, font, gc,
- x - x_offset, y - y_offset, text, text_length);
-
+ gdk_draw_text_wc (private->impl, font, gc,
+ x - x_offset, y - y_offset, text, text_length);
+
RESTORE_GC (gc);
}
@@ -969,9 +1058,12 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -980,9 +1072,9 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
}
else
- _gdk_windowing_window_class.draw_drawable (drawable, gc, src, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
+ gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
+ xdest - x_offset, ydest - y_offset,
+ width, height);
RESTORE_GC (gc);
}
@@ -992,11 +1084,14 @@ gdk_window_draw_points (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
@@ -1017,7 +1112,7 @@ gdk_window_draw_points (GdkDrawable *drawable,
gdk_draw_points (paint->pixmap, gc, new_points, npoints);
}
else
- _gdk_windowing_window_class.draw_points (drawable, gc, points, npoints);
+ gdk_draw_points (private->impl, gc, points, npoints);
if (new_points != points)
g_free (new_points);
@@ -1031,11 +1126,14 @@ gdk_window_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkSegment *new_segs;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
@@ -1058,8 +1156,8 @@ gdk_window_draw_segments (GdkDrawable *drawable,
gdk_draw_segments (paint->pixmap, gc, new_segs, nsegs);
}
else
- _gdk_windowing_window_class.draw_segments (drawable, gc, new_segs, nsegs);
-
+ gdk_draw_segments (private->impl, gc, new_segs, nsegs);
+
if (new_segs != segs)
g_free (new_segs);
@@ -1072,11 +1170,14 @@ gdk_window_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkPoint *new_points;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (x_offset != 0 || y_offset != 0)
{
gint i;
@@ -1097,7 +1198,7 @@ gdk_window_draw_lines (GdkDrawable *drawable,
gdk_draw_lines (paint->pixmap, gc, new_points, npoints);
}
else
- _gdk_windowing_window_class.draw_lines (drawable, gc, new_points, npoints);
+ gdk_draw_lines (private->impl, gc, new_points, npoints);
if (new_points != points)
g_free (new_points);
@@ -1113,10 +1214,13 @@ gdk_window_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
@@ -1124,8 +1228,8 @@ gdk_window_draw_glyphs (GdkDrawable *drawable,
gdk_draw_glyphs (paint->pixmap, gc, font, x - x_offset, y - y_offset, glyphs);
}
else
- _gdk_windowing_window_class.draw_glyphs (drawable, gc, font,
- x - x_offset, y - y_offset, glyphs);
+ gdk_draw_glyphs (private->impl, gc, font,
+ x - x_offset, y - y_offset, glyphs);
RESTORE_GC (gc);
}
@@ -1138,10 +1242,13 @@ gdk_window_clear_backing_rect (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowPaint *paint = private->paint_stack->data;
GdkGC *tmp_gc;
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
tmp_gc = gdk_window_get_bg_gc (window, paint);
gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE,
x - paint->x_offset, y - paint->y_offset, width, height);
@@ -1151,13 +1258,15 @@ gdk_window_clear_backing_rect (GdkWindow *window,
void
gdk_window_clear (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+ gint width, height;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
+ gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+
gdk_window_clear_area (window, 0, 0,
- private->drawable.width, private->drawable.height);
+ width, height);
}
void
@@ -1167,7 +1276,7 @@ gdk_window_clear_area (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1185,7 +1294,7 @@ gdk_window_clear_area_e (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1196,38 +1305,104 @@ gdk_window_clear_area_e (GdkWindow *window,
_gdk_windowing_window_clear_area_e (window, x, y, width, height);
}
-void
-_gdk_window_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
+static void
+gdk_window_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
{
- GdkImagePrivate *image_private = (GdkImagePrivate*) image;
- GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+ GdkWindowObject *private = (GdkWindowObject *)drawable;
OFFSET_GC (gc);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
if (private->paint_stack)
{
GdkWindowPaint *paint = private->paint_stack->data;
- image_private->klass->image_put (image, paint->pixmap, gc, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
+ gdk_draw_image (paint->pixmap, gc, image, xsrc, ysrc,
+ xdest - x_offset, ydest - y_offset,
+ width, height);
}
else
- image_private->klass->image_put (image, drawable, gc, xsrc, ysrc,
- xdest - x_offset, ydest - y_offset,
- width, height);
+ gdk_draw_image (private->impl, gc, image, xsrc, ysrc,
+ xdest - x_offset, ydest - y_offset,
+ width, height);
RESTORE_GC (gc);
}
+
+static void
+gdk_window_real_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height)
+{
+ g_return_if_fail (GDK_IS_WINDOW (drawable));
+
+ gdk_drawable_get_size (GDK_WINDOW_OBJECT (drawable)->impl,
+ width, height);
+}
+
+static GdkVisual*
+gdk_window_real_get_visual (GdkDrawable *drawable)
+{
+ GdkColormap *colormap;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+ colormap = gdk_drawable_get_colormap (drawable);
+ return colormap ? gdk_colormap_get_visual (colormap) : NULL;
+}
+
+static gint
+gdk_window_real_get_depth (GdkDrawable *drawable)
+{
+ gint depth;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), 0);
+
+ depth = ((GdkWindowObject *)GDK_WINDOW (drawable))->depth;
+
+ if (depth == 0)
+ {
+ g_print ("0 depth for type %s\n", g_type_name (G_OBJECT_TYPE (drawable)));
+ G_BREAKPOINT ();
+ }
+
+ return depth;
+}
+
+static void
+gdk_window_real_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap)
+{
+ g_return_if_fail (GDK_IS_WINDOW (drawable));
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return;
+
+ gdk_drawable_set_colormap (((GdkWindowObject*)drawable)->impl, cmap);
+}
+
+static GdkColormap*
+gdk_window_real_get_colormap (GdkDrawable *drawable)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+ if (GDK_WINDOW_DESTROYED (drawable))
+ return NULL;
+
+ return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl);
+}
+
/* Code for dirty-region queueing
*/
@@ -1237,7 +1412,7 @@ static guint update_idle = 0;
static void
gdk_window_process_updates_internal (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
gboolean save_region = FALSE;
/* If an update got queued during update processing, we can get a
@@ -1253,11 +1428,14 @@ gdk_window_process_updates_internal (GdkWindow *window)
{
GdkEvent event;
GdkRectangle window_rect;
-
+ gint width, height;
+
+ gdk_drawable_get_size (GDK_DRAWABLE (private), &width, &height);
+
window_rect.x = 0;
window_rect.y = 0;
- window_rect.width = private->drawable.width;
- window_rect.height = private->drawable.height;
+ window_rect.width = width;
+ window_rect.height = height;
save_region = _gdk_windowing_window_queue_antiexpose (window, update_area);
@@ -1314,7 +1492,7 @@ void
gdk_window_process_updates (GdkWindow *window,
gboolean update_children)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1342,20 +1520,21 @@ gdk_window_invalidate_rect (GdkWindow *window,
gboolean invalidate_children)
{
GdkRectangle window_rect;
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
if (!rect)
{
window_rect.x = 0;
window_rect.y = 0;
- window_rect.width = private->drawable.width;
- window_rect.height = private->drawable.height;
+ gdk_drawable_get_size (GDK_DRAWABLE (window),
+ &window_rect.width,
+ &window_rect.height);
rect = &window_rect;
}
@@ -1382,18 +1561,20 @@ gdk_window_invalidate_rect (GdkWindow *window,
tmp_list = private->children;
while (tmp_list)
{
- GdkWindowPrivate *child = tmp_list->data;
+ GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
- /* FIXME: this is a HACK to figure out if the child is
- * input-only.
- */
- if (child->drawable.colormap)
+ if (!child->input_only)
{
+ gint width, height;
+
+ gdk_drawable_get_size (GDK_DRAWABLE (child),
+ &width, &height);
+
child_rect.x = child->x;
child_rect.y = child->y;
- child_rect.width = child->drawable.width;
- child_rect.height = child->drawable.height;
+ child_rect.width = width;
+ child_rect.height = height;
if (gdk_rectangle_intersect (rect, &child_rect, &new_rect))
{
@@ -1412,12 +1593,12 @@ gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *region,
gboolean invalidate_children)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
if (private->input_only)
@@ -1446,15 +1627,20 @@ gdk_window_invalidate_region (GdkWindow *window,
tmp_list = private->children;
while (tmp_list)
{
- GdkWindowPrivate *child = tmp_list->data;
+ GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (child->input_only)
{
+ gint width, height;
+
+ gdk_drawable_get_size (GDK_DRAWABLE (child),
+ &width, &height);
+
child_rect.x = child->x;
child_rect.y = child->y;
- child_rect.width = child->drawable.width;
- child_rect.height = child->drawable.height;
+ child_rect.width = width;
+ child_rect.height = height;
child_region = gdk_region_rectangle (&child_rect);
gdk_region_intersect (child_region, region);
@@ -1474,7 +1660,7 @@ gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *
gdk_window_get_update_area (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GdkRegion *tmp_region;
g_return_val_if_fail (window != NULL, NULL);
@@ -1503,7 +1689,7 @@ gdk_window_get_update_area (GdkWindow *window)
void
_gdk_window_clear_update_area (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1520,7 +1706,7 @@ _gdk_window_clear_update_area (GdkWindow *window)
void
gdk_window_freeze_updates (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1531,7 +1717,7 @@ gdk_window_freeze_updates (GdkWindow *window)
void
gdk_window_thaw_updates (GdkWindow *window)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));