repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: d7d98751b7385416ad1694b5f1fde6c312ba20d5:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit d7d98751b7385416ad1694b5f1fde6c312ba20d5
Author: Emanuele Giaquinta 
Date:   Mon Jul 19 16:43:21 2010 +0000

    Use COMPOUND_TEXT encoding for WM_NAME/WM_ICON_NAME value when it is not fully
    convertible to STRING, patch by James Cloos.

diff --git a/Changes b/Changes
index 55e9473f4994009c58deb6057345563ff66f6b40..
index ..34745d0ed2fe28e47a51051e6475b7c1b787df72 100644
--- a/Changes
+++ b/Changes
@@ -21,6 +21,8 @@ TODO: perl-shell-window? perl-unix-socket?

 TODO:        - upgrade to libev-4.00.

+	- Use COMPOUND_TEXT encoding for WM_NAME/WM_ICON_NAME value when it
+	  is not fully convertible to STRING (patch by James Cloos).
         - fix a buffer overflow that would cause wrong key sequences to
           be generated for numpad keys (introduced in 9.05).
         - fix definition of sgr0 to work around limitations in luit.
diff --git a/src/main.C b/src/main.C
index 45fa44e87919b9a4a008fbd8c50fa9359ee05a25..
index ..93ac1f75152f9f53f3af6377fdca1de28eff1e35 100644
--- a/src/main.C
+++ b/src/main.C
@@ -755,6 +755,18 @@ rxvt_term::set_string_property (Atom prop, const char *str, int len)
                    (const unsigned char *)str, len >= 0 ? len : strlen (str));
 }

+void
+rxvt_term::set_mbstring_property (Atom prop, const char *str, int len)
+{
+  XTextProperty ct;
+
+  if (XmbTextListToTextProperty (dpy, (char **)&str, 1, XStdICCTextStyle, &ct) >= 0)
+    {
+      XSetTextProperty (dpy, parent[0], &ct, prop);
+      XFree (ct.value);
+    }
+}
+
 void
 rxvt_term::set_utf8_property (Atom prop, const char *str, int len)
 {
@@ -775,7 +787,7 @@ rxvt_term::set_utf8_property (Atom prop, const char *str, int len)
 void
 rxvt_term::set_title (const char *str)
 {
-  set_string_property (XA_WM_NAME, str);
+  set_mbstring_property (XA_WM_NAME, str);
 #if ENABLE_EWMH
   set_utf8_property (xa[XA_NET_WM_NAME], str);
 #endif
@@ -784,7 +796,7 @@ rxvt_term::set_title (const char *str)
 void
 rxvt_term::set_icon_name (const char *str)
 {
-  set_string_property (XA_WM_ICON_NAME, str);
+  set_mbstring_property (XA_WM_ICON_NAME, str);
 #if ENABLE_EWMH
   set_utf8_property (xa[XA_NET_WM_ICON_NAME], str);
 #endif
diff --git a/src/rxvt.h b/src/rxvt.h
index 9a3c1c83722e06007d484d1a17324b4d7eb5ebd0..
index ..915ae0639106443e07262d63836ec3c9736dd080 100644
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -1310,6 +1310,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
   void window_calc (unsigned int newwidth, unsigned int newheight);
   bool set_fonts ();
   void set_string_property (Atom prop, const char *str, int len = -1);
+  void set_mbstring_property (Atom prop, const char *str, int len = -1);
   void set_utf8_property (Atom prop, const char *str, int len = -1);
   void set_title (const char *str);
   void set_icon_name (const char *str);

-----END OF PAGE-----