summaryrefslogtreecommitdiff
path: root/gdk/gdkdraw.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1998-12-09 06:36:57 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-12-09 06:36:57 +0000
commit207757e70d8b2d9aa8335d968fd7ac79796264ab (patch)
treeae572a9674c8dc7b8a0ae7200e6d4e7c5c7632e8 /gdk/gdkdraw.c
parentaf84227184f9cbe2c87f0aa09d5c93564150bb70 (diff)
downloadgtk+-207757e70d8b2d9aa8335d968fd7ac79796264ab.tar.gz
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize signals through the widget heirarchy. This is unpleasant, as it causes more X traffic, but is necessary, because we have to clean up our Input Contexts before destroying the X windows. (from matsu-981109-0.patch) Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com> Applied gtk-a-higuti-981202-0 : [ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ] * gdk/gdk.h gdk/gdk.c (gdk_mbstowcs): New function. Nearly equals to mbstowcs, but implemented by a combination of Xlib functions, so it works even with X_LOCALE. (gdk_wcstombs): New function. (g_mbtowc): Removed. No longer needed. * gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c: Added _wc() variants to gdk_text_width(), gdk_char_width(), gdk_draw_text(), * gdk/gdki18n.h (mblen, mbtowc, wctomb, mbstowcs, wcstombs, wcslen, wcscpy, wcsncpy): Removed. No longer needed. (iswalnum): Removed. (gdk_iswalnum): New macro. (gdk_iswspace): New macro. * gdk/gdktype.h (GdkWChar): New typedef. * gtk/gtkentry.h, gtk/gtkentry.c There are many changes according to the change of the internal representation of text, from multibyte string to wide characters. * gtk/gtkprivate.h, gtk/gtkmain.c Removed the variable gtk_use_mb and related codes. * gtk/gtkspinbutton.c Some changes according to the change of type of entry->text. * gtk/gtktext.h, gtk/gtktext.c Changed the internal representation of text. We use GdkWchar if a fontset is supplied. If not, we use guchar to save memory.
Diffstat (limited to 'gdk/gdkdraw.c')
-rw-r--r--gdk/gdkdraw.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index 2725367c16..2d61d5dc4a 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -294,6 +294,66 @@ gdk_draw_text (GdkDrawable *drawable,
}
void
+gdk_draw_text_wc (GdkDrawable *drawable,
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length)
+{
+ GdkWindowPrivate *drawable_private;
+ GdkFontPrivate *font_private;
+ GdkGCPrivate *gc_private;
+
+ g_return_if_fail (drawable != NULL);
+ g_return_if_fail (font != NULL);
+ g_return_if_fail (gc != NULL);
+ g_return_if_fail (text != NULL);
+
+ drawable_private = (GdkWindowPrivate*) drawable;
+ if (drawable_private->destroyed)
+ return;
+ gc_private = (GdkGCPrivate*) gc;
+ font_private = (GdkFontPrivate*) font;
+
+ if (font->type == GDK_FONT_FONT)
+ {
+ XFontStruct *xfont = (XFontStruct *) font_private->xfont;
+ gchar *text_8bit;
+ gint i;
+ XSetFont(drawable_private->xdisplay, 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,
+ gc_private->xgc, x, y, text_8bit, text_length);
+ g_free (text_8bit);
+ }
+ else if (font->type == GDK_FONT_FONTSET)
+ {
+ if (sizeof(GdkWChar) == sizeof(wchar_t))
+ {
+ XwcDrawString (drawable_private->xdisplay, drawable_private->xwindow,
+ (XFontSet) font_private->xfont,
+ gc_private->xgc, x, y, (wchar_t *)text, text_length);
+ }
+ else
+ {
+ wchar_t *text_wchar;
+ 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,
+ (XFontSet) font_private->xfont,
+ gc_private->xgc, x, y, text_wchar, text_length);
+ g_free (text_wchar);
+ }
+ }
+ else
+ g_error("undefined font type\n");
+}
+
+void
gdk_draw_pixmap (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *src,