qt/0002-This-patch-makes-overr...

68 lines
2.8 KiB
Diff

From 339e220e29ff39b86705438b4be6f90e5618d27b Mon Sep 17 00:00:00 2001
From: Lubos Lunak <l.lunak@kde.org>
Date: Tue, 2 Oct 2007 16:08:32 +0200
Subject: [PATCH 02/13] 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.
qt-bugs@ issue : none
bugs.kde.org number : none
---
src/gui/kernel/qwidget_x11.cpp | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 79ee8c9..a74a849 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -719,6 +719,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();
@@ -769,13 +774,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()) {
@@ -791,10 +804,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()) {
--
1.6.5.1