Fix a reference to window_private->destroyed.

Sun Oct  3 18:13:44 1999  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
	Fix a reference to window_private->destroyed.

	* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
	(ugly) setting of an internal GdkWindow member to use
	a _slightly_ cleaner macro.

	* gdk/gdkprivate.h: Split GdkWindowPrivate into
	GdkDrawablePrivate and GdkWindowPrivate.
	Add extra macros for accessing GDK_DRAWABLE_ components.

	* *.[ch]: Massive adjustments for the above, use the
	new macros in a lot of places.
This commit is contained in:
Owen Taylor 1999-10-03 22:12:41 +00:00 committed by Owen Taylor
parent 344e8000a2
commit f903bdf1a7
43 changed files with 1355 additions and 1500 deletions

View File

@ -1,3 +1,28 @@
Sun Oct 3 18:13:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
Fix a reference to window_private->destroyed.
* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
(ugly) setting of an internal GdkWindow member to use
a _slightly_ cleaner macro.
* gdk/gdkprivate.h: Split GdkWindowPrivate into
GdkDrawablePrivate and GdkWindowPrivate.
Add extra macros for accessing GDK_DRAWABLE_ components.
* *.[ch]: Massive adjustments for the above, use the
new macros in a lot of places.
Sun Oct 3 15:16:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdktypes.h: Make GdkDrawable the base type,
not GdkWindow.
Sun Oct 3 15:08:44 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdraw.c (gdk_drawable_get_data): Added new function.
Sun Oct 3 14:26:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gxid* gdk/x11/gxid*: Move files into x11 subdirectory.

View File

@ -1,3 +1,28 @@
Sun Oct 3 18:13:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
Fix a reference to window_private->destroyed.
* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
(ugly) setting of an internal GdkWindow member to use
a _slightly_ cleaner macro.
* gdk/gdkprivate.h: Split GdkWindowPrivate into
GdkDrawablePrivate and GdkWindowPrivate.
Add extra macros for accessing GDK_DRAWABLE_ components.
* *.[ch]: Massive adjustments for the above, use the
new macros in a lot of places.
Sun Oct 3 15:16:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdktypes.h: Make GdkDrawable the base type,
not GdkWindow.
Sun Oct 3 15:08:44 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdraw.c (gdk_drawable_get_data): Added new function.
Sun Oct 3 14:26:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gxid* gdk/x11/gxid*: Move files into x11 subdirectory.

View File

@ -1,3 +1,28 @@
Sun Oct 3 18:13:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
Fix a reference to window_private->destroyed.
* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
(ugly) setting of an internal GdkWindow member to use
a _slightly_ cleaner macro.
* gdk/gdkprivate.h: Split GdkWindowPrivate into
GdkDrawablePrivate and GdkWindowPrivate.
Add extra macros for accessing GDK_DRAWABLE_ components.
* *.[ch]: Massive adjustments for the above, use the
new macros in a lot of places.
Sun Oct 3 15:16:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdktypes.h: Make GdkDrawable the base type,
not GdkWindow.
Sun Oct 3 15:08:44 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdraw.c (gdk_drawable_get_data): Added new function.
Sun Oct 3 14:26:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gxid* gdk/x11/gxid*: Move files into x11 subdirectory.

View File

@ -1,3 +1,28 @@
Sun Oct 3 18:13:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
Fix a reference to window_private->destroyed.
* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
(ugly) setting of an internal GdkWindow member to use
a _slightly_ cleaner macro.
* gdk/gdkprivate.h: Split GdkWindowPrivate into
GdkDrawablePrivate and GdkWindowPrivate.
Add extra macros for accessing GDK_DRAWABLE_ components.
* *.[ch]: Massive adjustments for the above, use the
new macros in a lot of places.
Sun Oct 3 15:16:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdktypes.h: Make GdkDrawable the base type,
not GdkWindow.
Sun Oct 3 15:08:44 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdraw.c (gdk_drawable_get_data): Added new function.
Sun Oct 3 14:26:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gxid* gdk/x11/gxid*: Move files into x11 subdirectory.

View File

@ -1,3 +1,28 @@
Sun Oct 3 18:13:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
Fix a reference to window_private->destroyed.
* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
(ugly) setting of an internal GdkWindow member to use
a _slightly_ cleaner macro.
* gdk/gdkprivate.h: Split GdkWindowPrivate into
GdkDrawablePrivate and GdkWindowPrivate.
Add extra macros for accessing GDK_DRAWABLE_ components.
* *.[ch]: Massive adjustments for the above, use the
new macros in a lot of places.
Sun Oct 3 15:16:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdktypes.h: Make GdkDrawable the base type,
not GdkWindow.
Sun Oct 3 15:08:44 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdraw.c (gdk_drawable_get_data): Added new function.
Sun Oct 3 14:26:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gxid* gdk/x11/gxid*: Move files into x11 subdirectory.

View File

@ -1,3 +1,28 @@
Sun Oct 3 18:13:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
Fix a reference to window_private->destroyed.
* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
(ugly) setting of an internal GdkWindow member to use
a _slightly_ cleaner macro.
* gdk/gdkprivate.h: Split GdkWindowPrivate into
GdkDrawablePrivate and GdkWindowPrivate.
Add extra macros for accessing GDK_DRAWABLE_ components.
* *.[ch]: Massive adjustments for the above, use the
new macros in a lot of places.
Sun Oct 3 15:16:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdktypes.h: Make GdkDrawable the base type,
not GdkWindow.
Sun Oct 3 15:08:44 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdraw.c (gdk_drawable_get_data): Added new function.
Sun Oct 3 14:26:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gxid* gdk/x11/gxid*: Move files into x11 subdirectory.

View File

@ -1,3 +1,28 @@
Sun Oct 3 18:13:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_reset_shapes_recurse):
Fix a reference to window_private->destroyed.
* gtk/gtkplug.c (gtk_plug_realize): Fix up a direct
(ugly) setting of an internal GdkWindow member to use
a _slightly_ cleaner macro.
* gdk/gdkprivate.h: Split GdkWindowPrivate into
GdkDrawablePrivate and GdkWindowPrivate.
Add extra macros for accessing GDK_DRAWABLE_ components.
* *.[ch]: Massive adjustments for the above, use the
new macros in a lot of places.
Sun Oct 3 15:16:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdktypes.h: Make GdkDrawable the base type,
not GdkWindow.
Sun Oct 3 15:08:44 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdraw.c (gdk_drawable_get_data): Added new function.
Sun Oct 3 14:26:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gxid* gdk/x11/gxid*: Move files into x11 subdirectory.

View File

@ -1,3 +1,9 @@
General
=======
- gdk_pointer_grab() and gdk_keyboard_grab() are logically member
functions of GdkWindow.
Dir structure for ports
=======================

View File

