gtk-a-higuti-980912-0.patch

This patch is against CVS tree, around Sep 9.

It adds support for CJK (Chinese, Japanese, and Korean) locales in the
GtkText widget, using wide characters. It also changes the internal
representation of text in GtkEntry, and fixes some problem with XIM
support codes.

Furthermore, I found a minor bug in gtk/gtktext.c:delete_text_property(),
that text->text_properties_end is not set correctly.

Changes:

       * configure.in
               New option --enable-default-fontset, which is useful for
               CJK users.
       * gdk/gdk.c
               (gdk_set_locale): Use LC_CTYPE instead of LC_ALL.
               (gdk_event_get): Changed the logic of filtering XIM events.
               (gdk_im_begin): Fixed a bug about synchronizing XIC focus.
               (gdk_im_end): Likewise.
               (gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
                       implemented by a combination of Xlib functions, so
                       it works with X_LOCALE.
               (gdk_wcstombs): New function.
               (g_mbtowc): Removed. No longer needed.
       * gdk/gdk.h
               (gdk_text_width_wc): New prototype.
               (gdk_char_width_wc): New prototype.
               (gdk_draw_text_wc): New prototype.
               (gdk_wcstombs): New prototype.
               (gdk_mbstowcs): New prototype.
       * gdk/gdkdraw.c
               (gdk_draw_text_wc): New function.
       * gdk/gdkfont.c
               (gdk_text_width_wc): New function.
               (gdk_char_width_wc): New function.
       * 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 type.
       * gtk/gtkeditable.c
               (gtk_editable_finalize): Removed.
       * 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. The following is the remainder of these
               changes.
               (gtk_entry_enter_leave): New function. Some XIMs require to
                       be set PreeditPosition when we get a Enter/Leave
                       event.
               (gtk_entry_find_char): Removed. No longer needed.
               (gtk_entry_realize): Added a mask to handle focus events on
                       text_area, because some XIMs require this. Added
                       some codes to make XIC realized.
               (gtk_entry_unrealize): Added a call to gdk_ic_destroy().
       * gtk/gtkprivate.h, gtk/gtkmain.c
               Removed gtk_use_mb and related codes.
       * gtk/gtkspinbutton.c
               Some changes according to the change of type of entry->text.
       * gtk/gtkstyle.c
               Added some codes related to --enable-default-fontset.
       * 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. Furthermore, there are some changes in codes related
               to XIM.
       * gtk/gtkwidget.c
               (gtk_widget_real_unrealize): Changed the order of
               unrealization. If we unrealize the base widget first, some
               XIMs hang, because the client window is deleted before XIC.
       * gtk/testgtk.c
               (create_text): Changed codes inserting text from file,
               to insert multibyte characters correctly.