summaryrefslogtreecommitdiff
path: root/gtk/gtkimcontextsimple.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-06-21 16:19:59 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-06-21 16:19:59 +0000
commit2a98bc6a31dd136058f9068435227cf10713e0ff (patch)
tree53bf4b442175fd18d6be6599dcdf2bf96fd769a4 /gtk/gtkimcontextsimple.c
parent8a01e98fdf760692c1c90dc0192388a09cb09eb2 (diff)
downloadgtk+-2a98bc6a31dd136058f9068435227cf10713e0ff.tar.gz
Remove use of libunicode in favor of new GLib functions.
Wed Jun 21 11:41:43 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtkimcontextsimple.c gtk/gtklabel.c gtk/gtktexttypes.c gtk/testtext.c modules/linux-fb/basic.c: Remove use of libunicode in favor of new GLib functions. * gtk/gtkcolorsel.c: Remove conditional includes for FB, win32, nano-x, framebuffer. The X11 include is just a hack until we get the necessary functions in gdkcolor.h, so there is no reason to add other includes of platforms. * gtk/gtkwindow.c (gtk_window_compute_default_size): Revert window bigger than the screen change. * gtk/testgtk.c: Revert some random changes from Elliot that had no particular point and were causing testgtkrc not to function correctly. * gdk/gdkregion-generic.h: Revert change from Elliot. Just because GdkSegment and GdkRegionBox have the same fields, it doesn't mean that 'typedef GdkSegment GdkRegionBox' results in clearer code. * gdk/x11/gdkinput-x11.c (gdk_input_common_select_events, gdk_input_translate_coordinates): Fix missed GdkObjectification
Diffstat (limited to 'gtk/gtkimcontextsimple.c')
-rw-r--r--gtk/gtkimcontextsimple.c66
1 files changed, 4 insertions, 62 deletions
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 03ddcc3310..bd1f282307 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -17,7 +17,6 @@
* Boston, MA 02111-1307, USA.
*/
-#include <unicode.h>
#include <gdk/gdkkeysyms.h>
#include "gtksignal.h"
#include "gtkimcontextsimple.h"
@@ -781,71 +780,14 @@ gtk_im_context_simple_new (void)
return GTK_IM_CONTEXT (gtk_type_new (GTK_TYPE_IM_CONTEXT_SIMPLE));
}
-/**
- * unicode_guchar4_to_utf8:
- * @ch: a ISO10646 character code
- * @out: output buffer, must have at least 6 bytes of space.
- *
- * Convert a single character to utf8
- *
- * Return value: number of bytes written
- **/
-static int
-ucs4_to_utf8 (unicode_char_t c, char *outbuf)
-{
- size_t len = 0;
- int first;
- int i;
-
- if (c < 0x80)
- {
- first = 0;
- len = 1;
- }
- else if (c < 0x800)
- {
- first = 0xc0;
- len = 2;
- }
- else if (c < 0x10000)
- {
- first = 0xe0;
- len = 3;
- }
- else if (c < 0x200000)
- {
- first = 0xf0;
- len = 4;
- }
- else if (c < 0x4000000)
- {
- first = 0xf8;
- len = 5;
- }
- else
- {
- first = 0xfc;
- len = 6;
- }
-
- for (i = len - 1; i > 0; --i)
- {
- outbuf[i] = (c & 0x3f) | 0x80;
- c >>= 6;
- }
- outbuf[0] = c | first;
-
- return len;
-}
-
static void
gtk_im_context_simple_commit_char (GtkIMContext *context,
- unicode_char_t ch)
+ gunichar ch)
{
- gchar buf[7];
+ gchar buf[10];
gint len;
- len = ucs4_to_utf8 (ch, buf);
+ len = g_unichar_to_utf8 (ch, buf);
buf[len] = '\0';
gtk_signal_emit_by_name (GTK_OBJECT (context), "commit", &buf);
@@ -878,7 +820,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context);
GtkComposeSeq *seq;
- unicode_char_t ch;
+ gunichar ch;
int n_compose = 0;
int i;