summaryrefslogtreecommitdiffstats
path: root/source/dialogs
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-04-10 12:05:34 +0200
committerDave Davenport <qball@gmpclient.org>2016-04-10 12:05:34 +0200
commite54e012500ecf2ebd35bbfef669f3971fb199bad (patch)
treeb6dea9aecbe38249641042f9f1906533d7918018 /source/dialogs
parentc3b236db28538d5f53dd085c3d52092f3d3e7fcf (diff)
Issue: #381: Try to handle X11 input and UTF-8 better.
In window_get_text_prop do conversion when input is of type STRING. (latin1) to utf8. Dmenu: don't skip invalid lines, but try to display as much as possible. Window mode: Double check all input from X.
Diffstat (limited to 'source/dialogs')
-rw-r--r--source/dialogs/dmenu.c6
-rw-r--r--source/dialogs/window.c13
2 files changed, 12 insertions, 7 deletions
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index 02594572..2ca1540e 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -92,10 +92,8 @@ static char **get_dmenu ( DmenuModePrivateData *pd, FILE *fd, unsigned int *leng
data[l - 1] = '\0';
l--;
}
- if ( !g_utf8_validate ( data, l, NULL ) ) {
- fprintf ( stderr, "String: '%s' is not valid utf-8\n", data );
- continue;
- }
+ data = rofi_force_utf8 ( data );
+ printf ( "data: %s\n", data );
retv[( *length )] = data;
data = NULL;
diff --git a/source/dialogs/window.c b/source/dialogs/window.c
index 5c2bdc11..57684151 100644
--- a/source/dialogs/window.c
+++ b/source/dialogs/window.c
@@ -53,8 +53,6 @@
#define WINLIST 32
-#define CLIENTTITLE 100
-#define CLIENTCLASS 50
#define CLIENTSTATE 10
#define CLIENTWINDOWTYPE 10
#define CLIENTROLE 50
@@ -285,7 +283,8 @@ static client* window_client ( xcb_window_t win )
cky = xcb_icccm_get_wm_class ( xcb->connection, c->window );
xcb_icccm_get_wm_class_reply_t wcr;
if ( xcb_icccm_get_wm_class_reply ( xcb->connection, cky, &wcr, NULL ) ) {
- c->class = g_strdup ( wcr.class_name );
+ c->class = rofi_latin_to_utf8_strdup ( wcr.class_name, -1 );
+ c->name = rofi_latin_to_utf8_strdup ( wcr.instance_name, -1 );
xcb_icccm_get_wm_class_reply_wipe ( &wcr );
}
@@ -295,6 +294,14 @@ static client* window_client ( xcb_window_t win )
c->hint_flags = r.flags;
}
+ /** Do UTF-8 Check, should not be needed, does not hurt here to be paranoid. */
+ {
+ c->title = rofi_force_utf8 ( c->title );
+ c->class = rofi_force_utf8 ( c->class );
+ c->name = rofi_force_utf8 ( c->name );
+ c->role = rofi_force_utf8 ( c->role );
+ }
+
winlist_append ( cache_client, c->window, c );
g_free ( attr );
return c;