1
commit d1bc2ccddbaf839f0d96c97ea60427c3f92b9433
2
Author: Albert Astals Cid <aacid@kde.org>
3
Date: Thu Feb 2 17:44:38 2012 +0100
5
Take into account shaping in findRealWindow
7
It can happen that there is a window covering all the screen but it is shaped
8
to only take part of the screen. If that happens, besides the condition of
9
QRect(attr.x,attr.y,attr.width,attr.height).contains(pos)
10
we also need to query the server for its region rectangles and make
11
sure the cursor is inside one of those rectangles. If that does not happen
12
we have to return 0 so the hierarchical XQueryTree search continues
14
Change-Id: Icb2204a50197e4a5e02e75601c67287525b290b0
16
Index: qt4-x11-4.8.0/src/gui/kernel/qapplication_x11.cpp
17
===================================================================
18
--- qt4-x11-4.8.0.orig/src/gui/kernel/qapplication_x11.cpp 2012-02-06 19:41:49.638872063 +0000
19
+++ qt4-x11-4.8.0/src/gui/kernel/qapplication_x11.cpp 2012-02-06 19:41:50.518872089 +0000
21
X11->ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion);
22
X11->ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName);
23
X11->ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput);
24
+ X11->ptrXFixesCreateRegionFromWindow = XFIXES_LOAD_V2(XFixesCreateRegionFromWindow);
25
+ X11->ptrXFixesFetchRegion = XFIXES_LOAD_V2(XFixesFetchRegion);
26
+ X11->ptrXFixesDestroyRegion = XFIXES_LOAD_V2(XFixesDestroyRegion);
28
if(X11->ptrXFixesQueryExtension && X11->ptrXFixesQueryVersion
29
&& X11->ptrXFixesQueryExtension(X11->display, &X11->xfixes_eventbase,
30
Index: qt4-x11-4.8.0/src/gui/kernel/qdnd_x11.cpp
31
===================================================================
32
--- qt4-x11-4.8.0.orig/src/gui/kernel/qdnd_x11.cpp 2011-12-08 05:06:02.000000000 +0000
33
+++ qt4-x11-4.8.0/src/gui/kernel/qdnd_x11.cpp 2012-02-06 19:41:50.522872089 +0000
35
#include "qwidget_p.h"
36
#include "qcursor_p.h"
39
+#include <X11/extensions/Xfixes.h>
47
if (attr.map_state == IsViewable
48
&& QRect(attr.x,attr.y,attr.width,attr.height).contains(pos)) {
49
+ bool windowContainsMouse = true;
53
@@ -1441,8 +1446,26 @@
54
XGetWindowProperty(X11->display, w, ATOM(XdndAware), 0, 0, False,
55
AnyPropertyType, &type, &f,&n,&a,&data);
56
if (data) XFree(data);
61
+ if (X11->use_xfixes && X11->ptrXFixesCreateRegionFromWindow && X11->ptrXFixesFetchRegion && X11->ptrXFixesDestroyRegion) {
62
+ XserverRegion region = X11->ptrXFixesCreateRegionFromWindow(X11->display, w, WindowRegionBounding);
64
+ XRectangle *rectangles = X11->ptrXFixesFetchRegion(X11->display, region, &nrectanglesRet);
66
+ windowContainsMouse = false;
67
+ for (int i = 0; !windowContainsMouse && i < nrectanglesRet; ++i)
68
+ windowContainsMouse = QRect(rectangles[i].x, rectangles[i].y, rectangles[i].width, rectangles[i].height).contains(pos);
71
+ X11->ptrXFixesDestroyRegion(X11->display, region);
73
+ if (windowContainsMouse)
82
@@ -1463,7 +1486,10 @@
87
+ if (!windowContainsMouse)
94
Index: qt4-x11-4.8.0/src/gui/kernel/qt_x11_p.h
95
===================================================================
96
--- qt4-x11-4.8.0.orig/src/gui/kernel/qt_x11_p.h 2012-02-06 19:41:49.642872065 +0000
97
+++ qt4-x11-4.8.0/src/gui/kernel/qt_x11_p.h 2012-02-06 19:41:50.918872098 +0000
99
typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *);
100
typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name);
101
typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask);
102
+typedef void (*PtrXFixesDestroyRegion)(Display *dpy, /*XserverRegion*/ XID region);
103
+typedef /*XserverRegion*/ XID (*PtrXFixesCreateRegionFromWindow)(Display *dpy, Window window, int kind);
104
+typedef XRectangle *(*PtrXFixesFetchRegion)(Display *dpy, /*XserverRegion*/ XID region, int *nrectanglesRet);
105
#endif // QT_NO_XFIXES
107
#ifndef QT_NO_XCURSOR
109
PtrXFixesQueryVersion ptrXFixesQueryVersion;
110
PtrXFixesSetCursorName ptrXFixesSetCursorName;
111
PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput;
112
+ PtrXFixesDestroyRegion ptrXFixesDestroyRegion;
113
+ PtrXFixesCreateRegionFromWindow ptrXFixesCreateRegionFromWindow;
114
+ PtrXFixesFetchRegion ptrXFixesFetchRegion;