From 9ff2f83db00aebffb2b7b7fefd23bfd7585926c3 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 9 May 2025 09:18:22 +0300 Subject: Simplify ScreenshotUi::pointer_button() --- src/input/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/input') diff --git a/src/input/mod.rs b/src/input/mod.rs index 05880073..f0f601f6 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2563,7 +2563,7 @@ impl State { self.niri.focus_layer_surface_if_on_demand(layer_under); } - if let Some(button) = button { + if button == Some(MouseButton::Left) && self.niri.screenshot_ui.is_open() { let pos = pointer.current_location(); if let Some((output, _)) = self.niri.output_under(pos) { let output = output.clone(); @@ -2578,11 +2578,9 @@ impl State { point.x = min(size.w - 1, point.x); point.y = min(size.h - 1, point.y); - if self - .niri - .screenshot_ui - .pointer_button(output, point, button, button_state) - { + let down = button_state == ButtonState::Pressed; + + if self.niri.screenshot_ui.pointer_button(output, point, down) { self.niri.queue_redraw_all(); } } -- cgit