changeset 2951:4586c0951eab trunk

Handle multibyte sequences properly when encountered.
author William Pitcock <nenolod@atheme-project.org>
date Sun, 01 Jul 2007 08:21:26 -0500
parents fc18fcad95a6
children cb15e12b6352
files src/audacious/ui_skinned_textbox.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_skinned_textbox.c	Sun Jul 01 14:56:46 2007 +0200
+++ b/src/audacious/ui_skinned_textbox.c	Sun Jul 01 08:21:26 2007 -0500
@@ -514,13 +514,10 @@
     UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX (widget);
     UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox);
 
-    if (textbox->text) {
-        if (!strcmp(text, textbox->text))
-            return;
+    if (textbox->text)
         g_free(textbox->text);
-    }
 
-    textbox->text = str_to_utf8(text);
+    textbox->text = g_utf8_strup(text, -1);
     priv->scroll_back = FALSE;
     ui_skinned_textbox_redraw(textbox);
 }
@@ -608,6 +605,7 @@
 static void textbox_generate_pixmap(UiSkinnedTextbox *textbox) {
     gint length, i, x, y, wl;
     gchar *pixmaptext;
+    gchar *tmp;
     GdkGC *gc;
     UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (textbox);
     g_return_if_fail(textbox != NULL);
@@ -680,10 +678,9 @@
                                      gdk_rgb_get_visual()->depth);
     gc = priv->gc;
 
-    for (i = 0; i < length; i++) {
-        gchar c;
+    for (tmp = pixmaptext, i = 0; tmp != NULL && i < length; i++, tmp = g_utf8_next_char(tmp)) {
+        gchar c = *tmp;
         x = y = -1;
-        c = toupper((int) pixmaptext[i]);
         if (c >= 'A' && c <= 'Z') {
             x = bmp_active_skin->properties.textbox_bitmap_font_width * (c - 'A');
             y = 0;