diff --git a/events.cpp b/events.cpp index 05aaddca6f..8ce51e763f 100644 --- a/events.cpp +++ b/events.cpp @@ -1599,7 +1599,7 @@ bool Unmanaged::windowEvent(xcb_generic_event_t *e) release(ReleaseReason::Destroyed); break; case XCB_UNMAP_NOTIFY:{ - workspace()->updateFocusMousePosition(Cursor::pos()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event // unmap notify might have been emitted due to a destroy notify // but unmap notify gets emitted before the destroy notify, nevertheless at this diff --git a/geometry.cpp b/geometry.cpp index 3850110e04..94daf199f8 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2405,7 +2405,7 @@ void Client::setFullScreen(bool set, bool user) setShade(ShadeNone); bool was_fs = isFullScreen(); if (was_fs) - workspace()->updateFocusMousePosition(Cursor::pos()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event else geom_fs_restore = geometry(); fullscreen_mode = set ? FullScreenNormal : FullScreenNone; @@ -3126,10 +3126,7 @@ 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()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event GeometryUpdatesBlocker blocker(this); diff --git a/placement.cpp b/placement.cpp index b8543607b4..906b282b62 100644 --- a/placement.cpp +++ b/placement.cpp @@ -663,10 +663,7 @@ 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()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; const int oldScreen = screen(); move(left, top); @@ -731,10 +728,7 @@ void Client::growHorizontal() } 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()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setGeometry(geom); } @@ -754,10 +748,7 @@ void Client::shrinkHorizontal() return; geom.setSize(adjustedSize(geom.size(), SizemodeFixedW)); 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()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setGeometry(geom); } } @@ -783,10 +774,7 @@ 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()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setGeometry(geom); } @@ -807,10 +795,7 @@ void Client::shrinkVertical() return; geom.setSize(adjustedSize(geom.size(), SizemodeFixedH)); 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()); + workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event; setGeometry(geom); } } diff --git a/workspace.h b/workspace.h index 249cf36bb0..bccc1c1fe3 100644 --- a/workspace.h +++ b/workspace.h @@ -314,6 +314,14 @@ public: void cancelDelayFocus(); void requestDelayFocus(Client*); + + /** + * updates the mouse position to track whether a focus follow mouse focus change was caused by + * an actual mouse move + * is esp. called on enter/motion events of inactive windows + * since an active window doesn't receive mouse events, it must also be invoked if a (potentially) + * active window might be moved/resize away from the cursor (causing a leave event) + */ void updateFocusMousePosition(const QPoint& pos); QPoint focusMousePosition() const;