Skip to content

Mark all keys as up if the app loses focus#5743

Merged
emilk merged 1 commit intomasterfrom
emilk/fix-sticky-keys
Feb 25, 2025
Merged

Mark all keys as up if the app loses focus#5743
emilk merged 1 commit intomasterfrom
emilk/fix-sticky-keys

Conversation

@emilk
Copy link
Owner

@emilk emilk commented Feb 24, 2025

In Rerun, pressing Cmd+S brings up a save dialog using rfd, but we get not key-up event for the S key (in winit).
This leads to S being mistakenly marked as down when we switch back to the app.

This PR takes the safe route and marks all keys as up when an egui app loses focus.

@emilk emilk added bug Something is broken eframe Relates to epi and eframe egui-winit porblems related to winit egui labels Feb 24, 2025
@emilk emilk changed the title Mark all keys as up if the app looses focus Mark all keys as up if the app loses focus Feb 24, 2025
@github-actions
Copy link

Preview available at https://egui-pr-preview.github.io/pr/5743-emilkfix-sticky-keys
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

Copy link
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

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

Nice!

@emilk emilk merged commit 6a96612 into master Feb 25, 2025
50 checks passed
@emilk emilk deleted the emilk/fix-sticky-keys branch February 25, 2025 13:05
darkwater pushed a commit to darkwater/egui that referenced this pull request Aug 24, 2025
In Rerun, pressing `Cmd+S` brings up a save dialog using `rfd`, but we
get not key-up event for the `S` key (in winit).
This leads to `S` being mistakenly marked as down when we switch back to
the app.

This PR takes the safe route and marks all keys as up when an egui app
loses focus.

* Tested with rerun-io/rerun#9103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken eframe Relates to epi and eframe egui egui-winit porblems related to winit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants