From e3768b43559fa179f497d5130c0108dd72acf266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Thu, 29 Jan 2015 00:14:47 +0100 Subject: [PATCH] updateFocusMousePosition() before some actions in particular artificial geometry updates that should not update the focus and are prone to a static cursor BUG: 343319 REVIEW: 122299 FIXED-IN: 5.2.1 --- geometry.cpp | 5 +++++ placement.cpp | 28 ++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index 3bf8da29aa..198d12a30b 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -3126,6 +3126,11 @@ void Client::setQuickTileMode(QuickTileMode mode, bool keyboard) if (!isResizable() && maximizeMode() != MaximizeFull) return; + // this might move the window away from the cursor pos what will cause a leave event + // since this is not due to a cursor move and we didn't receive motion events in the active + // window, we need to udpate the focus mouse position here + workspace()->updateFocusMousePosition(Cursor::pos()); + GeometryUpdatesBlocker blocker(this); if (mode == QuickTileMaximize) { diff --git a/placement.cpp b/placement.cpp index c193657cf4..2f936f6d65 100644 --- a/placement.cpp +++ b/placement.cpp @@ -663,6 +663,11 @@ const char* Placement::policyToString(Policy policy) void Client::packTo(int left, int top) { + // this might move the window away from the cursor pos what will cause a leave event + // since this is not due to a cursor move and we didn't receive motion events in the active + // window, we need to udpate the focus mouse position here + workspace()->updateFocusMousePosition(Cursor::pos()); + const int oldScreen = screen(); move(left, top); if (screen() != oldScreen) { @@ -725,6 +730,11 @@ void Client::growHorizontal() geom.setRight(newright); } geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); + geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + // this might move an inactive window under the cursor pos what will cause an enter event + // since this is not due to a cursor move and we didn't receive motion events in the active + // window, we need to udpate the focus mouse position here + workspace()->updateFocusMousePosition(Cursor::pos()); setGeometry(geom); } @@ -743,8 +753,13 @@ void Client::shrinkHorizontal() if (geom.width() <= 1) return; geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); - if (geom.width() > 20) + if (geom.width() > 20) { + // this might move the window away from the cursor pos what will cause a leave event + // since this is not due to a cursor move and we didn't receive motion events in the active + // window, we need to udpate the focus mouse position here + workspace()->updateFocusMousePosition(Cursor::pos()); setGeometry(geom); + } } void Workspace::slotWindowGrowVertical() @@ -768,6 +783,10 @@ void Client::growVertical() geom.setBottom(newbottom); } geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); + // this might move an inactive window under the cursor pos what will cause an enter event + // since this is not due to a cursor move and we didn't receive motion events in the active + // window, we need to udpate the focus mouse position here + workspace()->updateFocusMousePosition(Cursor::pos()); setGeometry(geom); } @@ -787,8 +806,13 @@ void Client::shrinkVertical() if (geom.height() <= 1) return; geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); - if (geom.height() > 20) + if (geom.height() > 20) { + // this might move the window away from the cursor pos what will cause a leave event + // since this is not due to a cursor move and we didn't receive motion events in the active + // window, we need to udpate the focus mouse position here + workspace()->updateFocusMousePosition(Cursor::pos()); setGeometry(geom); + } }