aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/input/mod.rs10
-rw-r--r--src/input/spatial_movement_grab.rs6
-rw-r--r--src/layout/mod.rs24
-rw-r--r--src/layout/monitor.rs12
-rw-r--r--src/layout/scrolling.rs4
-rw-r--r--src/layout/tests.rs11
-rw-r--r--src/layout/workspace.rs5
7 files changed, 20 insertions, 52 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 28e254e4..4d077fe0 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -2886,19 +2886,13 @@ impl State {
self.niri.gesture_swipe_3f_cumulative = None;
let mut handled = false;
- let res = self
- .niri
- .layout
- .workspace_switch_gesture_end(event.cancelled(), Some(true));
+ let res = self.niri.layout.workspace_switch_gesture_end(Some(true));
if let Some(output) = res {
self.niri.queue_redraw(&output);
handled = true;
}
- let res = self
- .niri
- .layout
- .view_offset_gesture_end(event.cancelled(), Some(true));
+ let res = self.niri.layout.view_offset_gesture_end(Some(true));
if let Some(output) = res {
self.niri.queue_redraw(&output);
handled = true;
diff --git a/src/input/spatial_movement_grab.rs b/src/input/spatial_movement_grab.rs
index 56a36ce3..d8b13b96 100644
--- a/src/input/spatial_movement_grab.rs
+++ b/src/input/spatial_movement_grab.rs
@@ -40,10 +40,8 @@ impl SpatialMovementGrab {
let layout = &mut state.niri.layout;
let res = match self.gesture {
GestureState::Recognizing => None,
- GestureState::ViewOffset => layout.view_offset_gesture_end(false, Some(false)),
- GestureState::WorkspaceSwitch => {
- layout.workspace_switch_gesture_end(false, Some(false))
- }
+ GestureState::ViewOffset => layout.view_offset_gesture_end(Some(false)),
+ GestureState::WorkspaceSwitch => layout.workspace_switch_gesture_end(Some(false)),
};
if let Some(output) = res {
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 5ade9d01..6c2ba2ae 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -3534,7 +3534,7 @@ impl<W: LayoutElement> Layout<W> {
for monitor in monitors {
// Cancel the gesture on other outputs.
if &monitor.output != output {
- monitor.workspace_switch_gesture_end(true, None);
+ monitor.workspace_switch_gesture_end(None);
continue;
}
@@ -3568,18 +3568,14 @@ impl<W: LayoutElement> Layout<W> {
None
}
- pub fn workspace_switch_gesture_end(
- &mut self,
- cancelled: bool,
- is_touchpad: Option<bool>,
- ) -> Option<Output> {
+ pub fn workspace_switch_gesture_end(&mut self, is_touchpad: Option<bool>) -> Option<Output> {
let monitors = match &mut self.monitor_set {
MonitorSet::Normal { monitors, .. } => monitors,
MonitorSet::NoOutputs { .. } => return None,
};
for monitor in monitors {
- if monitor.workspace_switch_gesture_end(cancelled, is_touchpad) {
+ if monitor.workspace_switch_gesture_end(is_touchpad) {
return Some(monitor.output.clone());
}
}
@@ -3597,7 +3593,7 @@ impl<W: LayoutElement> Layout<W> {
for (idx, ws) in monitor.workspaces.iter_mut().enumerate() {
// Cancel the gesture on other workspaces.
if &monitor.output != output || idx != monitor.active_workspace_idx {
- ws.view_offset_gesture_end(true, None);
+ ws.view_offset_gesture_end(None);
continue;
}
@@ -3634,11 +3630,7 @@ impl<W: LayoutElement> Layout<W> {
None
}
- pub fn view_offset_gesture_end(
- &mut self,
- cancelled: bool,
- is_touchpad: Option<bool>,
- ) -> Option<Output> {
+ pub fn view_offset_gesture_end(&mut self, is_touchpad: Option<bool>) -> Option<Output> {
let monitors = match &mut self.monitor_set {
MonitorSet::Normal { monitors, .. } => monitors,
MonitorSet::NoOutputs { .. } => return None,
@@ -3646,7 +3638,7 @@ impl<W: LayoutElement> Layout<W> {
for monitor in monitors {
for ws in &mut monitor.workspaces {
- if ws.view_offset_gesture_end(cancelled, is_touchpad) {
+ if ws.view_offset_gesture_end(is_touchpad) {
return Some(monitor.output.clone());
}
}
@@ -4560,7 +4552,7 @@ impl<W: LayoutElement> Layout<W> {
} else {
// Cancel the view offset gesture after workspace switches, moves, etc.
if ws_idx != mon.active_workspace_idx {
- ws.view_offset_gesture_end(false, None);
+ ws.view_offset_gesture_end(None);
}
}
}
@@ -4569,7 +4561,7 @@ impl<W: LayoutElement> Layout<W> {
MonitorSet::NoOutputs { workspaces, .. } => {
for ws in workspaces {
ws.refresh(false);
- ws.view_offset_gesture_end(false, None);
+ ws.view_offset_gesture_end(None);
}
}
}
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs
index 74c83317..4b816116 100644
--- a/src/layout/monitor.rs
+++ b/src/layout/monitor.rs
@@ -1026,11 +1026,7 @@ impl<W: LayoutElement> Monitor<W> {
Some(true)
}
- pub fn workspace_switch_gesture_end(
- &mut self,
- cancelled: bool,
- is_touchpad: Option<bool>,
- ) -> bool {
+ pub fn workspace_switch_gesture_end(&mut self, is_touchpad: Option<bool>) -> bool {
let Some(WorkspaceSwitch::Gesture(gesture)) = &mut self.workspace_switch else {
return false;
};
@@ -1039,12 +1035,6 @@ impl<W: LayoutElement> Monitor<W> {
return false;
}
- if cancelled {
- self.workspace_switch = None;
- self.clean_up_workspaces();
- return true;
- }
-
// Take into account any idle time between the last event and now.
let now = self.clock.now_unadjusted();
gesture.tracker.push(0., now);
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index 87f6c7ba..c50a6bf7 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -2989,7 +2989,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
gesture.current_view_offset = clamped_offset;
}
- pub fn view_offset_gesture_end(&mut self, _cancelled: bool, is_touchpad: Option<bool>) -> bool {
+ pub fn view_offset_gesture_end(&mut self, is_touchpad: Option<bool>) -> bool {
let ViewOffset::Gesture(gesture) = &mut self.view_offset else {
return false;
};
@@ -3279,7 +3279,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
return;
}
- self.view_offset_gesture_end(false, None);
+ self.view_offset_gesture_end(None);
}
pub fn interactive_resize_begin(&mut self, window: W::Id, edges: ResizeEdge) -> bool {
diff --git a/src/layout/tests.rs b/src/layout/tests.rs
index 5d45ee98..a49552a8 100644
--- a/src/layout/tests.rs
+++ b/src/layout/tests.rs
@@ -599,7 +599,6 @@ enum Op {
is_touchpad: bool,
},
WorkspaceSwitchGestureEnd {
- cancelled: bool,
is_touchpad: Option<bool>,
},
InteractiveMoveBegin {
@@ -1362,8 +1361,7 @@ impl Op {
layout.view_offset_gesture_update(delta, timestamp, is_touchpad);
}
Op::ViewOffsetGestureEnd { is_touchpad } => {
- // We don't handle cancels in this gesture.
- layout.view_offset_gesture_end(false, is_touchpad);
+ layout.view_offset_gesture_end(is_touchpad);
}
Op::WorkspaceSwitchGestureBegin {
output_idx: id,
@@ -1383,11 +1381,8 @@ impl Op {
} => {
layout.workspace_switch_gesture_update(delta, timestamp, is_touchpad);
}
- Op::WorkspaceSwitchGestureEnd {
- cancelled,
- is_touchpad,
- } => {
- layout.workspace_switch_gesture_end(cancelled, is_touchpad);
+ Op::WorkspaceSwitchGestureEnd { is_touchpad } => {
+ layout.workspace_switch_gesture_end(is_touchpad);
}
Op::InteractiveMoveBegin {
window,
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index 33e594fe..f7690ee1 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -1619,9 +1619,8 @@ impl<W: LayoutElement> Workspace<W> {
.view_offset_gesture_update(delta_x, timestamp, is_touchpad)
}
- pub fn view_offset_gesture_end(&mut self, cancelled: bool, is_touchpad: Option<bool>) -> bool {
- self.scrolling
- .view_offset_gesture_end(cancelled, is_touchpad)
+ pub fn view_offset_gesture_end(&mut self, is_touchpad: Option<bool>) -> bool {
+ self.scrolling.view_offset_gesture_end(is_touchpad)
}
pub fn dnd_scroll_gesture_begin(&mut self) {