summaryrefslogtreecommitdiff
path: root/gtk/gtktext.h
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 /gtk/gtktext.h
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 'gtk/gtktext.h')
-rw-r--r--gtk/gtktext.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/gtk/gtktext.h b/gtk/gtktext.h
index 4ba138614b..f8f35af6c7 100644
--- a/gtk/gtktext.h
+++ b/gtk/gtktext.h
@@ -70,7 +70,7 @@ struct _GtkText
/* The text, a single segment of text a'la emacs, with a gap
* where insertion occurs. */
- guchar* text;
+ union { GdkWChar *wc; guchar *ch; } text;
/* The allocated length of the text segment. */
guint text_len;
/* The gap position, index into address where a char
@@ -94,7 +94,7 @@ struct _GtkText
/* First visible horizontal pixel. */
guint first_onscreen_hor_pixel;
/* First visible vertical pixel. */
- guint first_onscreen_ver_pixel;
+ guint first_onscreen_ver_pixel;
/* FLAGS */
@@ -102,6 +102,9 @@ struct _GtkText
* horizontal scrollbar. */
guint line_wrap : 1;
guint word_wrap : 1;
+ /* If a fontset is supplied for the widget, use_wchar become true,
+ * and we use GdkWchar as the encoding of text. */
+ guint use_wchar : 1;
/* Frozen, don't do updates. @@@ fixme */
guint freeze_count;
@@ -119,7 +122,7 @@ struct _GtkText
/* SCRATCH AREA */
- guchar* scratch_buffer;
+ union { GdkWChar *wc; guchar *ch; } scratch_buffer;
guint scratch_buffer_len;
/* SCROLLING */
@@ -131,7 +134,7 @@ struct _GtkText
gint cursor_pos_x; /* Position of cursor. */
gint cursor_pos_y; /* Baseline of line cursor is drawn on. */
GtkPropertyMark cursor_mark; /* Where it is in the buffer. */
- gchar cursor_char; /* Character to redraw. */
+ GdkWChar cursor_char; /* Character to redraw. */
gchar cursor_char_offset; /* Distance from baseline of the font. */
gint cursor_virtual_x; /* Where it would be if it could be. */
gint cursor_drawn_level; /* How many people have undrawn. */
@@ -192,9 +195,11 @@ gint gtk_text_backward_delete (GtkText *text,
gint gtk_text_forward_delete (GtkText *text,
guint nchars);
-#define GTK_TEXT_INDEX(t, index) \
- ((index) < (t)->gap_position ? (t)->text[index] : \
- (t)->text[(index) + (t)->gap_size])
+#define GTK_TEXT_INDEX(t, index) (((t)->use_wchar) \
+ ? ((index) < (t)->gap_position ? (t)->text.wc[index] : \
+ (t)->text.wc[(index)+(t)->gap_size]) \
+ : ((index) < (t)->gap_position ? (t)->text.ch[index] : \
+ (t)->text.ch[(index)+(t)->gap_size]))
#ifdef __cplusplus
}