moving: Grab use correct cursor
This commit is contained in:
parent
da59cbd768
commit
88d8972d34
2 changed files with 22 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ pub enum CursorShape {
|
||||||
Default,
|
Default,
|
||||||
ColResize,
|
ColResize,
|
||||||
RowResize,
|
RowResize,
|
||||||
|
Grab,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToString for CursorShape {
|
impl ToString for CursorShape {
|
||||||
|
|
@ -50,6 +51,7 @@ impl ToString for CursorShape {
|
||||||
CursorShape::Default => "default",
|
CursorShape::Default => "default",
|
||||||
CursorShape::ColResize => "col-resize",
|
CursorShape::ColResize => "col-resize",
|
||||||
CursorShape::RowResize => "row-resize",
|
CursorShape::RowResize => "row-resize",
|
||||||
|
CursorShape::Grab => "grabbing",
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
@ -243,6 +245,10 @@ impl Default for CursorState {
|
||||||
CursorShape::RowResize,
|
CursorShape::RowResize,
|
||||||
Cursor::load(&theme, CursorShape::RowResize, size),
|
Cursor::load(&theme, CursorShape::RowResize, size),
|
||||||
);
|
);
|
||||||
|
map.insert(
|
||||||
|
CursorShape::Grab,
|
||||||
|
Cursor::load(&theme, CursorShape::Grab, size),
|
||||||
|
);
|
||||||
map
|
map
|
||||||
},
|
},
|
||||||
current_image: RefCell::new(None),
|
current_image: RefCell::new(None),
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::render::{element::AsGlowRenderer, IndicatorShader},
|
backend::render::{
|
||||||
|
cursor::{CursorShape, CursorState},
|
||||||
|
element::AsGlowRenderer,
|
||||||
|
IndicatorShader,
|
||||||
|
},
|
||||||
shell::{
|
shell::{
|
||||||
element::CosmicMappedRenderElement,
|
element::CosmicMappedRenderElement,
|
||||||
focus::target::{KeyboardFocusTarget, PointerFocusTarget},
|
focus::target::{KeyboardFocusTarget, PointerFocusTarget},
|
||||||
|
|
@ -210,6 +214,11 @@ impl MoveGrab {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.borrow_mut() = Some(grab_state);
|
.borrow_mut() = Some(grab_state);
|
||||||
|
|
||||||
|
{
|
||||||
|
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||||
|
cursor_state.set_shape(CursorShape::Grab);
|
||||||
|
}
|
||||||
|
|
||||||
MoveGrab {
|
MoveGrab {
|
||||||
window,
|
window,
|
||||||
start_data,
|
start_data,
|
||||||
|
|
@ -303,6 +312,12 @@ impl MoveGrab {
|
||||||
};
|
};
|
||||||
|
|
||||||
handle.unset_grab(state, serial, time);
|
handle.unset_grab(state, serial, time);
|
||||||
|
|
||||||
|
{
|
||||||
|
let cursor_state = self.seat.user_data().get::<CursorState>().unwrap();
|
||||||
|
cursor_state.set_shape(CursorShape::Default);
|
||||||
|
}
|
||||||
|
|
||||||
if self.window.alive() {
|
if self.window.alive() {
|
||||||
if let Some(position) = position {
|
if let Some(position) = position {
|
||||||
handle.motion(
|
handle.motion(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue