[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Update titles correctly for clients without WM_NAME.



See the attached patch.

-- 
http://www.the-compiler.org | me _at_ the _minus_ compiler _dot_ org (Mail/XMPP)
             GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
From 1abda6608bb3ced7d01000b6194e68a8f08f827f Mon Sep 17 00:00:00 2001
From: Florian Bruhin <git _at_ the _minus_ compiler _dot_ org>
Date: Mon, 27 Oct 2014 19:26:44 +0100
Subject: [PATCH] Update titles correctly for clients without WM_NAME.

This fixes updating of titles for clients which only have _NET_WM_NAME set, but
not WM_NAME, e.g. everything using Qt5.

Related issues and discussion:

https://github.com/herbstluftwm/herbstluftwm/issues/35
https://bugreports.qt-project.org/browse/QTBUG-42209
https://mail.gnome.org/archives/wm-spec-list/2014-October/msg00000.html

Fixes #35.
---
 src/main.cpp | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index aa5dfd3..b1833c7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -938,21 +938,15 @@ void propertynotify(XEvent* event) {
         if (is_ipc_connectable(event->xproperty.window)) {
             ipc_handle_connection(event->xproperty.window);
         } else if((client = get_client_from_window(ev->window))) {
-            switch (ev->atom) {
-                case XA_WM_HINTS:
-                    client_update_wm_hints(client);
-                    break;
-                case XA_WM_NORMAL_HINTS: {
-                    updatesizehints(client);
-                    HSMonitor* m = find_monitor_with_tag(client->tag);
-                    if (m) monitor_apply_layout(m);
-                    break;
-                }
-                case XA_WM_NAME:
-                    client_update_title(client);
-                    break;
-                default:
-                    break;
+            if (ev->atom == XA_WM_HINTS) {
+                client_update_wm_hints(client);
+            } else if (ev->atom == XA_WM_NORMAL_HINTS) {
+                updatesizehints(client);
+                HSMonitor* m = find_monitor_with_tag(client->tag);
+                if (m) monitor_apply_layout(m);
+            } else if (ev->atom == XA_WM_NAME ||
+                       ev->atom == g_netatom[NetWmName]) {
+                client_update_title(client);
             }
         }
     }
-- 
2.1.2

Attachment: pgp1qwnLnP15a.pgp
Description: PGP signature