Search
j0ke.net Open Build Service
>
Projects
>
KDE
:
Qt
:
STABLE
>
libQtWebKit-devel
> 0180-window-role.diff
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0180-window-role.diff of Package libQtWebKit-devel
commit c119289d63c7357c515c9ecf8f79393c806364b2 Author: Lubos Lunak <l.lunak@kde.org> Date: Sat Feb 23 16:44:52 2008 +0100 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). NOTE: It is suggested to apply patch #0209 as well when this patch is used. qt-bugs@ issue : 167704 Trolltech task ID : 168283 (status: "fixed" for Qt 4.4.0, but effectively refused) Index: src/corelib/kernel/qobject.cpp =================================================================== --- src/corelib/kernel/qobject.cpp.orig +++ src/corelib/kernel/qobject.cpp @@ -1136,8 +1136,16 @@ 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 Index: src/corelib/kernel/qobject_p.h =================================================================== --- src/corelib/kernel/qobject_p.h.orig +++ src/corelib/kernel/qobject_p.h @@ -157,6 +157,9 @@ public: void sendPendingChildInsertedEvents(); void removePendingChildInsertedEvents(QObject *child); #endif +#if defined(Q_WS_X11) + virtual void checkWindowRole(); +#endif static Sender *setCurrentSender(QObject *receiver, Sender *sender); Index: src/gui/kernel/qwidget_p.h =================================================================== --- src/gui/kernel/qwidget_p.h.orig +++ src/gui/kernel/qwidget_p.h @@ -661,6 +661,7 @@ public: static QWidget *keyboardGrabber; void setWindowRole(); + virtual void checkWindowRole(); void sendStartupMessage(const char *message) const; void setNetWmWindowTypes(); void x11UpdateIsOpaque(); Index: src/gui/kernel/qwidget_x11.cpp =================================================================== --- src/gui/kernel/qwidget_x11.cpp.orig +++ src/gui/kernel/qwidget_x11.cpp @@ -838,13 +838,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 @@ -2926,6 +2930,17 @@ void QWidgetPrivate::setWindowRole() XChangeProperty(X11->display, q->internalWinId(), ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace, (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)