diff options
| -rw-r--r-- | src/handlers/mod.rs | 9 | ||||
| -rw-r--r-- | src/input.rs | 12 | ||||
| -rw-r--r-- | src/niri.rs | 10 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index b23d1abb..049798dc 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -11,7 +11,7 @@ use std::thread; use smithay::backend::allocator::dmabuf::Dmabuf; use smithay::backend::renderer::ImportDma; use smithay::desktop::{PopupKind, PopupManager}; -use smithay::input::pointer::CursorImageStatus; +use smithay::input::pointer::{CursorIcon, CursorImageStatus}; use smithay::input::{Seat, SeatHandler, SeatState}; use smithay::output::Output; use smithay::reexports::wayland_server::protocol::wl_data_source::WlDataSource; @@ -52,7 +52,12 @@ impl SeatHandler for State { &mut self.niri.seat_state } - fn cursor_image(&mut self, _seat: &Seat<Self>, image: CursorImageStatus) { + fn cursor_image(&mut self, _seat: &Seat<Self>, mut image: CursorImageStatus) { + // FIXME: this hack should be removable once the screenshot UI is tracked with a + // PointerFocus properly. + if self.niri.screenshot_ui.is_open() { + image = CursorImageStatus::Named(CursorIcon::Crosshair); + } self.niri.cursor_manager.set_cursor_image(image); // FIXME: more granular self.niri.queue_redraw_all(); diff --git a/src/input.rs b/src/input.rs index f157d63b..71197d82 100644 --- a/src/input.rs +++ b/src/input.rs @@ -10,9 +10,9 @@ use smithay::backend::input::{ use smithay::backend::libinput::LibinputInputBackend; use smithay::input::keyboard::{keysyms, FilterResult, Keysym, ModifiersState}; use smithay::input::pointer::{ - AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent, GesturePinchBeginEvent, - GesturePinchEndEvent, GesturePinchUpdateEvent, GestureSwipeBeginEvent, GestureSwipeEndEvent, - GestureSwipeUpdateEvent, MotionEvent, RelativeMotionEvent, + AxisFrame, ButtonEvent, CursorImageStatus, GestureHoldBeginEvent, GestureHoldEndEvent, + GesturePinchBeginEvent, GesturePinchEndEvent, GesturePinchUpdateEvent, GestureSwipeBeginEvent, + GestureSwipeEndEvent, GestureSwipeUpdateEvent, MotionEvent, RelativeMotionEvent, }; use smithay::utils::SERIAL_COUNTER; use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait}; @@ -146,10 +146,16 @@ impl State { } self.niri.screenshot_ui.close(); + self.niri + .cursor_manager + .set_cursor_image(CursorImageStatus::default_named()); self.niri.queue_redraw_all(); } Action::CancelScreenshot => { self.niri.screenshot_ui.close(); + self.niri + .cursor_manager + .set_cursor_image(CursorImageStatus::default_named()); self.niri.queue_redraw_all(); } Action::Screenshot => { diff --git a/src/niri.rs b/src/niri.rs index cdea4e49..8c359901 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -30,7 +30,7 @@ use smithay::desktop::utils::{ }; use smithay::desktop::{layer_map_for_output, PopupManager, Space, Window, WindowSurfaceType}; use smithay::input::keyboard::XkbConfig; -use smithay::input::pointer::{CursorImageAttributes, CursorImageStatus, MotionEvent}; +use smithay::input::pointer::{CursorIcon, CursorImageAttributes, CursorImageStatus, MotionEvent}; use smithay::input::{Seat, SeatState}; use smithay::output::Output; use smithay::reexports::calloop::generic::Generic; @@ -844,6 +844,8 @@ impl Niri { } if self.screenshot_ui.close() { + self.cursor_manager + .set_cursor_image(CursorImageStatus::default_named()); self.queue_redraw_all(); } } @@ -873,6 +875,8 @@ impl Niri { let size = output_transform.transform_size(output_mode.size); if old_size != size { self.screenshot_ui.close(); + self.cursor_manager + .set_cursor_image(CursorImageStatus::default_named()); self.queue_redraw_all(); return; } @@ -1958,6 +1962,8 @@ impl Niri { self.screenshot_ui .open(renderer, screenshots, default_output); + self.cursor_manager + .set_cursor_image(CursorImageStatus::Named(CursorIcon::Crosshair)); self.queue_redraw_all(); } @@ -2116,6 +2122,8 @@ impl Niri { info!("locking session"); self.screenshot_ui.close(); + self.cursor_manager + .set_cursor_image(CursorImageStatus::default_named()); self.lock_state = LockState::Locking(confirmation); self.queue_redraw_all(); |
