summaryrefslogtreecommitdiff
path: root/gdk/gdkselection.c
diff options
context:
space:
mode:
authorGnome CVS User <gnomecvs@src.gnome.org>1997-11-27 04:16:39 +0000
committerGnome CVS User <gnomecvs@src.gnome.org>1997-11-27 04:16:39 +0000
commitdd34bcca5e6627c8a269c9232a8906e3bd8947df (patch)
tree5309f2ead99fbef5a4138556854079f68df48645 /gdk/gdkselection.c
parente522ad46baaef62bb639a3a120c59203cb0af847 (diff)
downloadgtk+-dd34bcca5e6627c8a269c9232a8906e3bd8947df.tar.gz
Patches to support internationalized input by:
Takashi Matsuda <matsu@arch.comp.kyutech.ac.jp> TANAKA Shinya <shinya@race.u-tokyo.ac.jp> 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
Diffstat (limited to 'gdk/gdkselection.c')
-rw-r--r--gdk/gdkselection.c69
1 files changed, 69 insertions, 0 deletions
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 <string.h>
#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);
+}