Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace lambdas with CKeybindManager::switchToWindow #3229

Merged
merged 1 commit into from
Sep 10, 2023

Conversation

memchr
Copy link
Contributor

@memchr memchr commented Sep 9, 2023

Abstract

There are 3 byte to byte identical and one spiritually identical lambdas switchToWindow in KeybindManager.cpp. They will surely come back to haunt us one day as bugs often breed in repetitive code.

Changes

moves `switchToWindow` lambdas to a single private method
`CKeybindManager::switchToWindow()`.

fixes hyprwm#3227, as a by-product of the mouse motion simulation at the end
of `CKeybindManager::switchToWindow()`.
@memchr
Copy link
Contributor Author

memchr commented Sep 9, 2023

Other notes

There is currently a bug similar to #3227 in listener_mapWindow(), where scrolling affects the previous window instead of the mapped window if the mapped window was focused. simulateMouseMovement() may not be sufficient to fix this bug as there is an edge case: If the cursor is exactly in the middle of the borders of the previous window and the mapped window, the previous window will get the focus when simulateMouseMovement() is called.

So that bit remains untouched, along with the fact that this patch is primarily a refactor, and the fix for #3227 is a side effect.

@woojiq
Copy link

woojiq commented Sep 9, 2023

I can confirm that this solves my problem.
@memchr thanks for the quick response ❤️

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

focuscurrentorlast: scroll affects previous window
3 participants