]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Completely ignore legacy hints as soon as the client uses _NET_WM_NAME
authorMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 12 Mar 2009 15:44:44 +0000 (16:44 +0100)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 12 Mar 2009 15:44:44 +0000 (16:44 +0100)
include/data.h
src/handlers.c

index 5c4bfb0adab4313391d846b3f239675a8ec0a09c..21ea722eaba89f471711666059983713f6fb27b8 100644 (file)
@@ -228,6 +228,9 @@ struct Client {
            to X as 8-bit string and therefore will not be rendered correctly. This behaviour is
            to support legacy applications which do not set _NET_WM_NAME */
         int name_len;
+        /* This will be set to true as soon as the first _NET_WM_NAME comes in. If set to true,
+           legacy window names are ignored. */
+        bool uses_net_wm_name;
 
         /* fullscreen is pretty obvious */
         bool fullscreen;
index 8ab8ac4dabdb4b5121e46826e71f528b7fff3f10..8278a89a872bf81ae09ddaceec74df100192b683 100644 (file)
@@ -616,6 +616,7 @@ int handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t state,
         char *old_name = client->name;
         client->name = ucs2_name;
         client->name_len = new_len;
+        client->uses_net_wm_name = true;
 
         if (old_name != NULL)
                 free(old_name);
@@ -646,7 +647,7 @@ int handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t state,
 int handle_windowname_change_legacy(void *data, xcb_connection_t *conn, uint8_t state,
                                 xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
         LOG("window's name changed (legacy).\n");
-        if (prop == NULL) {
+        if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
                 LOG("prop == NULL\n");
                 return 1;
         }
@@ -654,6 +655,11 @@ int handle_windowname_change_legacy(void *data, xcb_connection_t *conn, uint8_t
         if (client == NULL)
                 return 1;
 
+        if (client->uses_net_wm_name) {
+                LOG("This client is capable of _NET_WM_NAME, ignoring legacy name\n");
+                return 1;
+        }
+
         /* Save the old pointer to make the update atomic */
         char *new_name;
         int new_len;