Simplify ScreenshotUi::pointer_button()

This commit is contained in:
Ivan Molodetskikh
2025-05-09 09:18:22 +03:00
parent 7a10f71ee5
commit 9ff2f83db0
2 changed files with 5 additions and 14 deletions
+4 -6
View File
@@ -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();
}
}
+1 -8
View File
@@ -11,7 +11,6 @@ use niri_ipc::SizeChange;
use pango::{Alignment, FontDescription};
use pangocairo::cairo::{self, ImageSurface};
use smithay::backend::allocator::Fourcc;
use smithay::backend::input::{ButtonState, MouseButton};
use smithay::backend::renderer::element::utils::{Relocate, RelocateRenderElement};
use smithay::backend::renderer::element::Kind;
use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};
@@ -678,8 +677,7 @@ impl ScreenshotUi {
&mut self,
output: Output,
point: Point<i32, Physical>,
button: MouseButton,
state: ButtonState,
down: bool,
) -> bool {
let Self::Open {
selection,
@@ -691,11 +689,6 @@ impl ScreenshotUi {
return false;
};
if button != MouseButton::Left {
return false;
}
let down = state == ButtonState::Pressed;
if *mouse_down == down {
return false;
}