Blame SOURCES/qt-everywhere-opensource-src-4.8.5-QTBUG-21900.patch

01fa84
diff -up qt-everywhere-opensource-src-4.8.5/src/gui/kernel/qapplication_x11.cpp.QTBUG-21900 qt-everywhere-opensource-src-4.8.5/src/gui/kernel/qapplication_x11.cpp
01fa84
--- qt-everywhere-opensource-src-4.8.5/src/gui/kernel/qapplication_x11.cpp.QTBUG-21900	2013-05-30 16:18:05.000000000 -0500
01fa84
+++ qt-everywhere-opensource-src-4.8.5/src/gui/kernel/qapplication_x11.cpp	2013-06-09 11:53:45.891771748 -0500
01fa84
@@ -818,6 +818,27 @@ static Bool qt_sync_request_scanner(Disp
01fa84
 #endif
01fa84
 #endif // QT_NO_XSYNC
01fa84
 
01fa84
+struct qt_configure_event_data
01fa84
+{
01fa84
+    WId window;
01fa84
+    WId parent;
01fa84
+};
01fa84
+
01fa84
+static Bool qt_configure_event_scanner(Display*, XEvent *event, XPointer arg)
01fa84
+{
01fa84
+    qt_configure_event_data *data =
01fa84
+        reinterpret_cast<qt_configure_event_data*>(arg);
01fa84
+    if (event->type == ConfigureNotify &&
01fa84
+        event->xconfigure.window == data->window) {
01fa84
+        return true;
01fa84
+    } else if (event->type == ReparentNotify &&
01fa84
+               event->xreparent.window == data->window) {
01fa84
+        data->parent = event->xreparent.parent;
01fa84
+    }
01fa84
+
01fa84
+    return false;
01fa84
+}
01fa84
+
01fa84
 static void qt_x11_create_intern_atoms()
01fa84
 {
01fa84
     const char *names[QX11Data::NAtoms];
01fa84
@@ -5302,8 +5323,11 @@ bool QETWidget::translateConfigEvent(con
01fa84
         if (d->extra->compress_events) {
01fa84
             // ConfigureNotify compression for faster opaque resizing
01fa84
             XEvent otherEvent;
01fa84
-            while (XCheckTypedWindowEvent(X11->display, internalWinId(), ConfigureNotify,
01fa84
-                                          &otherEvent)) {
01fa84
+            qt_configure_event_data configureData;
01fa84
+            configureData.window = internalWinId();
01fa84
+            configureData.parent = d->topData()->parentWinId;
01fa84
+            while (XCheckIfEvent(X11->display, &otherEvent,
01fa84
+                                 &qt_configure_event_scanner, (XPointer)&configureData)) {
01fa84
                 if (qt_x11EventFilter(&otherEvent))
01fa84
                     continue;
01fa84
 
01fa84
@@ -5316,13 +5340,19 @@ bool QETWidget::translateConfigEvent(con
01fa84
                 newSize.setWidth(otherEvent.xconfigure.width);
01fa84
                 newSize.setHeight(otherEvent.xconfigure.height);
01fa84
 
01fa84
+                trust = isVisible()
01fa84
+                        && (configureData.parent == XNone ||
01fa84
+                            configureData.parent == QX11Info::appRootWindow());
01fa84
+
01fa84
                 if (otherEvent.xconfigure.send_event || trust) {
01fa84
                     newCPos.rx() = otherEvent.xconfigure.x +
01fa84
                                    otherEvent.xconfigure.border_width;
01fa84
                     newCPos.ry() = otherEvent.xconfigure.y +
01fa84
                                    otherEvent.xconfigure.border_width;
01fa84
                     isCPos = true;
01fa84
-                }
01fa84
+                } else {
01fa84
+                    isCPos = false;
01fa84
+               }
01fa84
             }
01fa84
 #ifndef QT_NO_XSYNC
01fa84
             qt_sync_request_event_data sync_event;
01fa84
@@ -5335,9 +5365,14 @@ bool QETWidget::translateConfigEvent(con
01fa84
         }
01fa84
 
01fa84
         if (!isCPos) {
01fa84
-            // we didn't get an updated position of the toplevel.
01fa84
-            // either we haven't moved or there is a bug in the window manager.
01fa84
-            // anyway, let's query the position to be certain.
01fa84
+            // If the last configure event didn't have a trustable position,
01fa84
+            // it's necessary to query, see ICCCM 4.24:
01fa84
+            //
01fa84
+            //  Any real ConfigureNotify event on a top-level window implies
01fa84
+            //  that the window’s position on the root may have changed, even
01fa84
+            //  though the event reports that the window’s position in its
01fa84
+            //  parent is unchanged because the window may have been reparented.
01fa84
+
01fa84
             int x, y;
01fa84
             Window child;
01fa84
             XTranslateCoordinates(X11->display, internalWinId(),