diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-27 09:20:34 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-27 09:34:03 (GMT) |
commit | e83fce3f50f646fa1d3daf6dabffa47045290a44 (patch) | |
tree | 3ce4b5b9ad04a78987e38679600093040f0a76ca /src/gui/kernel | |
parent | 9508cfea4731f86664794455c4d3571e41e180fd (diff) | |
download | Qt-e83fce3f50f646fa1d3daf6dabffa47045290a44.zip Qt-e83fce3f50f646fa1d3daf6dabffa47045290a44.tar.gz Qt-e83fce3f50f646fa1d3daf6dabffa47045290a44.tar.bz2 |
Creating an instance of the QDesktopWidget breaks clipboard on X11.
On X11 when user manually creates a QDesktopWidget object it breaks
notifications from the root window since we have several
QDesktopWidgets that have the same native window id and the
wid->qwidget mapper (QWidgetPrivate::mapper) goes crazy. So whenever
we get x11 event from the root window we cannot find a qwidget that
corresponds to the window id and discard these events.
Reviewed-by: Brad
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 06810e0..dcb48cc 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -164,6 +164,7 @@ static inline bool bypassGraphicsProxyWidget(QWidget *p) #endif extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp +extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version), extra(0), focus_child(0) @@ -1400,7 +1401,13 @@ int QWidgetPrivate::maxInstances = 0; // Maximum number of widget instances void QWidgetPrivate::setWinId(WId id) // set widget identifier { Q_Q(QWidget); - if (mapper && data.winid) { + // the user might create a widget with Qt::Desktop window + // attribute (or create another QDesktopWidget instance), which + // will have the same windowid (the root window id) as the + // qt_desktopWidget. We should not add the second desktop widget + // to the mapper. + bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop; + if (mapper && data.winid && !userDesktopWidget) { mapper->remove(data.winid); uncreatedWidgets->insert(q); } @@ -1409,7 +1416,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier #if defined(Q_WS_X11) hd = id; // X11: hd == ident #endif - if (mapper && id) { + if (mapper && id && !userDesktopWidget) { mapper->insert(data.winid, q); uncreatedWidgets->remove(q); } |