summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qapplication_x11.cpp6
-rw-r--r--src/gui/kernel/qdnd_x11.cpp36
-rw-r--r--src/gui/kernel/qt_x11_p.h3
3 files changed, 19 insertions, 26 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 4d642a9..7460fa0 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -2062,9 +2062,6 @@ void qt_init(QApplicationPrivate *priv, int,
X11->ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion);
X11->ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName);
X11->ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput);
- X11->ptrXFixesCreateRegionFromWindow = XFIXES_LOAD_V2(XFixesCreateRegionFromWindow);
- X11->ptrXFixesFetchRegion = XFIXES_LOAD_V2(XFixesFetchRegion);
- X11->ptrXFixesDestroyRegion = XFIXES_LOAD_V2(XFixesDestroyRegion);
if(X11->ptrXFixesQueryExtension && X11->ptrXFixesQueryVersion
&& X11->ptrXFixesQueryExtension(X11->display, &X11->xfixes_eventbase,
@@ -2087,9 +2084,6 @@ void qt_init(QApplicationPrivate *priv, int,
X11->ptrXFixesQueryVersion = 0;
X11->ptrXFixesSetCursorName = 0;
X11->ptrXFixesSelectSelectionInput = 0;
- X11->ptrXFixesCreateRegionFromWindow = 0;
- X11->ptrXFixesFetchRegion = 0;
- X11->ptrXFixesDestroyRegion = 0;
}
#endif // QT_NO_XFIXES
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index d2050d1..c4d2469 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1423,6 +1423,21 @@ void QDragManager::cancel(bool deleteSource)
}
static
+bool windowInteractsWithPosition(const QPoint & pos, Window w, int shapeType)
+{
+ int nrectanglesRet, dummyOrdering;
+ XRectangle *rectangles = XShapeGetRectangles(QX11Info::display(), w, shapeType, &nrectanglesRet, &dummyOrdering);
+ bool interacts = true;
+ if (rectangles) {
+ interacts = false;
+ for (int i = 0; !interacts && i < nrectanglesRet; ++i)
+ interacts = QRect(rectangles[i].x, rectangles[i].y, rectangles[i].width, rectangles[i].height).contains(pos);
+ XFree(rectangles);
+ }
+ return interacts;
+}
+
+static
Window findRealWindow(const QPoint & pos, Window w, int md)
{
if (xdnd_data.deco && w == xdnd_data.deco->effectiveWinId())
@@ -1448,23 +1463,10 @@ Window findRealWindow(const QPoint & pos, Window w, int md)
AnyPropertyType, &type, &f,&n,&a,&data);
if (data) XFree(data);
if (type) {
-#ifndef QT_NO_XFIXES
- if (X11->use_xfixes && X11->ptrXFixesCreateRegionFromWindow && X11->ptrXFixesFetchRegion && X11->ptrXFixesDestroyRegion) {
- XserverRegion region = X11->ptrXFixesCreateRegionFromWindow(X11->display, w, WindowRegionBounding);
- int nrectanglesRet;
- XRectangle *rectangles = X11->ptrXFixesFetchRegion(X11->display, region, &nrectanglesRet);
- if (rectangles) {
- windowContainsMouse = false;
- for (int i = 0; !windowContainsMouse && i < nrectanglesRet; ++i)
- windowContainsMouse = QRect(rectangles[i].x, rectangles[i].y, rectangles[i].width, rectangles[i].height).contains(pos);
- XFree(rectangles);
- }
- X11->ptrXFixesDestroyRegion(X11->display, region);
-
- if (windowContainsMouse)
- return w;
- } else
-#endif
+ // When ShapeInput and ShapeBounding are not set they return a single rectangle with the geometry of the window, this is why we
+ // need an && here so that in the case one is set and the other is not we still get the correct result.
+ windowContainsMouse = windowInteractsWithPosition(pos, w, ShapeInput) && windowInteractsWithPosition(pos, w, ShapeBounding);
+ if (windowContainsMouse)
return w;
}
}
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index 579a2b3..13dc90a 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -422,9 +422,6 @@ struct QX11Data
PtrXFixesQueryVersion ptrXFixesQueryVersion;
PtrXFixesSetCursorName ptrXFixesSetCursorName;
PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput;
- PtrXFixesDestroyRegion ptrXFixesDestroyRegion;
- PtrXFixesCreateRegionFromWindow ptrXFixesCreateRegionFromWindow;
- PtrXFixesFetchRegion ptrXFixesFetchRegion;
#endif
#ifndef QT_NO_XINPUT