From: Anthony Fieroni Date: Tue, 15 Dec 2015 12:49:39 +0000 Subject: Fix left click on item in panel being ignored X-Git-Tag: v5.5.1 X-Git-Url: http://quickgit.kde.org/?p=plasma-workspace.git&a=commitdiff&h=1390b40b399770e7a67da714c74d172eee1bb433 --- Fix left click on item in panel being ignored Last patch has a reggression due to QtQuick issue (only on Xcb): QEvent::Leave is triggered after QEvent::MouseButtonPress Qt::LeftButton BUG: 354651 REVIEW: 126331 --- --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -748,7 +748,6 @@ * on the mouse edge, forward the click in the containment boundaries */ switch (e->type()) { - case QEvent::Enter: case QEvent::MouseMove: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: { @@ -756,7 +755,7 @@ //first, don't mess with position if the cursor is actually outside the view: //somebody is doing a click and drag that must not break when the cursor i outside - if (geometry().contains(me->screenPos().toPoint())) { + if (geometry().contains(QCursor::pos())) { if (!containmentContainsPosition(me->windowPos())) { auto me2 = new QMouseEvent(me->type(), positionAdjustedForContainment(me->windowPos()), @@ -767,24 +766,18 @@ QCoreApplication::postEvent(this, me2); return true; } - } - break; - } - case QEvent::Leave: { - QMouseEvent *me = static_cast(e); - // don't forget to trigger QEvent::Leave if current mouse position is outside the panel - if (!geometry().contains(me->screenPos().toPoint())) { - auto me2 = new QMouseEvent(QEvent::Leave, - positionAdjustedForContainment(me->windowPos()), - positionAdjustedForContainment(me->windowPos()), - positionAdjustedForContainment(me->windowPos()) + position(), - me->button(), me->buttons(), me->modifiers()); - - QCoreApplication::postEvent(this, me2); + } else { + // discard event if current mouse position is outside the panel return true; } break; } + + case QEvent::Enter: + case QEvent::Leave: + // QtQuick < 5.6 issue: + // QEvent::Leave is triggered on MouseButtonPress Qt::LeftButton + break; case QEvent::Wheel: { QWheelEvent *we = static_cast(e);