forge
Explore
Log in

Don't you dare go Hollow

Simplify ScreenshotUi::pointer_button()

Browse files at this commit

9ff2f83db00aebffb2b7b7fefd23bfd7585926c3Ivan MolodetskikhParent: 7a10f71
src/input/mod.rsmodified+4 -6
@@ -2563,7 +2563,7 @@ impl State {
25632563 self.niri.focus_layer_surface_if_on_demand(layer_under);
25642564 }
25652565
2566- if let Some(button) = button {
2566+ if button == Some(MouseButton::Left) && self.niri.screenshot_ui.is_open() {
25672567 let pos = pointer.current_location();
25682568 if let Some((output, _)) = self.niri.output_under(pos) {
25692569 let output = output.clone();
@@ -2578,11 +2578,9 @@ impl State {
25782578 point.x = min(size.w - 1, point.x);
25792579 point.y = min(size.h - 1, point.y);
25802580
2581- if self
2582- .niri
2583- .screenshot_ui
2584- .pointer_button(output, point, button, button_state)
2585- {
2581+ let down = button_state == ButtonState::Pressed;
2582+
2583+ if self.niri.screenshot_ui.pointer_button(output, point, down) {
25862584 self.niri.queue_redraw_all();
25872585 }
25882586 }
src/ui/screenshot_ui.rsmodified+1 -8
@@ -11,7 +11,6 @@ use niri_ipc::SizeChange;
1111 use pango::{Alignment, FontDescription};
1212 use pangocairo::cairo::{self, ImageSurface};
1313 use smithay::backend::allocator::Fourcc;
14-use smithay::backend::input::{ButtonState, MouseButton};
1514 use smithay::backend::renderer::element::utils::{Relocate, RelocateRenderElement};
1615 use smithay::backend::renderer::element::Kind;
1716 use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};
@@ -678,8 +677,7 @@ impl ScreenshotUi {
678677 &mut self,
679678 output: Output,
680679 point: Point<i32, Physical>,
681- button: MouseButton,
682- state: ButtonState,
680+ down: bool,
683681 ) -> bool {
684682 let Self::Open {
685683 selection,
@@ -691,11 +689,6 @@ impl ScreenshotUi {
691689 return false;
692690 };
693691
694- if button != MouseButton::Left {
695- return false;
696- }
697-
698- let down = state == ButtonState::Pressed;
699692 if *mouse_down == down {
700693 return false;
701694 }