From dd34bcca5e6627c8a269c9232a8906e3bd8947df Mon Sep 17 00:00:00 2001 From: Gnome CVS User Date: Thu, 27 Nov 1997 04:16:39 +0000 Subject: Patches to support internationalized input by: Takashi Matsuda TANAKA Shinya See ChangeLog entries for further details. Also some small fixes to event handling in gdk/gdk.c; sending clear events in gtk/gtkselection.c and cut-and-paste in gtk/gtkentry.c --- gdk/gdkselection.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'gdk/gdkselection.c') diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c index 6bd4251100..f1fb5c6109 100644 --- a/gdk/gdkselection.c +++ b/gdk/gdkselection.c @@ -20,6 +20,7 @@ #include #include "gdk.h" #include "gdkprivate.h" +#include "gdkx.h" gint @@ -166,3 +167,71 @@ gdk_selection_send_notify (guint32 requestor, XSendEvent (gdk_display, requestor, False, NoEventMask, (XEvent*) &xevent); } + +gint +gdk_text_property_to_text_list (GdkAtom encoding, gint format, + guchar *text, gint length, + gchar ***list) +{ + XTextProperty property; + gint count = 0; + gint res; + + if (!list) + return 0; + + property.value = text; + property.encoding = encoding; + property.format = format; + property.nitems = length; + res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count); + + if (res == XNoMemory || res == XLocaleNotSupported || + res == XConverterNotFound) + return 0; + else + return count; +} + +void +gdk_free_text_list (gchar **list) +{ + XFreeStringList (list); +} + +gint +gdk_string_to_compound_text (gchar *str, + GdkAtom *encoding, gint *format, + guchar **ctext, gint *length) +{ + gint res; + XTextProperty property; + + res = XmbTextListToTextProperty (GDK_DISPLAY(), + &str, 1, XCompoundTextStyle, + &property); + if (res != Success) + { + property.encoding = None; + property.format = None; + property.value = NULL; + property.nitems = 0; + } + + if (encoding) + *encoding = property.encoding; + if (format) + *format = property.format; + if (ctext) + *ctext = property.value; + if (length) + *length = property.nitems; + + return res; +} + +void gdk_free_compound_text (guchar *ctext) +{ + if (ctext) + XFree (ctext); +} -- cgit v1.2.1