From ca8291b797efde5e7c55f3f85ad66735837cc8a0 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 18 Dec 2025 07:56:02 +0300 Subject: [PATCH] fixes --- src/handlers/xdg_shell.rs | 10 +++------- src/input/mod.rs | 22 +++++++++++++--------- src/input/move_grab.rs | 5 +++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index b46add5c..54fe0b2f 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -7,7 +7,7 @@ use smithay::desktop::{ PopupKeyboardGrab, PopupKind, PopupManager, PopupPointerGrab, PopupUngrabStrategy, Window, WindowSurfaceType, }; -use smithay::input::pointer::{CursorIcon, Focus}; +use smithay::input::pointer::Focus; use smithay::output::Output; use smithay::reexports::wayland_protocols::xdg::decoration::zv1::server::zxdg_toplevel_decoration_v1; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_positioner::ConstraintAdjustment; @@ -134,17 +134,13 @@ impl XdgShellHandler for State { match &start_data { PointerOrTouchStartData::Pointer(_) => { - if let Some(grab) = - MoveGrab::new(self, start_data, window.clone(), true, CursorIcon::Move) - { + if let Some(grab) = MoveGrab::new(self, start_data, window.clone(), true, None) { pointer.set_grab(self, grab, serial, Focus::Clear); } } PointerOrTouchStartData::Touch(_) => { let touch = self.niri.seat.get_touch().unwrap(); - if let Some(grab) = - MoveGrab::new(self, start_data, window.clone(), true, CursorIcon::Move) - { + if let Some(grab) = MoveGrab::new(self, start_data, window.clone(), true, None) { touch.set_grab(self, grab, serial); } } diff --git a/src/input/mod.rs b/src/input/mod.rs index 9d8c7609..0bbb145d 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2859,12 +2859,20 @@ impl State { let start_data = PointerOrTouchStartData::Pointer(start_data); let icon = CursorIcon::Grabbing; if let Some(grab) = - MoveGrab::new(self, start_data, window.clone(), false, icon) + MoveGrab::new(self, start_data, window.clone(), false, Some(icon)) { pointer.set_grab(self, grab, serial, Focus::Clear); - self.niri - .cursor_manager - .set_cursor_image(CursorImageStatus::Named(icon)); + + // Set the cursor to Grabbing right away for Mod+LMB since it doesn't + // do any other gesture. + // + // In the overview, we click to activate window and close the overview, + // in this case setting the cursor right away would be distracting. + if !is_overview_open { + self.niri + .cursor_manager + .set_cursor_image(CursorImageStatus::Named(icon)); + } } } } @@ -4112,13 +4120,9 @@ impl State { location: pos, }; let start_data = PointerOrTouchStartData::Touch(start_data); - let icon = CursorIcon::Grabbing; - if let Some(grab) = MoveGrab::new(self, start_data, window.clone(), true, icon) + if let Some(grab) = MoveGrab::new(self, start_data, window.clone(), true, None) { handle.set_grab(self, grab, serial); - self.niri - .cursor_manager - .set_cursor_image(CursorImageStatus::Named(icon)); } } diff --git a/src/input/move_grab.rs b/src/input/move_grab.rs index 86630526..cca4780f 100644 --- a/src/input/move_grab.rs +++ b/src/input/move_grab.rs @@ -43,7 +43,7 @@ impl MoveGrab { start_data: PointerOrTouchStartData, window: Window, enable_view_offset: bool, - move_icon: CursorIcon, + move_icon: Option, ) -> Option { let (output, pos_within_output) = state.niri.output_under(start_data.location())?; @@ -55,7 +55,8 @@ impl MoveGrab { window, gesture: GestureState::Recognizing, enable_view_offset, - move_icon, + // Moving windows by their titlebars uses the default cursor by default. + move_icon: move_icon.unwrap_or(CursorIcon::Default), }) }