set cursor shape for resize grabs
This commit is contained in:
parent
9a9eddb132
commit
65a54706f5
1 changed files with 25 additions and 1 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
backend::render::cursor::CursorState,
|
||||||
shell::{
|
shell::{
|
||||||
element::CosmicMapped,
|
element::CosmicMapped,
|
||||||
focus::target::PointerFocusTarget,
|
focus::target::PointerFocusTarget,
|
||||||
|
|
@ -15,7 +16,7 @@ use smithay::{
|
||||||
desktop::{space::SpaceElement, WindowSurface},
|
desktop::{space::SpaceElement, WindowSurface},
|
||||||
input::{
|
input::{
|
||||||
pointer::{
|
pointer::{
|
||||||
AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent,
|
AxisFrame, ButtonEvent, CursorIcon, GestureHoldBeginEvent, GestureHoldEndEvent,
|
||||||
GesturePinchBeginEvent, GesturePinchEndEvent, GesturePinchUpdateEvent,
|
GesturePinchBeginEvent, GesturePinchEndEvent, GesturePinchUpdateEvent,
|
||||||
GestureSwipeBeginEvent, GestureSwipeEndEvent, GestureSwipeUpdateEvent,
|
GestureSwipeBeginEvent, GestureSwipeEndEvent, GestureSwipeUpdateEvent,
|
||||||
GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, PointerInnerHandle,
|
GrabStartData as PointerGrabStartData, MotionEvent, PointerGrab, PointerInnerHandle,
|
||||||
|
|
@ -390,6 +391,22 @@ impl ResizeSurfaceGrab {
|
||||||
.0
|
.0
|
||||||
.store(true, Ordering::SeqCst);
|
.store(true, Ordering::SeqCst);
|
||||||
|
|
||||||
|
let shape = match edges {
|
||||||
|
ResizeEdge::TOP_LEFT => Some(CursorIcon::NwResize),
|
||||||
|
ResizeEdge::TOP_RIGHT => Some(CursorIcon::NeResize),
|
||||||
|
ResizeEdge::BOTTOM_LEFT => Some(CursorIcon::SwResize),
|
||||||
|
ResizeEdge::BOTTOM_RIGHT => Some(CursorIcon::SeResize),
|
||||||
|
ResizeEdge::TOP => Some(CursorIcon::NResize),
|
||||||
|
ResizeEdge::RIGHT => Some(CursorIcon::EResize),
|
||||||
|
ResizeEdge::BOTTOM => Some(CursorIcon::SResize),
|
||||||
|
ResizeEdge::LEFT => Some(CursorIcon::WResize),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
if let Some(shape) = shape {
|
||||||
|
let cursor_state = seat.user_data().get::<CursorState>().unwrap();
|
||||||
|
cursor_state.lock().unwrap().set_shape(shape);
|
||||||
|
}
|
||||||
|
|
||||||
ResizeSurfaceGrab {
|
ResizeSurfaceGrab {
|
||||||
start_data,
|
start_data,
|
||||||
seat: seat.clone(),
|
seat: seat.clone(),
|
||||||
|
|
@ -524,3 +541,10 @@ impl ResizeSurfaceGrab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for ResizeSurfaceGrab {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
let cursor_state = self.seat.user_data().get::<CursorState>().unwrap();
|
||||||
|
cursor_state.lock().unwrap().unset_shape();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue