summaryrefslogtreecommitdiff
path: root/libraries/qt4/patches/0180-window-role.diff
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/qt4/patches/0180-window-role.diff')
-rw-r--r--libraries/qt4/patches/0180-window-role.diff101
1 files changed, 101 insertions, 0 deletions
diff --git a/libraries/qt4/patches/0180-window-role.diff b/libraries/qt4/patches/0180-window-role.diff
new file mode 100644
index 0000000000..687e11cb11
--- /dev/null
+++ b/libraries/qt4/patches/0180-window-role.diff
@@ -0,0 +1,101 @@
+qt-bugs@ issue : 167704
+Trolltech task ID : 168283 (status: "fixed" for Qt 4.4.0, but effectively refused)
+bugs.kde.org number : none
+applied: no
+author: Lubos Lunak <l.lunak@kde.org>
+
+NOTE: It is suggested to apply patch #0209 as well when this patch is used.
+
+This patch uses object name as a fallback for window role if no window role
+is set explicitly using setWindowRole(). Since Qt3 always used the object
+name as the window role and most Qt3/KDE3 code is ported to call setObjectName(),
+this makes the window role set in many cases (which KWin uses for window identifying).
+
+
+--- src/corelib/kernel/qobject.cpp.sav 2008-02-22 09:03:40.000000000 +0100
++++ src/corelib/kernel/qobject.cpp 2008-02-23 16:15:51.000000000 +0100
+@@ -1016,9 +1016,18 @@ void QObject::setObjectName(const QStrin
+ {
+ Q_D(QObject);
+ d->objectName = name;
++#if defined(Q_WS_X11)
++ d->checkWindowRole();
++#endif
+ }
+
+
++#if defined(Q_WS_X11)
++void QObjectPrivate::checkWindowRole()
++{
++}
++#endif
++
+ #ifdef QT3_SUPPORT
+ /*! \internal
+ QObject::child is compat but needs to call itself recursively,
+--- src/corelib/kernel/qobject_p.h.sav 2008-02-22 09:23:44.000000000 +0100
++++ src/corelib/kernel/qobject_p.h 2008-02-23 16:16:46.000000000 +0100
+@@ -148,6 +148,9 @@ public:
+ mutable quint32 connectedSignals;
+
+ QString objectName;
++#if defined(Q_WS_X11)
++ virtual void checkWindowRole();
++#endif
+
+ // Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions
+ struct Connection
+--- src/gui/kernel/qwidget_p.h.sav 2008-02-22 09:04:04.000000000 +0100
++++ src/gui/kernel/qwidget_p.h 2008-02-23 16:17:07.000000000 +0100
+@@ -324,6 +324,7 @@ public:
+
+ #if defined(Q_WS_X11)
+ void setWindowRole();
++ virtual void checkWindowRole();
+ void sendStartupMessage(const char *message) const;
+ void setNetWmWindowTypes();
+ #endif
+--- src/gui/kernel/qwidget_x11.cpp.sav 2008-02-23 15:28:47.000000000 +0100
++++ src/gui/kernel/qwidget_x11.cpp 2008-02-23 16:31:47.000000000 +0100
+@@ -710,13 +710,17 @@ void QWidgetPrivate::create_sys(WId wind
+
+
+ // declare the widget's window role
++ QByteArray windowRole;
+ if (QTLWExtra *topData = maybeTopData()) {
+- if (!topData->role.isEmpty()) {
+- QByteArray windowRole = topData->role.toUtf8();
+- XChangeProperty(dpy, id,
+- ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace,
+- (unsigned char *)windowRole.constData(), windowRole.length());
+- }
++ if (!topData->role.isEmpty())
++ windowRole = topData->role.toUtf8();
++ }
++ if (windowRole.isEmpty()) // use object name as a fallback
++ windowRole = objectName.toUtf8();
++ if (!windowRole.isEmpty()) {
++ XChangeProperty(dpy, id,
++ ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace,
++ (unsigned char *)windowRole.constData(), windowRole.length());
+ }
+
+ // set client leader property
+@@ -2852,6 +2856,17 @@ void QWidgetPrivate::setWindowRole()
+ (unsigned char *)windowRole.constData(), windowRole.length());
+ }
+
++void QWidgetPrivate::checkWindowRole()
++{
++ Q_Q(QWidget);
++ if( !q->windowRole().isEmpty() || !q->internalWinId())
++ return;
++ QByteArray windowRole = objectName.toUtf8(); // use as a fallback
++ XChangeProperty(X11->display, q->internalWinId(),
++ ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace,
++ (unsigned char *)windowRole.constData(), windowRole.length());
++}
++
+ Q_GLOBAL_STATIC(QX11PaintEngine, qt_widget_paintengine)
+ QPaintEngine *QWidget::paintEngine() const
+ {