]>
Commit | Line | Data |
---|---|---|
a0850133 AM |
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 | |
5 | #endif | |
6 | #endif // QT_NO_XSYNC | |
7 | ||
8 | +struct qt_configure_event_data | |
9 | +{ | |
10 | + WId window; | |
11 | + WId parent; | |
12 | +}; | |
13 | + | |
14 | +static Bool qt_configure_event_scanner(Display*, XEvent *event, XPointer arg) | |
15 | +{ | |
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) { | |
20 | + return true; | |
21 | + } else if (event->type == ReparentNotify && | |
22 | + event->xreparent.window == data->window) { | |
23 | + data->parent = event->xreparent.parent; | |
24 | + } | |
25 | + | |
26 | + return false; | |
27 | +} | |
28 | + | |
29 | static void qt_x11_create_intern_atoms() | |
30 | { | |
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 | |
35 | XEvent otherEvent; | |
36 | - while (XCheckTypedWindowEvent(X11->display, internalWinId(), ConfigureNotify, | |
37 | - &otherEvent)) { | |
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)) | |
44 | continue; | |
45 | ||
46 | @@ -5316,13 +5340,19 @@ bool QETWidget::translateConfigEvent(con | |
47 | newSize.setWidth(otherEvent.xconfigure.width); | |
48 | newSize.setHeight(otherEvent.xconfigure.height); | |
49 | ||
50 | + trust = isVisible() | |
51 | + && (configureData.parent == XNone || | |
52 | + configureData.parent == QX11Info::appRootWindow()); | |
53 | + | |
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; | |
59 | isCPos = true; | |
60 | - } | |
61 | + } else { | |
62 | + isCPos = false; | |
63 | + } | |
64 | } | |
65 | #ifndef QT_NO_XSYNC | |
66 | qt_sync_request_event_data sync_event; | |
67 | @@ -5335,9 +5365,14 @@ bool QETWidget::translateConfigEvent(con | |
68 | } | |
69 | ||
70 | if (!isCPos) { | |
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: | |
76 | + // | |
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. | |
81 | + | |
82 | int x, y; | |
83 | Window child; | |
84 | XTranslateCoordinates(X11->display, internalWinId(), |