From 88d8972d34c6c7896748c3acf7a69c995ea90755 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 18 Jul 2023 12:21:16 +0200 Subject: [PATCH] moving: Grab use correct cursor --- src/backend/render/cursor.rs | 6 ++++++ src/shell/grabs/moving.rs | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/backend/render/cursor.rs b/src/backend/render/cursor.rs index 41c412a8..1e735326 100644 --- a/src/backend/render/cursor.rs +++ b/src/backend/render/cursor.rs @@ -42,6 +42,7 @@ pub enum CursorShape { Default, ColResize, RowResize, + Grab, } impl ToString for CursorShape { @@ -50,6 +51,7 @@ impl ToString for CursorShape { CursorShape::Default => "default", CursorShape::ColResize => "col-resize", CursorShape::RowResize => "row-resize", + CursorShape::Grab => "grabbing", } .to_string() } @@ -243,6 +245,10 @@ impl Default for CursorState { CursorShape::RowResize, Cursor::load(&theme, CursorShape::RowResize, size), ); + map.insert( + CursorShape::Grab, + Cursor::load(&theme, CursorShape::Grab, size), + ); map }, current_image: RefCell::new(None), diff --git a/src/shell/grabs/moving.rs b/src/shell/grabs/moving.rs index 9231ff12..a9e0c121 100644 --- a/src/shell/grabs/moving.rs +++ b/src/shell/grabs/moving.rs @@ -1,7 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-only use crate::{ - backend::render::{element::AsGlowRenderer, IndicatorShader}, + backend::render::{ + cursor::{CursorShape, CursorState}, + element::AsGlowRenderer, + IndicatorShader, + }, shell::{ element::CosmicMappedRenderElement, focus::target::{KeyboardFocusTarget, PointerFocusTarget}, @@ -210,6 +214,11 @@ impl MoveGrab { .unwrap() .borrow_mut() = Some(grab_state); + { + let cursor_state = seat.user_data().get::().unwrap(); + cursor_state.set_shape(CursorShape::Grab); + } + MoveGrab { window, start_data, @@ -303,6 +312,12 @@ impl MoveGrab { }; handle.unset_grab(state, serial, time); + + { + let cursor_state = self.seat.user_data().get::().unwrap(); + cursor_state.set_shape(CursorShape::Default); + } + if self.window.alive() { if let Some(position) = position { handle.motion(