@ -47,6 +47,7 @@
#include "gdk.h"
#include "gdkx.h"
#include "gdkprivate.h"
#include "gdkinputprivate.h"
@ -493,10 +494,7 @@ gdk_pointer_grab (GdkWindow * window,
GdkCursor * cursor,
guint32 time)
{
/* From gdkwindow.c */
gint return_val;
GdkWindowPrivate *window_private;
GdkWindowPrivate *confine_to_private;
GdkCursorPrivate *cursor_private;
guint xevent_mask;
Window xwindow;
@ -505,17 +503,17 @@ gdk_pointer_grab (GdkWindow * window,
int i;
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
window_private = (GdkWindowPrivate*) window;
confine_to_private = (GdkWindowPrivate*) confine_to;
cursor_private = (GdkCursorPrivate*) cursor;
xwindow = window_private->xwindow;
xwindow = GDK_DRAWABLE_XID (window);
if (!confine_to || confine_to_private->destroyed)
if (!confine_to || GDK_DRAWABLE_DESTROYED (confine_to))
xconfine_to = None;
else
xconfine_to = confine_to_private->xwindow;
xconfine_to = GDK_DRAWABLE_XID (confine_to);
if (!cursor)
xcursor = None;
@ -541,8 +539,8 @@ gdk_pointer_grab (GdkWindow * window,
if (return_val == Success)
{
if (!window_private->destroyed)
return_val = XGrabPointer (window_private->xdisplay,
if (!GDK_DRAWABLE_DESTROYED (window))
return_val = XGrabPointer (GDK_DRAWABLE_XDISPLAY (window),
xwindow,
owner_events,
xevent_mask,
@ -555,7 +553,7 @@ gdk_pointer_grab (GdkWindow * window,
}
if (return_val == GrabSuccess)
gdk_xgrab_window = window_private;
gdk_xgrab_window = (GdkWindowPrivate *)window;
return return_val;
}
@ -631,17 +629,12 @@ gdk_keyboard_grab (GdkWindow * window,
gint owner_events,
guint32 time)
{
GdkWindowPrivate *window_private;
Window xwindow;
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
window_private = (GdkWindowPrivate*) window;
xwindow = window_private->xwindow;
if (!window_private->destroyed)
return XGrabKeyboard (window_private->xdisplay,
xwindow,
if (!GDK_DRAWABLE_DESTROYED (window))
return XGrabKeyboard (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
owner_events,
GrabModeAsync, GrabModeAsync,
time);

View File

@ -47,6 +47,8 @@
#include <gdk/gdkvisual.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdkcompat.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

View File

@ -27,6 +27,7 @@
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include "gdkx.h"
#include "gdkcursor.h"
#include "gdkprivate.h"
@ -57,8 +58,8 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, GdkColor *fg, Gd
Cursor xcursor;
XColor xfg, xbg;
source_pixmap = ((GdkPixmapPrivate *) source)->xwindow;
mask_pixmap = ((GdkPixmapPrivate *) mask)->xwindow;
source_pixmap = GDK_DRAWABLE_XID (source);
mask_pixmap = GDK_DRAWABLE_XID (mask);
xfg.pixel = fg->pixel;
xfg.red = fg->red;

View File

@ -2416,9 +2416,8 @@ xdnd_manage_source_filter (GdkDragContext *context,
gboolean add_filter)
{
gint old_warnings = 0; /* quiet gcc */
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
gboolean is_foreign = (private->window_type == GDK_WINDOW_FOREIGN);
gboolean is_foreign = GDK_DRAWABLE_TYPE (window);
if (is_foreign)
{
@ -2426,7 +2425,7 @@ xdnd_manage_source_filter (GdkDragContext *context,
gdk_error_warnings = 0;
}
if (!private->destroyed)
if (!GDK_DRAWABLE_DESTROYED (window))
{
if (add_filter)
{

View File

@ -27,27 +27,145 @@
#include <X11/Xlib.h>
#include <X11/Xos.h>
#include "gdkx.h"
#include "gdkdrawable.h"
#include "gdkprivate.h"
#include "gdkwindow.h"
/* Manipulation of drawables
*/
void
gdk_drawable_set_data (GdkDrawable *drawable,
const gchar *key,
gpointer data,
GDestroyNotify destroy_func)
{
g_dataset_set_data_full (drawable, key, data, destroy_func);
}
void
gdk_drawable_get_data (GdkDrawable *drawable,
const gchar *key)
{
g_dataset_get_data (drawable, key);
}
GdkDrawableType
gdk_drawable_get_type (GdkDrawable *drawable)
{
g_return_val_if_fail (drawable != NULL, (GdkDrawableType) -1);
return GDK_DRAWABLE_TYPE (drawable);
}
void
gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
gint *height)
{
GdkDrawablePrivate *drawable_private;
g_return_if_fail (drawable != NULL);
drawable_private = (GdkDrawablePrivate*) drawable;
if (width)
*width = drawable_private->width;
if (height)
*height = drawable_private->height;
}
void
gdk_drawable_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap)
{
GdkDrawablePrivate *drawable_private;
GdkColormapPrivate *colormap_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail (colormap != NULL);
drawable_private = (GdkDrawablePrivate*) drawable;
colormap_private = (GdkColormapPrivate*) colormap;
if (!GDK_DRAWABLE_DESTROYED (drawable))
{
if (GDK_IS_WINDOW (drawable))
{
g_return_if_fail (colormap_private->visual !=
((GdkColormapPrivate *)(drawable_private->colormap))->visual);
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);
}
}
GdkColormap*
gdk_drawable_get_colormap (GdkDrawable *drawable)
{
GdkDrawablePrivate *drawable_private;
XWindowAttributes window_attributes;
g_return_val_if_fail (drawable != NULL, NULL);
drawable_private = (GdkDrawablePrivate*) drawable;
if (!GDK_DRAWABLE_DESTROYED (drawable))
{
if (drawable_private->colormap == NULL &&
GDK_IS_WINDOW (drawable))
{
XGetWindowAttributes (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (drawable),
&window_attributes);
drawable_private->colormap = gdk_colormap_lookup (window_attributes.colormap);
}
return drawable_private->colormap;
}
return NULL;
}
GdkVisual*
gdk_drawable_get_visual (GdkDrawable *drawable)
{
GdkColormap *colormap;
g_return_val_if_fail (drawable != NULL, NULL);
colormap = gdk_drawable_get_colormap (drawable);
return colormap ? gdk_colormap_get_visual (colormap) : NULL;
}
/* Drawing
*/
void
gdk_draw_point (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y)
{
GdkWindowPrivate *drawable_private;
GdkGCPrivate *gc_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
XDrawPoint (drawable_private->xdisplay, drawable_private->xwindow,
XDrawPoint (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y);
}
@ -59,18 +177,16 @@ gdk_draw_line (GdkDrawable *drawable,
gint x2,
gint y2)
{
GdkWindowPrivate *drawable_private;
GdkGCPrivate *gc_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
XDrawLine (drawable_private->xdisplay, drawable_private->xwindow,
XDrawLine (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x1, y1, x2, y2);
}
@ -83,14 +199,14 @@ gdk_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
GdkWindowPrivate *drawable_private;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
drawable_private = (GdkDrawablePrivate*) drawable;
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
@ -100,10 +216,10 @@ gdk_draw_rectangle (GdkDrawable *drawable,
height = drawable_private->height;
if (filled)
XFillRectangle (drawable_private->xdisplay, drawable_private->xwindow,
XFillRectangle (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, width, height);
else
XDrawRectangle (drawable_private->xdisplay, drawable_private->xwindow,
XDrawRectangle (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, width, height);
}
@ -118,14 +234,14 @@ gdk_draw_arc (GdkDrawable *drawable,
gint angle1,
gint angle2)
{
GdkWindowPrivate *drawable_private;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
drawable_private = (GdkDrawablePrivate*) drawable;
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
@ -135,10 +251,10 @@ gdk_draw_arc (GdkDrawable *drawable,
height = drawable_private->height;
if (filled)
XFillArc (drawable_private->xdisplay, drawable_private->xwindow,
XFillArc (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, width, height, angle1, angle2);
else
XDrawArc (drawable_private->xdisplay, drawable_private->xwindow,
XDrawArc (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, width, height, angle1, angle2);
}
@ -149,7 +265,6 @@ gdk_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkWindowPrivate *drawable_private;
GdkGCPrivate *gc_private;
GdkPoint *local_points = points;
gint local_npoints = npoints;
@ -158,14 +273,13 @@ gdk_draw_polygon (GdkDrawable *drawable,
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
if (filled)
{
XFillPolygon (drawable_private->xdisplay, drawable_private->xwindow,
XFillPolygon (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, (XPoint*) points, npoints, Complex, CoordModeOrigin);
}
else
@ -181,7 +295,7 @@ gdk_draw_polygon (GdkDrawable *drawable,
local_points[npoints].y = points[0].y;
}
XDrawLines (drawable_private->xdisplay, drawable_private->xwindow,
XDrawLines (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc,
(XPoint*) local_points, local_npoints,
CoordModeOrigin);
@ -205,7 +319,6 @@ gdk_draw_string (GdkDrawable *drawable,
gint y,
const gchar *string)
{
GdkWindowPrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
@ -214,8 +327,7 @@ gdk_draw_string (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
g_return_if_fail (string != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
@ -223,15 +335,15 @@ gdk_draw_string (GdkDrawable *drawable,
if (font->type == GDK_FONT_FONT)
{
XFontStruct *xfont = (XFontStruct *) font_private->xfont;
XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
XSetFont(GDK_DRAWABLE_XDISPLAY (drawable), gc_private->xgc, xfont->fid);
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
{
XDrawString (drawable_private->xdisplay, drawable_private->xwindow,
XDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, string, strlen (string));
}
else
{
XDrawString16 (drawable_private->xdisplay, drawable_private->xwindow,
XDrawString16 (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, (XChar2b *) string,
strlen (string) / 2);
}
@ -239,7 +351,7 @@ gdk_draw_string (GdkDrawable *drawable,
else if (font->type == GDK_FONT_FONTSET)
{
XFontSet fontset = (XFontSet) font_private->xfont;
XmbDrawString (drawable_private->xdisplay, drawable_private->xwindow,
XmbDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
fontset, gc_private->xgc, x, y, string, strlen (string));
}
else
@ -261,7 +373,6 @@ gdk_draw_text (GdkDrawable *drawable,
const gchar *text,
gint text_length)
{
GdkWindowPrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
@ -270,8 +381,7 @@ gdk_draw_text (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
g_return_if_fail (text != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
@ -279,22 +389,22 @@ gdk_draw_text (GdkDrawable *drawable,
if (font->type == GDK_FONT_FONT)
{
XFontStruct *xfont = (XFontStruct *) font_private->xfont;
XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
XSetFont(GDK_DRAWABLE_XDISPLAY (drawable), gc_private->xgc, xfont->fid);
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
{
XDrawString (drawable_private->xdisplay, drawable_private->xwindow,
XDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, text, text_length);
}
else
{
XDrawString16 (drawable_private->xdisplay, drawable_private->xwindow,
XDrawString16 (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, (XChar2b *) text, text_length / 2);
}
}
else if (font->type == GDK_FONT_FONTSET)
{
XFontSet fontset = (XFontSet) font_private->xfont;
XmbDrawString (drawable_private->xdisplay, drawable_private->xwindow,
XmbDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
fontset, gc_private->xgc, x, y, text, text_length);
}
else
@ -310,7 +420,6 @@ gdk_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text,
gint text_length)
{
GdkWindowPrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
@ -319,8 +428,7 @@ gdk_draw_text_wc (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
g_return_if_fail (text != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
@ -330,10 +438,10 @@ gdk_draw_text_wc (GdkDrawable *drawable,
XFontStruct *xfont = (XFontStruct *) font_private->xfont;
gchar *text_8bit;
gint i;
XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
XSetFont(GDK_DRAWABLE_XDISPLAY (drawable), gc_private->xgc, xfont->fid);
text_8bit = g_new (gchar, text_length);
for (i=0; i<text_length; i++) text_8bit[i] = text[i];
XDrawString (drawable_private->xdisplay, drawable_private->xwindow,
XDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, x, y, text_8bit, text_length);
g_free (text_8bit);
}
@ -341,7 +449,7 @@ gdk_draw_text_wc (GdkDrawable *drawable,
{
if (sizeof(GdkWChar) == sizeof(wchar_t))
{
XwcDrawString (drawable_private->xdisplay, drawable_private->xwindow,
XwcDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
(XFontSet) font_private->xfont,
gc_private->xgc, x, y, (wchar_t *)text, text_length);
}
@ -351,7 +459,7 @@ gdk_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 (drawable_private->xdisplay, drawable_private->xwindow,
XwcDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
(XFontSet) font_private->xfont,
gc_private->xgc, x, y, text_wchar, text_length);
g_free (text_wchar);
@ -372,28 +480,24 @@ gdk_draw_pixmap (GdkDrawable *drawable,
gint width,
gint height)
{
GdkWindowPrivate *drawable_private;
GdkWindowPrivate *src_private;
GdkGCPrivate *gc_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail (src != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
src_private = (GdkWindowPrivate*) src;
if (drawable_private->destroyed || src_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable) || GDK_DRAWABLE_DESTROYED (src))
return;
gc_private = (GdkGCPrivate*) gc;
if (width == -1)
width = src_private->width;
width = ((GdkDrawablePrivate *)src)->width;
if (height == -1)
height = src_private->height;
height = ((GdkDrawablePrivate *)src)->height;
XCopyArea (drawable_private->xdisplay,
src_private->xwindow,
drawable_private->xwindow,
XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (src),
GDK_DRAWABLE_XID (drawable),
gc_private->xgc,
xsrc, ysrc,
width, height,
@ -436,20 +540,18 @@ gdk_draw_points (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkWindowPrivate *drawable_private;
GdkGCPrivate *gc_private;
g_return_if_fail (drawable != NULL);
g_return_if_fail ((points != NULL) && (npoints > 0));
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
XDrawPoints (drawable_private->xdisplay,
drawable_private->xwindow,
XDrawPoints (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (drawable),
gc_private->xgc,
(XPoint *) points,
npoints,
@ -462,7 +564,6 @@ gdk_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
GdkWindowPrivate *drawable_private;
GdkGCPrivate *gc_private;
if (nsegs <= 0)
@ -472,13 +573,12 @@ gdk_draw_segments (GdkDrawable *drawable,
g_return_if_fail (segs != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
XDrawSegments (drawable_private->xdisplay,
drawable_private->xwindow,
XDrawSegments (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (drawable),
gc_private->xgc,
(XSegment *) segs,
nsegs);
@ -490,7 +590,6 @@ gdk_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkWindowPrivate *drawable_private;
GdkGCPrivate *gc_private;
if (npoints <= 0)
@ -500,13 +599,12 @@ gdk_draw_lines (GdkDrawable *drawable,
g_return_if_fail (points != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
gc_private = (GdkGCPrivate*) gc;
XDrawLines (drawable_private->xdisplay,
drawable_private->xwindow,
XDrawLines (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (drawable),
gc_private->xgc,
(XPoint *) points,
npoints,

View File

@ -34,15 +34,34 @@ typedef enum
GDK_WINDOW_CHILD,
GDK_WINDOW_DIALOG,
GDK_WINDOW_TEMP,
GDK_WINDOW_PIXMAP,
GDK_DRAWABLE_PIXMAP,
GDK_WINDOW_FOREIGN
} GdkWindowType;
} GdkDrawableType;
struct _GdkWindow
struct _GdkDrawable
{
gpointer user_data;
};
/* Manipulation of drawables
*/
GdkDrawableType gdk_drawable_get_type (GdkDrawable *window);
void gdk_drawable_set_data (GdkDrawable *drawable,
const gchar *key,
gpointer data,
GDestroyNotify destroy_func);
void gdk_drawable_get_data (GdkDrawable *drawable,
const gchar *key);
void gdk_drawable_get_size (GdkWindow *drawable,
gint *width,
gint *height);
void gdk_drawable_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap);
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
/* Drawing
*/
void gdk_draw_point (GdkDrawable *drawable,

View File

@ -286,11 +286,7 @@ graphics_expose_predicate (Display *display,
XEvent *xevent,
XPointer arg)
{
GdkWindowPrivate *private = (GdkWindowPrivate*) arg;
g_return_val_if_fail (private != NULL, False);
if (xevent->xany.window == private->xwindow &&
if (xevent->xany.window == GDK_DRAWABLE_XID (arg) &&
(xevent->xany.type == GraphicsExpose ||
xevent->xany.type == NoExpose))
return True;
@ -1009,6 +1005,8 @@ gdk_event_translate (GdkEvent *event,
}
window = gdk_window_lookup (xevent->xany.window);
/* FIXME: window might be a GdkPixmap!!! */
window_private = (GdkWindowPrivate *) window;
if (window != NULL)
@ -1017,7 +1015,7 @@ gdk_event_translate (GdkEvent *event,
event->any.window = window;
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
if (window_private && window_private->destroyed)
if (window_private && GDK_DRAWABLE_DESTROYED (window))
{
if (xevent->type != DestroyNotify)
return FALSE;
@ -1040,7 +1038,7 @@ gdk_event_translate (GdkEvent *event,
#ifdef USE_XIM
if (window == NULL && gdk_xim_window && xevent->type == KeyPress &&
!((GdkWindowPrivate *) gdk_xim_window)->destroyed)
!GDK_DRAWABLE_DESTROYED (gdk_xim_window))
{
/*
* If user presses a key in Preedit or Status window, keypress event
@ -1340,7 +1338,7 @@ gdk_event_translate (GdkEvent *event,
/* Tell XInput stuff about it if appropriate */
if (window_private &&
!window_private->destroyed &&
!GDK_DRAWABLE_DESTROYED (window) &&
(window_private->extension_events != 0) &&
gdk_input_vtable.enter_event)
gdk_input_vtable.enter_event (&xevent->xcrossing, window);
@ -1635,9 +1633,9 @@ gdk_event_translate (GdkEvent *event,
event->any.type = GDK_DESTROY;
event->any.window = window;
return_val = window_private && !window_private->destroyed;
return_val = window_private && !GDK_DRAWABLE_DESTROYED (window);
if (window && window_private->xwindow != GDK_ROOT_WINDOW())
if (window && GDK_DRAWABLE_XID (window) != GDK_ROOT_WINDOW())
gdk_window_destroy_notify (window);
break;
@ -1698,16 +1696,16 @@ gdk_event_translate (GdkEvent *event,
xevent->xconfigure.override_redirect,
!window
? " (discarding)"
: window_private->window_type == GDK_WINDOW_CHILD
: GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD
? " (discarding child)"
: ""));
if (window &&
!window_private->destroyed &&
!GDK_DRAWABLE_DESTROYED (window) &&
(window_private->extension_events != 0) &&
gdk_input_vtable.configure_event)
gdk_input_vtable.configure_event (&xevent->xconfigure, window);
if (!window || window_private->window_type == GDK_WINDOW_CHILD)
if (!window || GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD)
return_val = FALSE;
else
{
@ -1718,15 +1716,15 @@ gdk_event_translate (GdkEvent *event,
if (!xevent->xconfigure.x &&
!xevent->xconfigure.y &&
!window_private->destroyed)
!GDK_DRAWABLE_DESTROYED (window))
{
gint tx = 0;
gint ty = 0;
Window child_window = 0;
gdk_error_trap_push ();
if (XTranslateCoordinates (window_private->xdisplay,
window_private->xwindow,
if (XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
gdk_root_window,
0, 0,
&tx, &ty,
@ -1748,8 +1746,8 @@ gdk_event_translate (GdkEvent *event,
}
window_private->x = event->configure.x;
window_private->y = event->configure.y;
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
window_private->drawable.width = xevent->xconfigure.width;
window_private->drawable.height = xevent->xconfigure.height;
if (window_private->resize_count > 1)
window_private->resize_count -= 1;
}
@ -1891,7 +1889,7 @@ gdk_event_translate (GdkEvent *event,
/* something else - (e.g., a Xinput event) */
if (window_private &&
!window_private->destroyed &&
!window_private->drawable.destroyed &&
(window_private->extension_events != 0) &&
gdk_input_vtable.other_event)
return_val = gdk_input_vtable.other_event(event, xevent, window);

View File

@ -29,7 +29,7 @@
#include "gdkgc.h"
#include "gdkprivate.h"
#include "gdkx.h"
GdkGC*
gdk_gc_new (GdkWindow *window)
@ -42,7 +42,6 @@ gdk_gc_new_with_values (GdkWindow *window,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkWindowPrivate *window_private;
GdkGC *gc;
GdkGCPrivate *private;
Window xwindow;
@ -51,15 +50,14 @@ gdk_gc_new_with_values (GdkWindow *window,
g_return_val_if_fail (window != NULL, NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
private = g_new (GdkGCPrivate, 1);
gc = (GdkGC*) private;
xwindow = window_private->xwindow;
private->xdisplay = window_private->xdisplay;
xwindow = GDK_DRAWABLE_XID (window);
private->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
private->ref_count = 1;
xvalues.function = GXcopy;
@ -157,17 +155,17 @@ gdk_gc_new_with_values (GdkWindow *window,
}
if (values_mask & GDK_GC_TILE)
{
xvalues.tile = ((GdkPixmapPrivate*) values->tile)->xwindow;
xvalues.tile = GDK_DRAWABLE_XID (values->tile);
xvalues_mask |= GCTile;
}
if (values_mask & GDK_GC_STIPPLE)
{
xvalues.stipple = ((GdkPixmapPrivate*) values->stipple)->xwindow;
xvalues.stipple = GDK_DRAWABLE_XID (values->stipple);
xvalues_mask |= GCStipple;
}
if (values_mask & GDK_GC_CLIP_MASK)
{
xvalues.clip_mask = ((GdkPixmapPrivate*) values->clip_mask)->xwindow;
xvalues.clip_mask = GDK_DRAWABLE_XID (values->clip_mask);
xvalues_mask |= GCClipMask;
}
if (values_mask & GDK_GC_SUBWINDOW)
@ -586,7 +584,6 @@ gdk_gc_set_tile (GdkGC *gc,
GdkPixmap *tile)
{
GdkGCPrivate *private;
GdkPixmapPrivate *pixmap_private;
Pixmap pixmap;
g_return_if_fail (gc != NULL);
@ -595,10 +592,7 @@ gdk_gc_set_tile (GdkGC *gc,
pixmap = None;
if (tile)
{
pixmap_private = (GdkPixmapPrivate*) tile;
pixmap = pixmap_private->xwindow;
}
pixmap = GDK_DRAWABLE_XID (tile);
XSetTile (private->xdisplay, private->xgc, pixmap);
}
@ -608,7 +602,6 @@ gdk_gc_set_stipple (GdkGC *gc,
GdkPixmap *stipple)
{
GdkGCPrivate *private;
GdkPixmapPrivate *pixmap_private;
Pixmap pixmap;
g_return_if_fail (gc != NULL);
@ -617,10 +610,7 @@ gdk_gc_set_stipple (GdkGC *gc,
pixmap = None;
if (stipple)
{
pixmap_private = (GdkPixmapPrivate*) stipple;
pixmap = pixmap_private->xwindow;
}
pixmap = GDK_DRAWABLE_XID (stipple);
XSetStipple (private->xdisplay, private->xgc, pixmap);
}
@ -663,14 +653,7 @@ gdk_gc_set_clip_mask (GdkGC *gc,
g_return_if_fail (gc != NULL);
if (mask)
{
GdkWindowPrivate *mask_private;
mask_private = (GdkWindowPrivate*) mask;
if (mask_private->destroyed)
return;
xmask = mask_private->xwindow;
}
xmask = GDK_DRAWABLE_XID (mask);
else
xmask = None;

View File

@ -625,7 +625,7 @@ gdk_ic_new (GdkICAttr *attr, GdkICAttributesType mask)
}
if (attr->client_window == NULL ||
((GdkWindowPrivate *)attr->client_window)->destroyed)
GDK_DRAWABLE_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 &&
((GdkPixmapPrivate *)attr->preedit_pixmap)->destroyed)
GDK_DRAWABLE_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 &&
((GdkPixmapPrivate *)attr->status_pixmap)->destroyed)
GDK_DRAWABLE_DESTROYED (attr->status_pixmap))
{
g_warning ("Preedit pixmap is already destroyed.\n");
error |= GDK_IC_STATUS_PIXMAP;

View File

@ -56,6 +56,7 @@
#include "gdk.h" /* For gdk_error_trap_* / gdk_flush_* */
#include "gdkimage.h"
#include "gdkprivate.h"
#include "gdkx.h"
static void gdk_image_put_normal (GdkDrawable *drawable,
@ -331,12 +332,10 @@ gdk_image_get (GdkWindow *window,
{
GdkImage *image;
GdkImagePrivate *private;
GdkWindowPrivate *win_private;
g_return_val_if_fail (window != NULL, NULL);
win_private = (GdkWindowPrivate *) window;
if (win_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
private = g_new (GdkImagePrivate, 1);
@ -345,7 +344,7 @@ gdk_image_get (GdkWindow *window,
private->xdisplay = gdk_display;
private->image_put = gdk_image_put_normal;
private->ximage = XGetImage (private->xdisplay,
win_private->xwindow,
GDK_DRAWABLE_XID (window),
x, y, width, height,
AllPlanes, ZPixmap);
@ -455,7 +454,6 @@ gdk_image_put_normal (GdkDrawable *drawable,
gint width,
gint height)
{
GdkWindowPrivate *drawable_private;
GdkImagePrivate *image_private;
GdkGCPrivate *gc_private;
@ -463,15 +461,14 @@ gdk_image_put_normal (GdkDrawable *drawable,
g_return_if_fail (image != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
image_private = (GdkImagePrivate*) image;
gc_private = (GdkGCPrivate*) gc;
g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
XPutImage (drawable_private->xdisplay, drawable_private->xwindow,
XPutImage (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, image_private->ximage,
xsrc, ysrc, xdest, ydest, width, height);
}
@ -488,7 +485,6 @@ gdk_image_put_shared (GdkDrawable *drawable,
gint height)
{
#ifdef USE_SHM
GdkWindowPrivate *drawable_private;
GdkImagePrivate *image_private;
GdkGCPrivate *gc_private;
@ -496,15 +492,14 @@ gdk_image_put_shared (GdkDrawable *drawable,
g_return_if_fail (image != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
image_private = (GdkImagePrivate*) image;
gc_private = (GdkGCPrivate*) gc;
g_return_if_fail (image->type == GDK_IMAGE_SHARED);
XShmPutImage (drawable_private->xdisplay, drawable_private->xwindow,
XShmPutImage (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, image_private->ximage,
xsrc, ysrc, xdest, ydest, width, height, False);
#else /* USE_SHM */

View File

@ -127,20 +127,20 @@ gdk_input_motion_events (GdkWindow *window,
guint32 stop,
gint *nevents_return)
{
GdkWindowPrivate *window_private;
XTimeCoord *xcoords;
GdkTimeCoord *coords;
int i;
g_return_val_if_fail (window != NULL, NULL);
window_private = (GdkWindowPrivate *) window;
if (window_private->destroyed)
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (deviceid == GDK_CORE_POINTER)
{
xcoords = XGetMotionEvents (gdk_display,
window_private->xwindow,
xcoords = XGetMotionEvents (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
start, stop, nevents_return);
if (xcoords)
{
@ -224,8 +224,10 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
GdkInputWindow *iw;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return;
if (mode == GDK_EXTENSION_EVENTS_NONE)

View File

@ -472,14 +472,14 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
gdouble *x, gdouble *y, gdouble *pressure,
gdouble *xtilt, gdouble *ytilt)
{
GdkWindowPrivate *win_priv;
GdkDrawablePrivate *drawable_priv;
int x_axis, y_axis, pressure_axis, xtilt_axis, ytilt_axis;
double device_width, device_height;
double x_offset, y_offset, x_scale, y_scale;
win_priv = (GdkWindowPrivate *) input_window->window;
drawable_priv = (GdkDrawablePrivate *) input_window->window;
x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
@ -505,26 +505,26 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
(device_width*gdkdev->axes[x_axis].resolution);
if (device_aspect * win_priv->width >= win_priv->height)
if (device_aspect * drawable_priv->width >= drawable_priv->height)
{
/* device taller than window */
x_scale = win_priv->width / device_width;
x_scale = drawable_priv->width / device_width;
y_scale = (x_scale * gdkdev->axes[x_axis].resolution)
/ gdkdev->axes[y_axis].resolution;
x_offset = 0;
y_offset = -(device_height * y_scale -
win_priv->height)/2;
drawable_priv->height)/2;
}
else
{
/* window taller than device */
y_scale = win_priv->height / device_height;
y_scale = drawable_priv->height / device_height;
x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
/ gdkdev->axes[x_axis].resolution;
y_offset = 0;
x_offset = - (device_width * x_scale - win_priv->width)/2;
x_offset = - (device_width * x_scale - drawable_priv->width)/2;
}
}

View File

@ -34,6 +34,7 @@
#include "gdkpixmap.h"
#include "gdkprivate.h"
#include "gdkx.h"
typedef struct
{
@ -56,36 +57,32 @@ gdk_pixmap_new (GdkWindow *window,
gint depth)
{
GdkPixmap *pixmap;
GdkWindowPrivate *private;
GdkWindowPrivate *window_private;
GdkDrawablePrivate *private;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (depth == -1)
depth = gdk_window_get_visual (window)->depth;
depth = gdk_drawable_get_visual (window)->depth;
private = g_new0 (GdkWindowPrivate, 1);
private = g_new0 (GdkDrawablePrivate, 1);
pixmap = (GdkPixmap*) private;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->xwindow = XCreatePixmap (private->xdisplay, window_private->xwindow,
private->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
private->window_type = GDK_DRAWABLE_PIXMAP;
private->xwindow = XCreatePixmap (private->xdisplay,
GDK_DRAWABLE_XID (window),
width, height, depth);
private->colormap = NULL;
private->parent = NULL;
private->x = 0;
private->y = 0;
private->width = width;
private->height = height;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = 0;
@ -101,35 +98,30 @@ gdk_bitmap_create_from_data (GdkWindow *window,
gint height)
{
GdkPixmap *pixmap;
GdkWindowPrivate *private;
GdkWindowPrivate *window_private;
GdkDrawablePrivate *private;
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
private = g_new0 (GdkWindowPrivate, 1);
private = g_new0 (GdkDrawablePrivate, 1);
pixmap = (GdkPixmap*) private;
private->parent = NULL;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->x = 0;
private->y = 0;
private->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
private->window_type = GDK_DRAWABLE_PIXMAP;
private->width = width;
private->height = height;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = FALSE;
private->xwindow = XCreateBitmapFromData (private->xdisplay,
window_private->xwindow,
GDK_DRAWABLE_XID (window),
(char *)data, width, height);
gdk_xid_table_insert (&private->xwindow, pixmap);
@ -147,9 +139,9 @@ gdk_pixmap_create_from_data (GdkWindow *window,
GdkColor *bg)
{
GdkPixmap *pixmap;
GdkWindowPrivate *private;
GdkWindowPrivate *window_private;
GdkDrawablePrivate *private;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL);
@ -159,29 +151,24 @@ gdk_pixmap_create_from_data (GdkWindow *window,
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (depth == -1)
depth = gdk_window_get_visual (window)->depth;
depth = gdk_drawable_get_visual (window)->depth;
private = g_new0 (GdkWindowPrivate, 1);
private = g_new0 (GdkDrawablePrivate, 1);
pixmap = (GdkPixmap*) private;
private->parent = NULL;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->x = 0;
private->y = 0;
private->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
private->window_type = GDK_DRAWABLE_PIXMAP;
private->width = width;
private->height = height;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = FALSE;
private->xwindow = XCreatePixmapFromBitmapData (private->xdisplay,
window_private->xwindow,
GDK_DRAWABLE_XID (window),
(char *)data, width, height,
fg->pixel, bg->pixel, depth);
@ -460,8 +447,8 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
if (colormap == NULL)
{
colormap = gdk_window_get_colormap (window);
visual = gdk_window_get_visual (window);
colormap = gdk_drawable_get_colormap (window);
visual = gdk_drawable_get_visual (window);
}
else
visual = ((GdkColormapPrivate *)colormap)->visual;
@ -760,8 +747,7 @@ GdkPixmap*
gdk_pixmap_foreign_new (guint32 anid)
{
GdkPixmap *pixmap;
GdkWindowPrivate *window_private;
GdkWindowPrivate *private;
GdkDrawablePrivate *private;
Pixmap xpixmap;
Window root_return;
unsigned int x_ret, y_ret, w_ret, h_ret, bw_ret, depth_ret;
@ -772,29 +758,24 @@ gdk_pixmap_foreign_new (guint32 anid)
/* set the pixmap to the passed in value */
xpixmap = anid;
/* get the root window */
window_private = &gdk_root_parent;
/* get information about the Pixmap to fill in the structure for
the gdk window */
if (!XGetGeometry(window_private->xdisplay, xpixmap, &root_return,
if (!XGetGeometry(GDK_DISPLAY(),
xpixmap, &root_return,
&x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
return NULL;
/* allocate a new gdk pixmap */
private = g_new(GdkWindowPrivate, 1);
private = g_new(GdkDrawablePrivate, 1);
pixmap = (GdkPixmap *)private;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->xdisplay = GDK_DISPLAY();
private->window_type = GDK_DRAWABLE_PIXMAP;
private->xwindow = xpixmap;
private->colormap = NULL;
private->parent = NULL;
private->x = 0;
private->y = 0;
private->width = w_ret;
private->height = h_ret;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = 0;
@ -806,8 +787,9 @@ gdk_pixmap_foreign_new (guint32 anid)
GdkPixmap*
gdk_pixmap_ref (GdkPixmap *pixmap)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
GdkDrawablePrivate *private = (GdkDrawablePrivate *)pixmap;
g_return_val_if_fail (pixmap != NULL, NULL);
g_return_val_if_fail (GDK_IS_PIXMAP (private), NULL);
private->ref_count += 1;
return pixmap;
@ -816,8 +798,9 @@ gdk_pixmap_ref (GdkPixmap *pixmap)
void
gdk_pixmap_unref (GdkPixmap *pixmap)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
GdkDrawablePrivate *private = (GdkDrawablePrivate *)pixmap;
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GDK_IS_PIXMAP (private));
g_return_if_fail (private->ref_count > 0);
private->ref_count -= 1;

View File

@ -43,18 +43,23 @@
#include <gdk/gdkvisual.h>
#include <gdk/gdkwindow.h>
#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))
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#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_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 _GdkDrawablePrivate GdkPixmapPrivate; */
typedef struct _GdkWindowPrivate GdkWindowPrivate;
typedef struct _GdkWindowPrivate GdkPixmapPrivate;
typedef struct _GdkImagePrivate GdkImagePrivate;
typedef struct _GdkGCPrivate GdkGCPrivate;
typedef struct _GdkColormapPrivate GdkColormapPrivate;
@ -66,21 +71,32 @@ typedef struct _GdkEventFilter GdkEventFilter;
typedef struct _GdkClientFilter GdkClientFilter;
typedef struct _GdkRegionPrivate GdkRegionPrivate;
struct _GdkDrawablePrivate
{
GdkDrawable drawable;
guint8 window_type;
guint ref_count;
guint16 width;
guint16 height;
Window xwindow;
Display *xdisplay;
GdkColormap *colormap;
guint destroyed : 2;
};
struct _GdkWindowPrivate
{
GdkDrawablePrivate drawable;
GdkWindow window;
GdkWindow *parent;
Window xwindow;
Display *xdisplay;
gint16 x;
gint16 y;
guint16 width;
guint16 height;
guint8 resize_count;
guint8 window_type;
guint ref_count;
guint destroyed : 2;
guint mapped : 1;
guint guffaw_gravity : 1;

View File

@ -28,6 +28,7 @@
#include <X11/Xatom.h>
#include <string.h>
#include "gdkx.h"
#include "gdkproperty.h"
#include "gdkprivate.h"
@ -111,14 +112,11 @@ gdk_property_get (GdkWindow *window,
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return FALSE;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_WINDOW_XDISPLAY (window);
xwindow = GDK_WINDOW_XWINDOW (window);
}
else
{
@ -200,14 +198,11 @@ gdk_property_change (GdkWindow *window,
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_WINDOW_XDISPLAY (window);
xwindow = GDK_WINDOW_XWINDOW (window);
}
else
{
@ -228,14 +223,11 @@ gdk_property_delete (GdkWindow *window,
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_WINDOW_XDISPLAY (window);
xwindow = GDK_WINDOW_XWINDOW (window);
}
else
{

View File

@ -45,14 +45,11 @@ gdk_selection_owner_set (GdkWindow *owner,
if (owner)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) owner;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (owner))
return FALSE;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_DRAWABLE_XDISPLAY (owner);
xwindow = GDK_DRAWABLE_XID (owner);
}
else
{
@ -83,16 +80,11 @@ gdk_selection_convert (GdkWindow *requestor,
GdkAtom target,
guint32 time)
{
GdkWindowPrivate *private;
g_return_if_fail (requestor != NULL);
private = (GdkWindowPrivate*) requestor;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (requestor))
return;
XConvertSelection (private->xdisplay, selection, target,
gdk_selection_property, private->xwindow, time);
XConvertSelection (GDK_DRAWABLE_XDISPLAY (requestor), selection, target,
gdk_selection_property, GDK_DRAWABLE_XID (requestor), time);
}
gint
@ -101,7 +93,6 @@ gdk_selection_property_get (GdkWindow *requestor,
GdkAtom *ret_type,
gint *ret_format)
{
GdkWindowPrivate *private;
gulong nitems;
gulong nbytes;
gulong length;
@ -110,17 +101,18 @@ gdk_selection_property_get (GdkWindow *requestor,
guchar *t = NULL;
g_return_val_if_fail (requestor != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
/* If retrieved chunks are typically small, (and the ICCCM says the
should be) it would be a win to try first with a buffer of
moderate length, to avoid two round trips to the server */
private = (GdkWindowPrivate*) requestor;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (requestor))
return 0;
t = NULL;
XGetWindowProperty (private->xdisplay, private->xwindow,
XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (requestor),
GDK_DRAWABLE_XID (requestor),
gdk_selection_property, 0, 0, False,
AnyPropertyType, &prop_type, &prop_format,
&nitems, &nbytes, &t);
@ -150,7 +142,8 @@ gdk_selection_property_get (GdkWindow *requestor,
protocol, in which case the client has to make sure they'll be
notified of PropertyChange events _before_ the property is deleted.
Otherwise there's no guarantee we'll win the race ... */
XGetWindowProperty (private->xdisplay, private->xwindow,
XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (requestor),
GDK_DRAWABLE_XID (requestor),
gdk_selection_property, 0, (nbytes + 3) / 4, False,
AnyPropertyType, &prop_type, &prop_format,
&nitems, &nbytes, &t);

View File

@ -82,10 +82,10 @@ typedef struct _GdkImage GdkImage;
typedef struct _GdkRegion GdkRegion;
typedef struct _GdkVisual GdkVisual;
typedef struct _GdkWindow GdkBitmap;
typedef struct _GdkWindow GdkDrawable;
typedef struct _GdkWindow GdkPixmap;
typedef struct _GdkWindow GdkWindow;
typedef struct _GdkDrawable GdkDrawable;
typedef struct _GdkDrawable GdkBitmap;
typedef struct _GdkDrawable GdkPixmap;
typedef struct _GdkDrawable GdkWindow;
typedef enum
{

File diff suppressed because it is too large Load Diff

View File

@ -95,7 +95,7 @@ struct _GdkWindowAttr
GdkWindowClass wclass;
GdkVisual *visual;
GdkColormap *colormap;
GdkWindowType window_type;
GdkDrawableType window_type;
GdkCursor *cursor;
gchar *wmclass_name;
gchar *wmclass_class;
@ -157,15 +157,6 @@ void gdk_window_clear_area_e(GdkWindow *window,
gint y,
gint width,
gint height);
void gdk_window_copy_area (GdkWindow *window,
GdkGC *gc,
gint x,
gint y,
GdkWindow *source_window,
gint source_x,
gint source_y,
gint width,
gint height);
void gdk_window_raise (GdkWindow *window);
void gdk_window_lower (GdkWindow *window);
@ -253,8 +244,6 @@ void gdk_window_set_back_pixmap (GdkWindow *window,
gint parent_relative);
void gdk_window_set_cursor (GdkWindow *window,
GdkCursor *cursor);
void gdk_window_set_colormap (GdkWindow *window,
GdkColormap *colormap);
void gdk_window_get_user_data (GdkWindow *window,
gpointer *data);
void gdk_window_get_geometry (GdkWindow *window,
@ -269,9 +258,6 @@ void gdk_window_get_position (GdkWindow *window,
void gdk_window_get_size (GdkWindow *window,
gint *width,
gint *height);
GdkVisual* gdk_window_get_visual (GdkWindow *window);
GdkColormap* gdk_window_get_colormap (GdkWindow *window);
GdkWindowType gdk_window_get_type (GdkWindow *window);
gint gdk_window_get_origin (GdkWindow *window,
gint *x,
gint *y);
@ -308,11 +294,6 @@ GList * gdk_window_get_toplevels (void);
void gdk_window_register_dnd (GdkWindow *window);
void gdk_drawable_set_data (GdkDrawable *drawable,
const gchar *key,
gpointer data,
GDestroyNotify destroy_func);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -33,8 +33,10 @@
#define GDK_ROOT_WINDOW() gdk_root_window
#define GDK_ROOT_PARENT() ((GdkWindow *)&gdk_root_parent)
#define GDK_DISPLAY() gdk_display
#define GDK_WINDOW_XDISPLAY(win) (((GdkWindowPrivate*) win)->xdisplay)
#define GDK_WINDOW_XWINDOW(win) (((GdkWindowPrivate*) win)->xwindow)
#define GDK_DRAWABLE_XDISPLAY(win) (((GdkDrawablePrivate*) win)->xdisplay)
#define GDK_DRAWABLE_XID(win) (((GdkDrawablePrivate*) win)->xwindow)
#define GDK_WINDOW_XDISPLAY GDK_DRAWABLE_XDISPLAY
#define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
#define GDK_IMAGE_XDISPLAY(image) (((GdkImagePrivate*) image)->xdisplay)
#define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivate*) image)->ximage)
#define GDK_GC_XDISPLAY(gc) (((GdkGCPrivate*) gc)->xdisplay)

View File

@ -27,6 +27,7 @@
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include "gdkx.h"
#include "gdkcursor.h"
#include "gdkprivate.h"
@ -57,8 +58,8 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, GdkColor *fg, Gd
Cursor xcursor;
XColor xfg, xbg;
source_pixmap = ((GdkPixmapPrivate *) source)->xwindow;
mask_pixmap = ((GdkPixmapPrivate *) mask)->xwindow;
source_pixmap = GDK_DRAWABLE_XID (source);
mask_pixmap = GDK_DRAWABLE_XID (mask);
xfg.pixel = fg->pixel;
xfg.red = fg->red;

View File

@ -2416,9 +2416,8 @@ xdnd_manage_source_filter (GdkDragContext *context,
gboolean add_filter)
{
gint old_warnings = 0; /* quiet gcc */
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
gboolean is_foreign = (private->window_type == GDK_WINDOW_FOREIGN);
gboolean is_foreign = GDK_DRAWABLE_TYPE (window);
if (is_foreign)
{
@ -2426,7 +2425,7 @@ xdnd_manage_source_filter (GdkDragContext *context,
gdk_error_warnings = 0;
}
if (!private->destroyed)
if (!GDK_DRAWABLE_DESTROYED (window))
{
if (add_filter)
{

View File

@ -286,11 +286,7 @@ graphics_expose_predicate (Display *display,
XEvent *xevent,
XPointer arg)
{
GdkWindowPrivate *private = (GdkWindowPrivate*) arg;
g_return_val_if_fail (private != NULL, False);
if (xevent->xany.window == private->xwindow &&
if (xevent->xany.window == GDK_DRAWABLE_XID (arg) &&
(xevent->xany.type == GraphicsExpose ||
xevent->xany.type == NoExpose))
return True;
@ -1009,6 +1005,8 @@ gdk_event_translate (GdkEvent *event,
}
window = gdk_window_lookup (xevent->xany.window);
/* FIXME: window might be a GdkPixmap!!! */
window_private = (GdkWindowPrivate *) window;
if (window != NULL)
@ -1017,7 +1015,7 @@ gdk_event_translate (GdkEvent *event,
event->any.window = window;
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
if (window_private && window_private->destroyed)
if (window_private && GDK_DRAWABLE_DESTROYED (window))
{
if (xevent->type != DestroyNotify)
return FALSE;
@ -1040,7 +1038,7 @@ gdk_event_translate (GdkEvent *event,
#ifdef USE_XIM
if (window == NULL && gdk_xim_window && xevent->type == KeyPress &&
!((GdkWindowPrivate *) gdk_xim_window)->destroyed)
!GDK_DRAWABLE_DESTROYED (gdk_xim_window))
{
/*
* If user presses a key in Preedit or Status window, keypress event
@ -1340,7 +1338,7 @@ gdk_event_translate (GdkEvent *event,
/* Tell XInput stuff about it if appropriate */
if (window_private &&
!window_private->destroyed &&
!GDK_DRAWABLE_DESTROYED (window) &&
(window_private->extension_events != 0) &&
gdk_input_vtable.enter_event)
gdk_input_vtable.enter_event (&xevent->xcrossing, window);
@ -1635,9 +1633,9 @@ gdk_event_translate (GdkEvent *event,
event->any.type = GDK_DESTROY;
event->any.window = window;
return_val = window_private && !window_private->destroyed;
return_val = window_private && !GDK_DRAWABLE_DESTROYED (window);
if (window && window_private->xwindow != GDK_ROOT_WINDOW())
if (window && GDK_DRAWABLE_XID (window) != GDK_ROOT_WINDOW())
gdk_window_destroy_notify (window);
break;
@ -1698,16 +1696,16 @@ gdk_event_translate (GdkEvent *event,
xevent->xconfigure.override_redirect,
!window
? " (discarding)"
: window_private->window_type == GDK_WINDOW_CHILD
: GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD
? " (discarding child)"
: ""));
if (window &&
!window_private->destroyed &&
!GDK_DRAWABLE_DESTROYED (window) &&
(window_private->extension_events != 0) &&
gdk_input_vtable.configure_event)
gdk_input_vtable.configure_event (&xevent->xconfigure, window);
if (!window || window_private->window_type == GDK_WINDOW_CHILD)
if (!window || GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD)
return_val = FALSE;
else
{
@ -1718,15 +1716,15 @@ gdk_event_translate (GdkEvent *event,
if (!xevent->xconfigure.x &&
!xevent->xconfigure.y &&
!window_private->destroyed)
!GDK_DRAWABLE_DESTROYED (window))
{
gint tx = 0;
gint ty = 0;
Window child_window = 0;
gdk_error_trap_push ();
if (XTranslateCoordinates (window_private->xdisplay,
window_private->xwindow,
if (XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
gdk_root_window,
0, 0,
&tx, &ty,
@ -1748,8 +1746,8 @@ gdk_event_translate (GdkEvent *event,
}
window_private->x = event->configure.x;
window_private->y = event->configure.y;
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
window_private->drawable.width = xevent->xconfigure.width;
window_private->drawable.height = xevent->xconfigure.height;
if (window_private->resize_count > 1)
window_private->resize_count -= 1;
}
@ -1891,7 +1889,7 @@ gdk_event_translate (GdkEvent *event,
/* something else - (e.g., a Xinput event) */
if (window_private &&
!window_private->destroyed &&
!window_private->drawable.destroyed &&
(window_private->extension_events != 0) &&
gdk_input_vtable.other_event)
return_val = gdk_input_vtable.other_event(event, xevent, window);

View File

@ -625,7 +625,7 @@ gdk_ic_new (GdkICAttr *attr, GdkICAttributesType mask)
}
if (attr->client_window == NULL ||
((GdkWindowPrivate *)attr->client_window)->destroyed)
GDK_DRAWABLE_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 &&
((GdkPixmapPrivate *)attr->preedit_pixmap)->destroyed)
GDK_DRAWABLE_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 &&
((GdkPixmapPrivate *)attr->status_pixmap)->destroyed)
GDK_DRAWABLE_DESTROYED (attr->status_pixmap))
{
g_warning ("Preedit pixmap is already destroyed.\n");
error |= GDK_IC_STATUS_PIXMAP;

View File

@ -56,6 +56,7 @@
#include "gdk.h" /* For gdk_error_trap_* / gdk_flush_* */
#include "gdkimage.h"
#include "gdkprivate.h"
#include "gdkx.h"
static void gdk_image_put_normal (GdkDrawable *drawable,
@ -331,12 +332,10 @@ gdk_image_get (GdkWindow *window,
{
GdkImage *image;
GdkImagePrivate *private;
GdkWindowPrivate *win_private;
g_return_val_if_fail (window != NULL, NULL);
win_private = (GdkWindowPrivate *) window;
if (win_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
private = g_new (GdkImagePrivate, 1);
@ -345,7 +344,7 @@ gdk_image_get (GdkWindow *window,
private->xdisplay = gdk_display;
private->image_put = gdk_image_put_normal;
private->ximage = XGetImage (private->xdisplay,
win_private->xwindow,
GDK_DRAWABLE_XID (window),
x, y, width, height,
AllPlanes, ZPixmap);
@ -455,7 +454,6 @@ gdk_image_put_normal (GdkDrawable *drawable,
gint width,
gint height)
{
GdkWindowPrivate *drawable_private;
GdkImagePrivate *image_private;
GdkGCPrivate *gc_private;
@ -463,15 +461,14 @@ gdk_image_put_normal (GdkDrawable *drawable,
g_return_if_fail (image != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
image_private = (GdkImagePrivate*) image;
gc_private = (GdkGCPrivate*) gc;
g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
XPutImage (drawable_private->xdisplay, drawable_private->xwindow,
XPutImage (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, image_private->ximage,
xsrc, ysrc, xdest, ydest, width, height);
}
@ -488,7 +485,6 @@ gdk_image_put_shared (GdkDrawable *drawable,
gint height)
{
#ifdef USE_SHM
GdkWindowPrivate *drawable_private;
GdkImagePrivate *image_private;
GdkGCPrivate *gc_private;
@ -496,15 +492,14 @@ gdk_image_put_shared (GdkDrawable *drawable,
g_return_if_fail (image != NULL);
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (drawable))
return;
image_private = (GdkImagePrivate*) image;
gc_private = (GdkGCPrivate*) gc;
g_return_if_fail (image->type == GDK_IMAGE_SHARED);
XShmPutImage (drawable_private->xdisplay, drawable_private->xwindow,
XShmPutImage (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
gc_private->xgc, image_private->ximage,
xsrc, ysrc, xdest, ydest, width, height, False);
#else /* USE_SHM */

View File

@ -472,14 +472,14 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
gdouble *x, gdouble *y, gdouble *pressure,
gdouble *xtilt, gdouble *ytilt)
{
GdkWindowPrivate *win_priv;
GdkDrawablePrivate *drawable_priv;
int x_axis, y_axis, pressure_axis, xtilt_axis, ytilt_axis;
double device_width, device_height;
double x_offset, y_offset, x_scale, y_scale;
win_priv = (GdkWindowPrivate *) input_window->window;
drawable_priv = (GdkDrawablePrivate *) input_window->window;
x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
@ -505,26 +505,26 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
(device_width*gdkdev->axes[x_axis].resolution);
if (device_aspect * win_priv->width >= win_priv->height)
if (device_aspect * drawable_priv->width >= drawable_priv->height)
{
/* device taller than window */
x_scale = win_priv->width / device_width;
x_scale = drawable_priv->width / device_width;
y_scale = (x_scale * gdkdev->axes[x_axis].resolution)
/ gdkdev->axes[y_axis].resolution;
x_offset = 0;
y_offset = -(device_height * y_scale -
win_priv->height)/2;
drawable_priv->height)/2;
}
else
{
/* window taller than device */
y_scale = win_priv->height / device_height;
y_scale = drawable_priv->height / device_height;
x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
/ gdkdev->axes[x_axis].resolution;
y_offset = 0;
x_offset = - (device_width * x_scale - win_priv->width)/2;
x_offset = - (device_width * x_scale - drawable_priv->width)/2;
}
}

View File

@ -127,20 +127,20 @@ gdk_input_motion_events (GdkWindow *window,
guint32 stop,
gint *nevents_return)
{
GdkWindowPrivate *window_private;
XTimeCoord *xcoords;
GdkTimeCoord *coords;
int i;
g_return_val_if_fail (window != NULL, NULL);
window_private = (GdkWindowPrivate *) window;
if (window_private->destroyed)
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (deviceid == GDK_CORE_POINTER)
{
xcoords = XGetMotionEvents (gdk_display,
window_private->xwindow,
xcoords = XGetMotionEvents (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
start, stop, nevents_return);
if (xcoords)
{
@ -224,8 +224,10 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
GdkInputWindow *iw;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return;
if (mode == GDK_EXTENSION_EVENTS_NONE)

View File

@ -47,6 +47,7 @@
#include "gdk.h"
#include "gdkx.h"
#include "gdkprivate.h"
#include "gdkinputprivate.h"
@ -493,10 +494,7 @@ gdk_pointer_grab (GdkWindow * window,
GdkCursor * cursor,
guint32 time)
{
/* From gdkwindow.c */
gint return_val;
GdkWindowPrivate *window_private;
GdkWindowPrivate *confine_to_private;
GdkCursorPrivate *cursor_private;
guint xevent_mask;
Window xwindow;
@ -505,17 +503,17 @@ gdk_pointer_grab (GdkWindow * window,
int i;
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
window_private = (GdkWindowPrivate*) window;
confine_to_private = (GdkWindowPrivate*) confine_to;
cursor_private = (GdkCursorPrivate*) cursor;
xwindow = window_private->xwindow;
xwindow = GDK_DRAWABLE_XID (window);
if (!confine_to || confine_to_private->destroyed)
if (!confine_to || GDK_DRAWABLE_DESTROYED (confine_to))
xconfine_to = None;
else
xconfine_to = confine_to_private->xwindow;
xconfine_to = GDK_DRAWABLE_XID (confine_to);
if (!cursor)
xcursor = None;
@ -541,8 +539,8 @@ gdk_pointer_grab (GdkWindow * window,
if (return_val == Success)
{
if (!window_private->destroyed)
return_val = XGrabPointer (window_private->xdisplay,
if (!GDK_DRAWABLE_DESTROYED (window))
return_val = XGrabPointer (GDK_DRAWABLE_XDISPLAY (window),
xwindow,
owner_events,
xevent_mask,
@ -555,7 +553,7 @@ gdk_pointer_grab (GdkWindow * window,
}
if (return_val == GrabSuccess)
gdk_xgrab_window = window_private;
gdk_xgrab_window = (GdkWindowPrivate *)window;
return return_val;
}
@ -631,17 +629,12 @@ gdk_keyboard_grab (GdkWindow * window,
gint owner_events,
guint32 time)
{
GdkWindowPrivate *window_private;
Window xwindow;
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
window_private = (GdkWindowPrivate*) window;
xwindow = window_private->xwindow;
if (!window_private->destroyed)
return XGrabKeyboard (window_private->xdisplay,
xwindow,
if (!GDK_DRAWABLE_DESTROYED (window))
return XGrabKeyboard (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
owner_events,
GrabModeAsync, GrabModeAsync,
time);

View File

@ -34,6 +34,7 @@
#include "gdkpixmap.h"
#include "gdkprivate.h"
#include "gdkx.h"
typedef struct
{
@ -56,36 +57,32 @@ gdk_pixmap_new (GdkWindow *window,
gint depth)
{
GdkPixmap *pixmap;
GdkWindowPrivate *private;
GdkWindowPrivate *window_private;
GdkDrawablePrivate *private;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (depth == -1)
depth = gdk_window_get_visual (window)->depth;
depth = gdk_drawable_get_visual (window)->depth;
private = g_new0 (GdkWindowPrivate, 1);
private = g_new0 (GdkDrawablePrivate, 1);
pixmap = (GdkPixmap*) private;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->xwindow = XCreatePixmap (private->xdisplay, window_private->xwindow,
private->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
private->window_type = GDK_DRAWABLE_PIXMAP;
private->xwindow = XCreatePixmap (private->xdisplay,
GDK_DRAWABLE_XID (window),
width, height, depth);
private->colormap = NULL;
private->parent = NULL;
private->x = 0;
private->y = 0;
private->width = width;
private->height = height;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = 0;
@ -101,35 +98,30 @@ gdk_bitmap_create_from_data (GdkWindow *window,
gint height)
{
GdkPixmap *pixmap;
GdkWindowPrivate *private;
GdkWindowPrivate *window_private;
GdkDrawablePrivate *private;
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
private = g_new0 (GdkWindowPrivate, 1);
private = g_new0 (GdkDrawablePrivate, 1);
pixmap = (GdkPixmap*) private;
private->parent = NULL;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->x = 0;
private->y = 0;
private->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
private->window_type = GDK_DRAWABLE_PIXMAP;
private->width = width;
private->height = height;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = FALSE;
private->xwindow = XCreateBitmapFromData (private->xdisplay,
window_private->xwindow,
GDK_DRAWABLE_XID (window),
(char *)data, width, height);
gdk_xid_table_insert (&private->xwindow, pixmap);
@ -147,9 +139,9 @@ gdk_pixmap_create_from_data (GdkWindow *window,
GdkColor *bg)
{
GdkPixmap *pixmap;
GdkWindowPrivate *private;
GdkWindowPrivate *window_private;
GdkDrawablePrivate *private;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL);
@ -159,29 +151,24 @@ gdk_pixmap_create_from_data (GdkWindow *window,
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
if (depth == -1)
depth = gdk_window_get_visual (window)->depth;
depth = gdk_drawable_get_visual (window)->depth;
private = g_new0 (GdkWindowPrivate, 1);
private = g_new0 (GdkDrawablePrivate, 1);
pixmap = (GdkPixmap*) private;
private->parent = NULL;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->x = 0;
private->y = 0;
private->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
private->window_type = GDK_DRAWABLE_PIXMAP;
private->width = width;
private->height = height;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = FALSE;
private->xwindow = XCreatePixmapFromBitmapData (private->xdisplay,
window_private->xwindow,
GDK_DRAWABLE_XID (window),
(char *)data, width, height,
fg->pixel, bg->pixel, depth);
@ -460,8 +447,8 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
if (colormap == NULL)
{
colormap = gdk_window_get_colormap (window);
visual = gdk_window_get_visual (window);
colormap = gdk_drawable_get_colormap (window);
visual = gdk_drawable_get_visual (window);
}
else
visual = ((GdkColormapPrivate *)colormap)->visual;
@ -760,8 +747,7 @@ GdkPixmap*
gdk_pixmap_foreign_new (guint32 anid)
{
GdkPixmap *pixmap;
GdkWindowPrivate *window_private;
GdkWindowPrivate *private;
GdkDrawablePrivate *private;
Pixmap xpixmap;
Window root_return;
unsigned int x_ret, y_ret, w_ret, h_ret, bw_ret, depth_ret;
@ -772,29 +758,24 @@ gdk_pixmap_foreign_new (guint32 anid)
/* set the pixmap to the passed in value */
xpixmap = anid;
/* get the root window */
window_private = &gdk_root_parent;
/* get information about the Pixmap to fill in the structure for
the gdk window */
if (!XGetGeometry(window_private->xdisplay, xpixmap, &root_return,
if (!XGetGeometry(GDK_DISPLAY(),
xpixmap, &root_return,
&x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
return NULL;
/* allocate a new gdk pixmap */
private = g_new(GdkWindowPrivate, 1);
private = g_new(GdkDrawablePrivate, 1);
pixmap = (GdkPixmap *)private;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->xdisplay = GDK_DISPLAY();
private->window_type = GDK_DRAWABLE_PIXMAP;
private->xwindow = xpixmap;
private->colormap = NULL;
private->parent = NULL;
private->x = 0;
private->y = 0;
private->width = w_ret;
private->height = h_ret;
private->resize_count = 0;
private->ref_count = 1;
private->destroyed = 0;
@ -806,8 +787,9 @@ gdk_pixmap_foreign_new (guint32 anid)
GdkPixmap*
gdk_pixmap_ref (GdkPixmap *pixmap)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
GdkDrawablePrivate *private = (GdkDrawablePrivate *)pixmap;
g_return_val_if_fail (pixmap != NULL, NULL);
g_return_val_if_fail (GDK_IS_PIXMAP (private), NULL);
private->ref_count += 1;
return pixmap;
@ -816,8 +798,9 @@ gdk_pixmap_ref (GdkPixmap *pixmap)
void
gdk_pixmap_unref (GdkPixmap *pixmap)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
GdkDrawablePrivate *private = (GdkDrawablePrivate *)pixmap;
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GDK_IS_PIXMAP (private));
g_return_if_fail (private->ref_count > 0);
private->ref_count -= 1;

View File

@ -28,6 +28,7 @@
#include <X11/Xatom.h>
#include <string.h>
#include "gdkx.h"
#include "gdkproperty.h"
#include "gdkprivate.h"
@ -111,14 +112,11 @@ gdk_property_get (GdkWindow *window,
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return FALSE;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_WINDOW_XDISPLAY (window);
xwindow = GDK_WINDOW_XWINDOW (window);
}
else
{
@ -200,14 +198,11 @@ gdk_property_change (GdkWindow *window,
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_WINDOW_XDISPLAY (window);
xwindow = GDK_WINDOW_XWINDOW (window);
}
else
{
@ -228,14 +223,11 @@ gdk_property_delete (GdkWindow *window,
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (window))
return;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_WINDOW_XDISPLAY (window);
xwindow = GDK_WINDOW_XWINDOW (window);
}
else
{

View File

@ -45,14 +45,11 @@ gdk_selection_owner_set (GdkWindow *owner,
if (owner)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) owner;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (owner))
return FALSE;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
xdisplay = GDK_DRAWABLE_XDISPLAY (owner);
xwindow = GDK_DRAWABLE_XID (owner);
}
else
{
@ -83,16 +80,11 @@ gdk_selection_convert (GdkWindow *requestor,
GdkAtom target,
guint32 time)
{
GdkWindowPrivate *private;
g_return_if_fail (requestor != NULL);
private = (GdkWindowPrivate*) requestor;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (requestor))
return;
XConvertSelection (private->xdisplay, selection, target,
gdk_selection_property, private->xwindow, time);
XConvertSelection (GDK_DRAWABLE_XDISPLAY (requestor), selection, target,
gdk_selection_property, GDK_DRAWABLE_XID (requestor), time);
}
gint
@ -101,7 +93,6 @@ gdk_selection_property_get (GdkWindow *requestor,
GdkAtom *ret_type,
gint *ret_format)
{
GdkWindowPrivate *private;
gulong nitems;
gulong nbytes;
gulong length;
@ -110,17 +101,18 @@ gdk_selection_property_get (GdkWindow *requestor,
guchar *t = NULL;
g_return_val_if_fail (requestor != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
/* If retrieved chunks are typically small, (and the ICCCM says the
should be) it would be a win to try first with a buffer of
moderate length, to avoid two round trips to the server */
private = (GdkWindowPrivate*) requestor;
if (private->destroyed)
if (GDK_DRAWABLE_DESTROYED (requestor))
return 0;
t = NULL;
XGetWindowProperty (private->xdisplay, private->xwindow,
XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (requestor),
GDK_DRAWABLE_XID (requestor),
gdk_selection_property, 0, 0, False,
AnyPropertyType, &prop_type, &prop_format,
&nitems, &nbytes, &t);
@ -150,7 +142,8 @@ gdk_selection_property_get (GdkWindow *requestor,
protocol, in which case the client has to make sure they'll be
notified of PropertyChange events _before_ the property is deleted.
Otherwise there's no guarantee we'll win the race ... */
XGetWindowProperty (private->xdisplay, private->xwindow,
XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (requestor),
GDK_DRAWABLE_XID (requestor),
gdk_selection_property, 0, (nbytes + 3) / 4, False,
AnyPropertyType, &prop_type, &prop_format,
&nitems, &nbytes, &t);

File diff suppressed because it is too large Load Diff

View File

@ -33,8 +33,10 @@
#define GDK_ROOT_WINDOW() gdk_root_window
#define GDK_ROOT_PARENT() ((GdkWindow *)&gdk_root_parent)
#define GDK_DISPLAY() gdk_display
#define GDK_WINDOW_XDISPLAY(win) (((GdkWindowPrivate*) win)->xdisplay)
#define GDK_WINDOW_XWINDOW(win) (((GdkWindowPrivate*) win)->xwindow)
#define GDK_DRAWABLE_XDISPLAY(win) (((GdkDrawablePrivate*) win)->xdisplay)
#define GDK_DRAWABLE_XID(win) (((GdkDrawablePrivate*) win)->xwindow)
#define GDK_WINDOW_XDISPLAY GDK_DRAWABLE_XDISPLAY
#define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
#define GDK_IMAGE_XDISPLAY(image) (((GdkImagePrivate*) image)->xdisplay)
#define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivate*) image)->ximage)
#define GDK_GC_XDISPLAY(gc) (((GdkGCPrivate*) gc)->xdisplay)

View File

@ -171,7 +171,7 @@ gtk_plug_realize (GtkWidget *widget)
widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
}
((GdkWindowPrivate *)widget->window)->window_type = GDK_WINDOW_TOPLEVEL;
GDK_DRAWABLE_TYPE (window) = GDK_WINDOW_TOPLEVEL;
gdk_window_set_user_data (widget->window, window);
widget->style = gtk_style_attach (widget->style, widget->window);

View File

@ -4784,7 +4784,8 @@ gtk_reset_shapes_recurse (GtkWidget *widget,
private = (GdkWindowPrivate*) window;
if (private->destroyed)
/* FIXME: We do we need this check? */
if (GDK_DRAWABLE_DESTROYED (window))
return;
gdk_window_get_user_data (window, &data);
if (data != widget)