Commit f903bdf1 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

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.
parent 344e8000
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.
......
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.
......
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.
......
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.
......
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.
......
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.
......
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.
......
General
=======
- gdk_pointer_grab() and gdk_keyboard_grab() are logically member
functions of GdkWindow.
Dir structure for ports
=======================
......
......@@ -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);
......
......@@ -47,6 +47,8 @@
#include <gdk/gdkvisual.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdkcompat.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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);