mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Simplify ScreenshotUi::pointer_button()
This commit is contained in:
+4
-6
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user