Skip to content

Commit

Permalink
Guard against closed screenshot UI in its binds
Browse files Browse the repository at this point in the history
They can trigger with closed screenshot UI via key repeat.
  • Loading branch information
YaLTeR committed Nov 13, 2024
1 parent 4fc76b5 commit 4f44ef0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ impl State {
}
}
Action::ConfirmScreenshot => {
if !self.niri.screenshot_ui.is_open() {
return;
}

self.backend.with_primary_renderer(|renderer| {
match self.niri.screenshot_ui.capture(renderer) {
Ok((size, pixels)) => {
Expand All @@ -561,6 +565,10 @@ impl State {
self.niri.queue_redraw_all();
}
Action::CancelScreenshot => {
if !self.niri.screenshot_ui.is_open() {
return;
}

self.niri.screenshot_ui.close();
self.niri
.cursor_manager
Expand Down

0 comments on commit 4f44ef0

Please sign in to comment.