390b42c
From 339e220e29ff39b86705438b4be6f90e5618d27b Mon Sep 17 00:00:00 2001
390b42c
From: Lubos Lunak <l.lunak@kde.org>
390b42c
Date: Tue, 2 Oct 2007 16:08:32 +0200
390b42c
Subject: [PATCH 02/13] This patch makes override-redirect windows (popup menu, dropdown menu,
390b42c
 tooltip, combobox, etc.) also have more window properties like WM_CLASS,
390b42c
 so they can be used when compositing.
390b42c
390b42c
qt-bugs@ issue : none
390b42c
bugs.kde.org number : none
390b42c
---
390b42c
 src/gui/kernel/qwidget_x11.cpp |   21 +++++++++++++++------
390b42c
 1 files changed, 15 insertions(+), 6 deletions(-)
390b42c
390b42c
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
390b42c
index 79ee8c9..a74a849 100644
390b42c
--- a/src/gui/kernel/qwidget_x11.cpp
390b42c
+++ b/src/gui/kernel/qwidget_x11.cpp
390b42c
@@ -719,6 +719,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
390b42c
         Q_ASSERT(id);
390b42c
         XChangeWindowAttributes(dpy, id, CWOverrideRedirect | CWSaveUnder,
390b42c
                                 &wsa;;
390b42c
+        XClassHint class_hint;
390b42c
+        QByteArray appName = qAppName().toLatin1();
390b42c
+        class_hint.res_name = appName.data(); // application name
390b42c
+        class_hint.res_class = const_cast<char *>(QX11Info::appClass());   // application class
390b42c
+        XSetWMProperties(dpy, id, 0, 0, 0, 0, 0, 0, &class_hint);
390b42c
     } else if (topLevel && !desktop) {        // top-level widget
390b42c
         if (!X11->wm_client_leader)
390b42c
             create_wm_client_leader();
390b42c
@@ -769,13 +774,21 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
390b42c
         // set EWMH window types
390b42c
         setNetWmWindowTypes();
390b42c
 
390b42c
+        // when we create a toplevel widget, the frame strut should be dirty
390b42c
+        data.fstrut_dirty = 1;
390b42c
+
390b42c
+    } else {
390b42c
+        // non-toplevel widgets don't have a frame, so no need to
390b42c
+        // update the strut
390b42c
+        data.fstrut_dirty = 0;
390b42c
+    }
390b42c
+
390b42c
+    if (initializeWindow && (popup || (topLevel && !desktop))) { // properties set on all toplevel windows
390b42c
         // set _NET_WM_PID
390b42c
         long curr_pid = getpid();
390b42c
         XChangeProperty(dpy, id, ATOM(_NET_WM_PID), XA_CARDINAL, 32, PropModeReplace,
390b42c
                         (unsigned char *) &curr_pid, 1);
390b42c
 
390b42c
-        // when we create a toplevel widget, the frame strut should be dirty
390b42c
-        data.fstrut_dirty = 1;
390b42c
 
390b42c
         // declare the widget's window role
390b42c
         if (QTLWExtra *topData = maybeTopData()) {
390b42c
@@ -791,10 +804,6 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
390b42c
         XChangeProperty(dpy, id, ATOM(WM_CLIENT_LEADER),
390b42c
                         XA_WINDOW, 32, PropModeReplace,
390b42c
                         (unsigned char *)&X11->wm_client_leader, 1);
390b42c
-    } else {
390b42c
-        // non-toplevel widgets don't have a frame, so no need to
390b42c
-        // update the strut
390b42c
-        data.fstrut_dirty = 0;
390b42c
     }
390b42c
 
390b42c
     if (initializeWindow && q->internalWinId()) {
390b42c
-- 
390b42c
1.6.5.1
390b42c