From 0969d64850c22ac5ce410c015f0536bc452af61d Mon Sep 17 00:00:00 2001 From: rbdpngn Date: Sun, 12 Oct 2003 05:34:47 +0000 Subject: [PATCH] Follow the netwm spec and use UTF8 string encoding. Avoid non-portable Xlib functions too. SVN revision: 7547 --- legacy/ecore/src/lib/ecore_x/ecore_x.c | 4 ++++ legacy/ecore/src/lib/ecore_x/ecore_x_private.h | 2 ++ legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c | 11 ++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x.c b/legacy/ecore/src/lib/ecore_x/ecore_x.c index 0c38fc8151..604620c5e7 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x.c @@ -50,6 +50,8 @@ Atom _ecore_x_atom_net_wm_pid = 0; Atom _ecore_x_atom_net_wm_handle_icons = 0; Atom _ecore_x_atom_net_wm_user_time = 0; +Atom _ecore_x_atom_utf8_string = 0; + Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM] = {0}; int ECORE_X_EVENT_KEY_DOWN = 0; @@ -261,6 +263,8 @@ ecore_x_init(const char *name) _ecore_x_atom_net_wm_pid = XInternAtom(_ecore_x_disp, "_NET_WM_PID", False); _ecore_x_atom_net_wm_user_time = XInternAtom(_ecore_x_disp, "_NET_WM_USER_TIME", False); + _ecore_x_atom_utf8_string = XInternAtom(_ecore_x_disp, "UTF8_STRING", False); + _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = _ecore_x_atom_wm_delete_window; _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = _ecore_x_atom_wm_take_focus; diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h index 62bd38eb3d..5b5dbd548e 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h @@ -81,6 +81,8 @@ extern Atom _ecore_x_atom_net_wm_user_time; extern Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; +extern Atom _ecore_x_atom_utf8_string; + void _ecore_x_error_handler_init(void); void _ecore_x_event_handle_key_press(XEvent *xevent); void _ecore_x_event_handle_key_release(XEvent *xevent); diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c index 4671e47ff5..b6ceade45a 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c @@ -101,7 +101,7 @@ ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, char *str) if (win == 0) win = DefaultRootWindow(_ecore_x_disp); xtp.value = str; xtp.format = 8; - xtp.encoding = XA_STRING; + xtp.encoding = _ecore_x_atom_utf8_string; xtp.nitems = strlen(str); XSetTextProperty(_ecore_x_disp, win, &xtp, type); } @@ -129,7 +129,7 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type) if (xtp.format == 8) { - s = Xutf8TextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items); + s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, &list, &items); if ((s == Success) && (items > 0)) { str = strdup(*list); @@ -156,8 +156,8 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type) void ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t) { - ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_name, t); - ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_name, t); + ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_name, (char *)t); + ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_name, (char *)t); } /** @@ -189,7 +189,8 @@ ecore_x_window_prop_title_get(Ecore_X_Window win) void ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const char *t) { - ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_visible_name, t); + ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_visible_name, + (char *)t); } /**