forge
Explore
Log in

Don't you dare go Hollow

layout: Fix DnD scroll not stopping when interactive moving unfullscreen to floating

Browse files at this commit

9fb02b9571a7d84c9e6a93b75e5352c411113640Ivan MolodetskikhParent: 0e9496b
src/layout/mod.rsmodified+8 -2
@@ -4225,8 +4225,14 @@ impl<W: LayoutElement> Layout<W> {
4225 is_floating = unfullscreen_to_floating;4225 is_floating = unfullscreen_to_floating;
4226 }4226 }
4227 4227
4228- // Animate to semitransparent.4228+ if is_floating {
4229- if !is_floating {4229+ // Unlock the view in case we locked it moving a fullscreen window that is
4230+ // going to unfullscreen to floating.
4231+ for ws in self.workspaces_mut() {
4232+ ws.dnd_scroll_gesture_end();
4233+ }
4234+ } else {
4235+ // Animate to semitransparent.
4230 tile.animate_alpha(4236 tile.animate_alpha(
4231 1.,4237 1.,
4232 INTERACTIVE_MOVE_ALPHA,4238 INTERACTIVE_MOVE_ALPHA,
src/layout/tests.rsmodified+38 -0
@@ -3354,6 +3354,44 @@ fn interactive_resize_on_pending_unfullscreen_column() {
3354 check_ops(&ops);3354 check_ops(&ops);
3355 }3355 }
3356 3356
3357+#[test]
3358+fn interactive_move_unfullscreen_to_floating_stops_dnd_scroll() {
3359+ let ops = [
3360+ Op::AddOutput(3),
3361+ Op::AddWindow {
3362+ params: TestWindowParams {
3363+ is_floating: true,
3364+ ..TestWindowParams::new(4)
3365+ },
3366+ },
3367+ // This moves the window to tiling.
3368+ Op::SetFullscreenWindow {
3369+ window: 4,
3370+ is_fullscreen: true,
3371+ },
3372+ // This starts a DnD scroll since we're dragging a tiled window.
3373+ Op::InteractiveMoveBegin {
3374+ window: 4,
3375+ output_idx: 3,
3376+ px: 0.0,
3377+ py: 0.0,
3378+ },
3379+ // This will cause the window to unfullscreen to floating, and should stop the DnD scroll
3380+ // since we're no longer dragging a tiled window, but rather a floating one.
3381+ Op::InteractiveMoveUpdate {
3382+ window: 4,
3383+ dx: 0.0,
3384+ dy: 15035.31210741684,
3385+ output_idx: 3,
3386+ px: 0.0,
3387+ py: 0.0,
3388+ },
3389+ Op::InteractiveMoveEnd { window: 4 },
3390+ ];
3391+
3392+ check_ops(&ops);
3393+}
3394+
3357 fn parent_id_causes_loop(layout: &Layout<TestWindow>, id: usize, mut parent_id: usize) -> bool {3395 fn parent_id_causes_loop(layout: &Layout<TestWindow>, id: usize, mut parent_id: usize) -> bool {
3358 if parent_id == id {3396 if parent_id == id {
3359 return true;3397 return true;