summaryrefslogtreecommitdiffstats
path: root/libraries/qt4/patches/0195-compositing-properties.diff
blob: 979df943662e22d828eec5007c175bf50d8c0eb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
qt-bugs@ issue : none
bugs.kde.org number : none
applied: no
author: Lubos Lunak <l.lunak@kde.org>

This patch makes override-redirect windows (popup menu, dropdown menu,
tooltip, combobox, etc.) also have more window properties like WM_CLASS,
so they can be used when compositing.

--- src/gui/kernel/qwidget_x11.cpp
+++ src/gui/kernel/qwidget_x11.cpp
@@ -637,6 +637,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
         Q_ASSERT(id);
         XChangeWindowAttributes(dpy, id, CWOverrideRedirect | CWSaveUnder,
                                 &wsa);
+        XClassHint class_hint;
+        QByteArray appName = qAppName().toLatin1();
+        class_hint.res_name = appName.data(); // application name
+        class_hint.res_class = const_cast<char *>(QX11Info::appClass());   // application class
+        XSetWMProperties(dpy, id, 0, 0, 0, 0, 0, 0, &class_hint);
     } else if (topLevel && !desktop) {        // top-level widget
         if (!X11->wm_client_leader)
             create_wm_client_leader();
@@ -685,13 +690,21 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
         // set EWMH window types
         setNetWmWindowTypes();
 
+        // when we create a toplevel widget, the frame strut should be dirty
+        data.fstrut_dirty = 1;
+
+    } else {
+        // non-toplevel widgets don't have a frame, so no need to
+        // update the strut
+        data.fstrut_dirty = 0;
+    }
+
+    if (initializeWindow && (popup || (topLevel && !desktop))) { // properties set on all toplevel windows
         // set _NET_WM_PID
         long curr_pid = getpid();
         XChangeProperty(dpy, id, ATOM(_NET_WM_PID), XA_CARDINAL, 32, PropModeReplace,
                         (unsigned char *) &curr_pid, 1);
 
-        // when we create a toplevel widget, the frame strut should be dirty
-        data.fstrut_dirty = 1;
 
         // declare the widget's window role
         if (QTLWExtra *topData = maybeTopData()) {
@@ -707,10 +720,6 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
         XChangeProperty(dpy, id, ATOM(WM_CLIENT_LEADER),
                         XA_WINDOW, 32, PropModeReplace,
                         (unsigned char *)&X11->wm_client_leader, 1);
-    } else {
-        // non-toplevel widgets don't have a frame, so no need to
-        // update the strut
-        data.fstrut_dirty = 0;
     }
 
     if (initializeWindow && q->internalWinId()) {