forge
Explore
Log in

Don't you dare go Hollow

Start interactive move on Mod+Touch

Browse files at this commit

010a2368823bc3959c1468609cd05367e5b6d0b6Ivan MolodetskikhParent: 1951d2a
src/input/mod.rsmodified+29 -1
@@ -31,6 +31,7 @@ use smithay::input::SeatHandler;
31 use smithay::utils::{Logical, Point, Rectangle, Transform, SERIAL_COUNTER};31 use smithay::utils::{Logical, Point, Rectangle, Transform, SERIAL_COUNTER};
32 use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};32 use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
33 use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};33 use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
34+use touch_move_grab::TouchMoveGrab;
34 35
35 use self::move_grab::MoveGrab;36 use self::move_grab::MoveGrab;
36 use self::resize_grab::ResizeGrab;37 use self::resize_grab::ResizeGrab;
@@ -2353,12 +2354,40 @@ impl State {
2353 return;2354 return;
2354 };2355 };
2355 2356
2357+ let serial = SERIAL_COUNTER.next_serial();
2358+
2356 let under = self.niri.contents_under(touch_location);2359 let under = self.niri.contents_under(touch_location);
2357 2360
2358 if !handle.is_grabbed() {2361 if !handle.is_grabbed() {
2359 if let Some(window) = under.window {2362 if let Some(window) = under.window {
2360 self.niri.layout.activate_window(&window);2363 self.niri.layout.activate_window(&window);
2361 2364
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+
2362 // FIXME: granular.2391 // FIXME: granular.
2363 self.niri.queue_redraw_all();2392 self.niri.queue_redraw_all();
2364 } else if let Some(output) = under.output {2393 } else if let Some(output) = under.output {
@@ -2370,7 +2399,6 @@ impl State {
2370 self.niri.focus_layer_surface_if_on_demand(under.layer);2399 self.niri.focus_layer_surface_if_on_demand(under.layer);
2371 };2400 };
2372 2401
2373- let serial = SERIAL_COUNTER.next_serial();
2374 handle.down(2402 handle.down(
2375 self,2403 self,
2376 under.surface,2404 under.surface,