X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gdk%2Fx11%2Fgdkim-x11.c;h=389e653ec006446b92f0f4c65c87baf1a08deb23;hb=be7de347bfac28b341aeb25baf1e788c6a333095;hp=028befb4d8af73f4454bce4621a421547f9561d0;hpb=a941deb67f65dfe4ccff17f0be6388d4c74c7bf3;p=~andy%2Fgtk diff --git a/gdk/x11/gdkim-x11.c b/gdk/x11/gdkim-x11.c index 028befb4d..389e653ec 100644 --- a/gdk/x11/gdkim-x11.c +++ b/gdk/x11/gdkim-x11.c @@ -24,19 +24,16 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#include +#include "config.h" -#include -#include -#include - -#include "gdkx.h" -#include "gdk.h" /* For gdk_flush() */ #include "gdkx.h" -#include "gdkpixmap.h" +#include "gdkmain.h" #include "gdkinternals.h" #include "gdkdisplay-x11.h" -#include "gdkalias.h" + +#include +#include +#include /* If this variable is FALSE, it indicates that we should @@ -104,150 +101,3 @@ gdk_set_locale (void) return setlocale (LC_ALL, NULL); } - -static GdkDisplay * -find_a_display (void) -{ - GdkDisplay *display = gdk_display_get_default (); - - if (!display) - display = _gdk_displays->data; - - return display; -} - -/** - * gdk_wcstombs: - * @src: a wide character string. - * - * Converts a wide character string to a multi-byte string. - * (The function name comes from an acronym of 'Wide Character String TO - * Multi-Byte String'). - * - * Return value: the multi-byte string corresponding to @src, or %NULL if the - * conversion failed. The returned string should be freed with g_free() when no - * longer needed. - **/ -gchar * -gdk_wcstombs (const GdkWChar *src) -{ - gchar *mbstr; - - if (gdk_use_mb) - { - GdkDisplay *display = find_a_display (); - Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); - XTextProperty tpr; - - if (sizeof(wchar_t) != sizeof(GdkWChar)) - { - gint i; - wchar_t *src_alt; - for (i=0; src[i]; i++); - src_alt = g_new (wchar_t, i+1); - for (; i>=0; i--) - src_alt[i] = src[i]; - if (XwcTextListToTextProperty (xdisplay, &src_alt, 1, XTextStyle, &tpr) - != Success) - { - g_free (src_alt); - return NULL; - } - g_free (src_alt); - } - else - { - wchar_t *tmp; - - if (XwcTextListToTextProperty (xdisplay, &tmp, 1, - XTextStyle, &tpr) != Success) - { - return NULL; - } - - src = (GdkWChar *)tmp; - } - /* - * We must copy the string into an area allocated by glib, because - * the string 'tpr.value' must be freed by XFree(). - */ - mbstr = g_strdup(tpr.value); - XFree (tpr.value); - } - else - { - gint length = 0; - gint i; - - while (src[length] != 0) - length++; - - mbstr = g_new (gchar, length + 1); - - for (i=0; i