Skip to content

Commit 010a236

Browse files
committed
Start interactive move on Mod+Touch
1 parent 1951d2a commit 010a236

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/input/mod.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use smithay::input::SeatHandler;
3131
use smithay::utils::{Logical, Point, Rectangle, Transform, SERIAL_COUNTER};
3232
use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
3333
use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
34+
use touch_move_grab::TouchMoveGrab;
3435

3536
use self::move_grab::MoveGrab;
3637
use self::resize_grab::ResizeGrab;
@@ -2353,12 +2354,40 @@ impl State {
23532354
return;
23542355
};
23552356

2357+
let serial = SERIAL_COUNTER.next_serial();
2358+
23562359
let under = self.niri.contents_under(touch_location);
23572360

23582361
if !handle.is_grabbed() {
23592362
if let Some(window) = under.window {
23602363
self.niri.layout.activate_window(&window);
23612364

2365+
// Check if we need to start an interactive move.
2366+
let mods = self.niri.seat.get_keyboard().unwrap().modifier_state();
2367+
let mod_down = match self.backend.mod_key() {
2368+
CompositorMod::Super => mods.logo,
2369+
CompositorMod::Alt => mods.alt,
2370+
};
2371+
if mod_down {
2372+
let (output, pos_within_output) =
2373+
self.niri.output_under(touch_location).unwrap();
2374+
let output = output.clone();
2375+
2376+
if self.niri.layout.interactive_move_begin(
2377+
window.clone(),
2378+
&output,
2379+
pos_within_output,
2380+
) {
2381+
let start_data = TouchGrabStartData {
2382+
focus: None,
2383+
slot: evt.slot(),
2384+
location: touch_location,
2385+
};
2386+
let grab = TouchMoveGrab::new(start_data, window.clone());
2387+
handle.set_grab(self, grab, serial);
2388+
}
2389+
}
2390+
23622391
// FIXME: granular.
23632392
self.niri.queue_redraw_all();
23642393
} else if let Some(output) = under.output {
@@ -2370,7 +2399,6 @@ impl State {
23702399
self.niri.focus_layer_surface_if_on_demand(under.layer);
23712400
};
23722401

2373-
let serial = SERIAL_COUNTER.next_serial();
23742402
handle.down(
23752403
self,
23762404
under.surface,

0 commit comments

Comments
 (0)