summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-04 14:42:02 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-08 10:07:15 (GMT)
commited4c28b08412211bf547340a05ca4bd987b4fbf7 (patch)
tree01ca5e6413ae32a62db9d19a63db5e5509a5369b
parentae25e6be41aaba90507022d792e2defcaf4cbfb6 (diff)
downloadQt-ed4c28b08412211bf547340a05ca4bd987b4fbf7.zip
Qt-ed4c28b08412211bf547340a05ca4bd987b4fbf7.tar.gz
Qt-ed4c28b08412211bf547340a05ca4bd987b4fbf7.tar.bz2
Fixed mapFromGlobal in some window managers on X11
The previous mapFromGlobal optimization in cdd776a91e65bf5c30cea1bab9823134a3f797d0 broke behavior in some window managers like metacity when resizing by dragging the top-left corner. Most likely it is a bad behaviour of the window manager (according to ICCCM 4.1.5 we should get a ConfigureNotify event with x and y in root coordinates if you consider this is a "movement" of a window). Reviewed-by: Olivier Goffart
-rw-r--r--src/gui/kernel/qapplication_x11.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 823f1b1..2fdad8d 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -5227,14 +5227,15 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
bool trust = isVisible()
&& (d->topData()->parentWinId == XNone ||
d->topData()->parentWinId == QX11Info::appRootWindow());
+ bool isCPos = false;
if (event->xconfigure.send_event || trust) {
// if a ConfigureNotify comes from a real sendevent request, we can
// trust its values.
newCPos.rx() = event->xconfigure.x + event->xconfigure.border_width;
newCPos.ry() = event->xconfigure.y + event->xconfigure.border_width;
+ isCPos = true;
}
-
if (isVisible())
QApplication::syncX();
@@ -5260,6 +5261,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
otherEvent.xconfigure.border_width;
newCPos.ry() = otherEvent.xconfigure.y +
otherEvent.xconfigure.border_width;
+ isCPos = true;
}
}
#ifndef QT_NO_XSYNC
@@ -5272,6 +5274,19 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
#endif // QT_NO_XSYNC
}
+ if (!isCPos) {
+ // we didn't get an updated position of the toplevel.
+ // either we haven't moved or there is a bug in the window manager.
+ // anyway, let's query the position to be certain.
+ int x, y;
+ Window child;
+ XTranslateCoordinates(X11->display, internalWinId(),
+ QApplication::desktop()->screen(d->xinfo.screen())->internalWinId(),
+ 0, 0, &x, &y, &child);
+ newCPos.rx() = x;
+ newCPos.ry() = y;
+ }
+
QRect cr (geometry());
if (newCPos != cr.topLeft()) { // compare with cpos (exluding frame)
QPoint oldPos = geometry().topLeft();