summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qdnd_x11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qdnd_x11.cpp')
-rw-r--r--src/gui/kernel/qdnd_x11.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index b312d7e..e3d5391 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1427,9 +1427,8 @@ bool windowInteractsWithPosition(const QPoint & pos, Window w, int shapeType)
{
int nrectanglesRet, dummyOrdering;
XRectangle *rectangles = XShapeGetRectangles(QX11Info::display(), w, shapeType, &nrectanglesRet, &dummyOrdering);
- bool interacts = true;
+ bool interacts = false;
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);
@@ -1438,7 +1437,7 @@ bool windowInteractsWithPosition(const QPoint & pos, Window w, int shapeType)
}
static
-Window findRealWindow(const QPoint & pos, Window w, int md)
+Window findRealWindow(const QPoint & pos, Window w, int md, bool ignoreNonXdndAwareWindows)
{
if (xdnd_data.deco && w == xdnd_data.deco->effectiveWinId())
return 0;
@@ -1452,7 +1451,7 @@ Window findRealWindow(const QPoint & pos, Window w, int md)
if (attr.map_state == IsViewable
&& QRect(attr.x,attr.y,attr.width,attr.height).contains(pos)) {
- bool windowContainsMouse = true;
+ bool windowContainsMouse = !ignoreNonXdndAwareWindows;
{
Atom type = XNone;
int f;
@@ -1463,12 +1462,15 @@ Window findRealWindow(const QPoint & pos, Window w, int md)
AnyPropertyType, &type, &f,&n,&a,&data);
if (data) XFree(data);
if (type) {
+ const QPoint relPos = pos - QPoint(attr.x,attr.y);
// 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.
#if defined(ShapeInput) && defined(ShapeBounding)
- windowContainsMouse = windowInteractsWithPosition(pos, w, ShapeInput) && windowInteractsWithPosition(pos, w, ShapeBounding);
+ windowContainsMouse = windowInteractsWithPosition(relPos, w, ShapeInput) && windowInteractsWithPosition(relPos, w, ShapeBounding);
#elif defined(ShapeBounding)
- windowContainsMouse = windowInteractsWithPosition(pos, w, ShapeBounding);
+ windowContainsMouse = windowInteractsWithPosition(relPos, w, ShapeBounding);
+#else
+ windowContainsMouse = true;
#endif
if (windowContainsMouse)
return w;
@@ -1482,7 +1484,7 @@ Window findRealWindow(const QPoint & pos, Window w, int md)
r=0;
for (uint i=nc; !r && i--;) {
r = findRealWindow(pos-QPoint(attr.x,attr.y),
- c[i], md-1);
+ c[i], md-1, ignoreNonXdndAwareWindows);
}
XFree(c);
if (r)
@@ -1579,7 +1581,9 @@ void QDragManager::move(const QPoint & globalPos)
}
if (xdnd_data.deco && (!target || target == xdnd_data.deco->effectiveWinId())) {
DNDDEBUG << "need to find real window";
- target = findRealWindow(globalPos, rootwin, 6);
+ target = findRealWindow(globalPos, rootwin, 6, true);
+ if (target == 0)
+ target = findRealWindow(globalPos, rootwin, 6, false);
DNDDEBUG << "real window found" << QWidget::find(target) << target;
}
}