1 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
2 --- qt-everywhere-opensource-src-4.8.5/src/gui/kernel/qapplication_x11.cpp.QTBUG-21900 2013-05-30 16:18:05.000000000 -0500
3 +++ qt-everywhere-opensource-src-4.8.5/src/gui/kernel/qapplication_x11.cpp 2013-06-09 11:53:45.891771748 -0500
4 @@ -818,6 +818,27 @@ static Bool qt_sync_request_scanner(Disp
8 +struct qt_configure_event_data
14 +static Bool qt_configure_event_scanner(Display*, XEvent *event, XPointer arg)
16 + qt_configure_event_data *data =
17 + reinterpret_cast<qt_configure_event_data*>(arg);
18 + if (event->type == ConfigureNotify &&
19 + event->xconfigure.window == data->window) {
21 + } else if (event->type == ReparentNotify &&
22 + event->xreparent.window == data->window) {
23 + data->parent = event->xreparent.parent;
29 static void qt_x11_create_intern_atoms()
31 const char *names[QX11Data::NAtoms];
32 @@ -5302,8 +5323,11 @@ bool QETWidget::translateConfigEvent(con
33 if (d->extra->compress_events) {
34 // ConfigureNotify compression for faster opaque resizing
36 - while (XCheckTypedWindowEvent(X11->display, internalWinId(), ConfigureNotify,
38 + qt_configure_event_data configureData;
39 + configureData.window = internalWinId();
40 + configureData.parent = d->topData()->parentWinId;
41 + while (XCheckIfEvent(X11->display, &otherEvent,
42 + &qt_configure_event_scanner, (XPointer)&configureData)) {
43 if (qt_x11EventFilter(&otherEvent))
46 @@ -5316,13 +5340,19 @@ bool QETWidget::translateConfigEvent(con
47 newSize.setWidth(otherEvent.xconfigure.width);
48 newSize.setHeight(otherEvent.xconfigure.height);
51 + && (configureData.parent == XNone ||
52 + configureData.parent == QX11Info::appRootWindow());
54 if (otherEvent.xconfigure.send_event || trust) {
55 newCPos.rx() = otherEvent.xconfigure.x +
56 otherEvent.xconfigure.border_width;
57 newCPos.ry() = otherEvent.xconfigure.y +
58 otherEvent.xconfigure.border_width;
66 qt_sync_request_event_data sync_event;
67 @@ -5335,9 +5365,14 @@ bool QETWidget::translateConfigEvent(con
71 - // we didn't get an updated position of the toplevel.
72 - // either we haven't moved or there is a bug in the window manager.
73 - // anyway, let's query the position to be certain.
74 + // If the last configure event didn't have a trustable position,
75 + // it's necessary to query, see ICCCM 4.24:
77 + // Any real ConfigureNotify event on a top-level window implies
78 + // that the window’s position on the root may have changed, even
79 + // though the event reports that the window’s position in its
80 + // parent is unchanged because the window may have been reparented.
84 XTranslateCoordinates(X11->display, internalWinId(),