You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
plasma-workspace/Forward-mouse-enter-and-lea...

55 lines
2.5 KiB

From 76cb47f1279ea012a9eda11c4ead7f28db4c1399 Mon Sep 17 00:00:00 2001
From: Anthony Fieroni <bvbfan@abv.bg>
Date: Tue, 1 Dec 2015 09:27:15 +0000
Subject: [PATCH 01/15] Forward mouse enter and leave events on feathered edges
REVIEW: 126175
BUG: 354651
---
shell/panelview.cpp | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/shell/panelview.cpp b/shell/panelview.cpp
index 3407501..28faac4 100644
--- a/shell/panelview.cpp
+++ b/shell/panelview.cpp
@@ -748,6 +748,7 @@ bool PanelView::event(QEvent *e)
* 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: {
@@ -755,8 +756,25 @@ bool PanelView::event(QEvent *e)
//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()) && !containmentContainsPosition(me->windowPos())) {
- auto me2 = new QMouseEvent(me->type(),
+ if (geometry().contains(me->screenPos().toPoint())) {
+ if (!containmentContainsPosition(me->windowPos())) {
+ auto me2 = new QMouseEvent(me->type(),
+ positionAdjustedForContainment(me->windowPos()),
+ positionAdjustedForContainment(me->windowPos()),
+ positionAdjustedForContainment(me->windowPos()) + position(),
+ me->button(), me->buttons(), me->modifiers());
+
+ QCoreApplication::postEvent(this, me2);
+ return true;
+ }
+ }
+ break;
+ }
+ case QEvent::Leave: {
+ QMouseEvent *me = static_cast<QMouseEvent *>(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(),
--
2.5.0