1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
28 #include "gdkinternals.h"
29 #include "gdkprivate-fb.h"
40 /* If this variable is FALSE, it indicates that we should
41 * avoid trying to use multibyte conversion functions and
42 * assume everything is 1-byte per character
44 static gboolean gdk_use_mb;
47 *--------------------------------------------------------------
56 *--------------------------------------------------------------
63 gchar *current_locale;
67 if (!setlocale (LC_ALL,""))
68 g_warning ("locale not supported by C library");
70 current_locale = setlocale (LC_ALL, NULL);
72 if ((strcmp (current_locale, "C")) && (strcmp (current_locale, "POSIX")))
77 /* Detect GNU libc, where mb == UTF8. Not useful unless it's
78 * really a UTF8 locale. The below still probably will
79 * screw up on Greek, Cyrillic, etc, encoded as UTF8.
82 if ((MB_CUR_MAX == 2) &&
83 (mbstowcs (&result, "\xdd\xa5", 1) > 0) &&
86 if ((strlen (current_locale) < 4) ||
87 g_strcasecmp (current_locale + strlen(current_locale) - 4, "utf8"))
94 g_message ("%s multi-byte string functions.",
95 gdk_use_mb ? "Using" : "Not using"));
97 return current_locale;
101 gdk_im_begin (GdkIC *ic, GdkWindow* window)
111 gdk_im_decide_style (GdkIMStyle supported_style)
113 return GDK_IM_PREEDIT_NONE | GDK_IM_STATUS_NONE;
117 gdk_im_set_best_style (GdkIMStyle style)
119 return GDK_IM_PREEDIT_NONE | GDK_IM_STATUS_NONE;
140 gdk_ic_new (GdkICAttr *attr, GdkICAttributesType mask)
146 gdk_ic_destroy (GdkIC *ic)
151 gdk_ic_get_style (GdkIC *ic)
153 return GDK_IM_PREEDIT_NONE | GDK_IM_STATUS_NONE;
157 gdk_ic_set_values (GdkIC *ic, ...)
162 gdk_ic_get_values (GdkIC *ic, ...)
167 gdk_ic_set_attr (GdkIC *ic, GdkICAttr *attr, GdkICAttributesType mask)
173 gdk_ic_get_attr (GdkIC *ic, GdkICAttr *attr, GdkICAttributesType mask)
179 gdk_ic_get_events (GdkIC *ic)
187 * Returns a multi-byte string converted from the specified array
188 * of wide characters. The string is newly allocated. The array of
189 * wide characters must be null-terminated. If the conversion is
190 * failed, it returns NULL.
193 gdk_wcstombs (const GdkWChar *src)
200 while (src[length] != 0)
203 mbstr = g_new (gchar, length + 1);
205 for (i = 0; i < length + 1; i++)
214 * Converts the specified string into wide characters, and, returns the
215 * number of wide characters written. The string 'src' must be
216 * null-terminated. If the conversion is failed, it returns -1.
219 gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
223 for (i = 0; i < dest_max && src[i]; i++)
234 GdkICAttr* gdk_ic_attr_new (void)
240 gdk_ic_attr_destroy (GdkICAttr *attr)