Add unset method to input grab traits
Fixes https://github.com/pop-os/cosmic-comp/issues/403.
This commit is contained in:
parent
d16a9e387d
commit
1216cd0b67
8 changed files with 36 additions and 6 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -4506,7 +4506,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/smithay//smithay?rev=ba0121a#ba0121aaed065c30ee4c42834126cce481cb0e57"
|
||||
source = "git+https://github.com/smithay//smithay?rev=033df94#033df9407104df60751438131687bac25d20e506"
|
||||
dependencies = [
|
||||
"appendlist",
|
||||
"ash",
|
||||
|
|
|
|||
|
|
@ -118,4 +118,4 @@ inherits = "release"
|
|||
lto = "fat"
|
||||
|
||||
[patch."https://github.com/Smithay/smithay.git"]
|
||||
smithay = {git = "https://github.com/smithay//smithay", rev = "ba0121a"}
|
||||
smithay = {git = "https://github.com/smithay//smithay", rev = "033df94"}
|
||||
|
|
|
|||
|
|
@ -634,6 +634,8 @@ impl PointerGrab<State> for MenuGrab {
|
|||
fn start_data(&self) -> &PointerGrabStartData<State> {
|
||||
&self.start_data
|
||||
}
|
||||
|
||||
fn unset(&mut self, _data: &mut State) {}
|
||||
}
|
||||
|
||||
impl MenuGrab {
|
||||
|
|
|
|||
|
|
@ -313,6 +313,13 @@ impl PointerGrab<State> for ResizeGrab {
|
|||
ResizeGrab::Tiling(grab) => PointerGrab::start_data(grab),
|
||||
}
|
||||
}
|
||||
|
||||
fn unset(&mut self, data: &mut State) {
|
||||
match self {
|
||||
ResizeGrab::Floating(grab) => PointerGrab::unset(grab, data),
|
||||
ResizeGrab::Tiling(grab) => PointerGrab::unset(grab, data),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TouchGrab<State> for ResizeGrab {
|
||||
|
|
@ -377,4 +384,11 @@ impl TouchGrab<State> for ResizeGrab {
|
|||
ResizeGrab::Tiling(grab) => TouchGrab::start_data(grab),
|
||||
}
|
||||
}
|
||||
|
||||
fn unset(&mut self, data: &mut State) {
|
||||
match self {
|
||||
ResizeGrab::Floating(grab) => TouchGrab::unset(grab, data),
|
||||
ResizeGrab::Tiling(grab) => TouchGrab::unset(grab, data),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -575,6 +575,8 @@ impl PointerGrab<State> for MoveGrab {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn unset(&mut self, _data: &mut State) {}
|
||||
}
|
||||
|
||||
impl TouchGrab<State> for MoveGrab {
|
||||
|
|
@ -632,6 +634,8 @@ impl TouchGrab<State> for MoveGrab {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn unset(&mut self, _data: &mut State) {}
|
||||
}
|
||||
|
||||
impl MoveGrab {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue