]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - qt/patches/qt-everywhere-opensource-src-4.8.0-QTBUG-21900.patch
python3-cairo: New package.
[people/ms/ipfire-3.x.git] / qt / patches / qt-everywhere-opensource-src-4.8.0-QTBUG-21900.patch
1 From a91e9dd202640598d8dec091c67ec94536390e7f Mon Sep 17 00:00:00 2001
2 From: "Owen W. Taylor" <otaylor@fishsoup.net>
3 Date: Mon, 17 Oct 2011 17:27:43 -0400
4 Subject: [PATCH] Fix logic for figuring out what ConfigureNotify positions
5 can be trusted
6
7 When reading ahead in the queue for ConfigureNotify events, it's necessary
8 to look for intermediate ReparentNotify events as well, since they will
9 determine whether the position in the event can be trusted or not.
10 ---
11 src/gui/kernel/qapplication_x11.cpp | 47 ++++++++++++++++++++++++++++++----
12 1 files changed, 41 insertions(+), 6 deletions(-)
13
14 diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
15 index 408e9ac..3a1d3eb 100644
16 --- a/src/gui/kernel/qapplication_x11.cpp
17 +++ b/src/gui/kernel/qapplication_x11.cpp
18 @@ -816,6 +816,27 @@ static Bool qt_sync_request_scanner(Display*, XEvent *event, XPointer arg)
19 #endif
20 #endif // QT_NO_XSYNC
21
22 +struct qt_configure_event_data
23 +{
24 + WId window;
25 + WId parent;
26 +};
27 +
28 +static Bool qt_configure_event_scanner(Display*, XEvent *event, XPointer arg)
29 +{
30 + qt_configure_event_data *data =
31 + reinterpret_cast<qt_configure_event_data*>(arg);
32 + if (event->type == ConfigureNotify &&
33 + event->xconfigure.window == data->window) {
34 + return true;
35 + } else if (event->type == ReparentNotify &&
36 + event->xreparent.window == data->window) {
37 + data->parent = event->xreparent.parent;
38 + }
39 +
40 + return false;
41 +}
42 +
43 static void qt_x11_create_intern_atoms()
44 {
45 const char *names[QX11Data::NAtoms];
46 @@ -5273,8 +5294,11 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
47 if (d->extra->compress_events) {
48 // ConfigureNotify compression for faster opaque resizing
49 XEvent otherEvent;
50 - while (XCheckTypedWindowEvent(X11->display, internalWinId(), ConfigureNotify,
51 - &otherEvent)) {
52 + qt_configure_event_data configureData;
53 + configureData.window = internalWinId();
54 + configureData.parent = d->topData()->parentWinId;
55 + while (XCheckIfEvent(X11->display, &otherEvent,
56 + &qt_configure_event_scanner, (XPointer)&configureData)) {
57 if (qt_x11EventFilter(&otherEvent))
58 continue;
59
60 @@ -5287,13 +5311,19 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
61 newSize.setWidth(otherEvent.xconfigure.width);
62 newSize.setHeight(otherEvent.xconfigure.height);
63
64 + trust = isVisible()
65 + && (configureData.parent == XNone ||
66 + configureData.parent == QX11Info::appRootWindow());
67 +
68 if (otherEvent.xconfigure.send_event || trust) {
69 newCPos.rx() = otherEvent.xconfigure.x +
70 otherEvent.xconfigure.border_width;
71 newCPos.ry() = otherEvent.xconfigure.y +
72 otherEvent.xconfigure.border_width;
73 isCPos = true;
74 - }
75 + } else {
76 + isCPos = false;
77 + }
78 }
79 #ifndef QT_NO_XSYNC
80 qt_sync_request_event_data sync_event;
81 @@ -5306,9 +5336,14 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
82 }
83
84 if (!isCPos) {
85 - // we didn't get an updated position of the toplevel.
86 - // either we haven't moved or there is a bug in the window manager.
87 - // anyway, let's query the position to be certain.
88 + // If the last configure event didn't have a trustable position,
89 + // it's necessary to query, see ICCCM 4.24:
90 + //
91 + // Any real ConfigureNotify event on a top-level window implies
92 + // that the window’s position on the root may have changed, even
93 + // though the event reports that the window’s position in its
94 + // parent is unchanged because the window may have been reparented.
95 +
96 int x, y;
97 Window child;
98 XTranslateCoordinates(X11->display, internalWinId(),
99 --
100 1.7.6.4
101