Add unset method to input grab traits

Fixes https://github.com/pop-os/cosmic-comp/issues/403.
This commit is contained in:
Ian Douglas Scott 2024-04-12 09:48:29 -07:00 committed by Victoria Brekenfeld
parent d16a9e387d
commit 1216cd0b67
8 changed files with 36 additions and 6 deletions

View file

@ -162,13 +162,11 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
match self.release {
ReleaseMode::NoMouseButtons => {
if handle.current_pressed().is_empty() {
self.ungrab();
handle.unset_grab(data, event.serial, event.time, true);
}
}
ReleaseMode::Click => {
if event.state == ButtonState::Pressed {
self.ungrab();
handle.unset_grab(data, event.serial, event.time, true);
}
}
@ -266,6 +264,10 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
_ => unreachable!(),
}
}
fn unset(&mut self, _data: &mut State) {
self.ungrab();
}
}
impl TouchGrab<State> for ResizeSurfaceGrab {
@ -288,7 +290,6 @@ impl TouchGrab<State> for ResizeSurfaceGrab {
seq: Serial,
) {
if event.slot == <Self as TouchGrab<State>>::start_data(self).slot {
self.ungrab();
handle.unset_grab(data);
}
@ -317,7 +318,6 @@ impl TouchGrab<State> for ResizeSurfaceGrab {
}
fn cancel(&mut self, data: &mut State, handle: &mut TouchInnerHandle<'_, State>, _seq: Serial) {
self.ungrab();
handle.unset_grab(data);
}
@ -327,6 +327,10 @@ impl TouchGrab<State> for ResizeSurfaceGrab {
_ => unreachable!(),
}
}
fn unset(&mut self, _data: &mut State) {
self.ungrab();
}
}
pub struct ResizeGrabMarker(AtomicBool);

View file

@ -462,6 +462,8 @@ impl PointerGrab<State> for ResizeForkGrab {
_ => unreachable!(),
}
}
fn unset(&mut self, _data: &mut State) {}
}
impl TouchGrab<State> for ResizeForkGrab {
@ -521,4 +523,6 @@ impl TouchGrab<State> for ResizeForkGrab {
_ => unreachable!(),
}
}
fn unset(&mut self, _data: &mut State) {}
}

View file

@ -99,4 +99,6 @@ impl KeyboardGrab<State> for SwapWindowGrab {
fn start_data(&self) -> &KeyboardGrabStartData<State> {
&KeyboardGrabStartData { focus: None }
}
fn unset(&mut self, _state: &mut State) {}
}