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

fix: ignore tab switch when user focused on window just now #298

Merged
merged 3 commits into from Jul 7, 2023

Conversation

starccy
Copy link
Contributor

@starccy starccy commented Jul 4, 2023

related to: #262

When pressing Alt + Tab to switch back to the app, the Tab pressed event will be captured immediately, which causes this issue.

I resolve to use the iced window focus event to determine if users switched between the windows and record the timestamp of the focus event meanwhile.
When the SwitchPage message is emitted, first check if users just switched windows within a short period. If so, just ignore this request.

@GyulyVGC GyulyVGC linked an issue Jul 4, 2023 that may be closed by this pull request
@GyulyVGC GyulyVGC added this to the v1.2.2 milestone Jul 4, 2023
@GyulyVGC
Copy link
Owner

GyulyVGC commented Jul 4, 2023

Amazing, I will review and try it in the following days.
Tyvm 🙏

@GyulyVGC GyulyVGC added the bug Something isn't working label Jul 4, 2023
@GyulyVGC
Copy link
Owner

GyulyVGC commented Jul 5, 2023

I only simplified something I thought unnecessary, but the overall process is the same and it's good imo.

Before merging I'd like that @Aloso could confirm the problem is solved for him as well.
I still wasn't able to reproduce this problem on my macOS, so having the confirmation from who originally opened the issue would be the best thing.

@Aloso
Copy link
Contributor

Aloso commented Jul 5, 2023

Thanks! I'll check later today 🙂

@Aloso
Copy link
Contributor

Aloso commented Jul 6, 2023

@starccy @GyulyVGC I tried this branch and can confirm that it fixes the bug for me (on Arch Linux with KDE Plasma) 🚀

@GyulyVGC
Copy link
Owner

GyulyVGC commented Jul 6, 2023

Awesome! Thanks for the confirmation 😄

@GyulyVGC GyulyVGC merged commit 47a7504 into GyulyVGC:main Jul 7, 2023
3 checks passed
@GyulyVGC
Copy link
Owner

@all-contributors please add @starccy for code.

@allcontributors
Copy link
Contributor

@GyulyVGC

I've put up a pull request to add @starccy! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alt+Tab switches tabs
3 participants