Skip to content

Commit 49ae072

Browse files
committed
pinnacle: rust: allow touch input for move & resize
1 parent abbb922 commit 49ae072

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

api/rust/src/window.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use pinnacle_api_defs::pinnacle::{
2424
MoveToTagRequest, RaiseRequest, ResizeGrabRequest, ResizeTileRequest,
2525
SetDecorationModeRequest, SetFloatingRequest, SetFocusedRequest, SetFullscreenRequest,
2626
SetGeometryRequest, SetMaximizedRequest, SetTagRequest, SetTagsRequest,
27-
SetVrrDemandRequest, SwapRequest,
27+
SetVrrDemandRequest, SwapRequest, TouchMoveGrabRequest, TouchResizeGrabRequest,
2828
},
2929
},
3030
};
@@ -142,6 +142,30 @@ pub fn begin_resize(button: MouseButton) {
142142
.unwrap();
143143
}
144144

145+
/// Begins a touch-driven interactive window move.
146+
///
147+
/// This will start moving the window under the given finger until it's lifted.
148+
///
149+
/// `finger_id` should correspond to the finger that triggered this function to be called.
150+
pub fn begin_touch_move(finger_id: u32) {
151+
Client::window()
152+
.touch_move_grab(TouchMoveGrabRequest { finger_id })
153+
.block_on_tokio()
154+
.unwrap();
155+
}
156+
157+
/// Begins a touch-driven interactive window resize.
158+
///
159+
/// This will start resizing the window under the given finger until it's lifted.
160+
///
161+
/// `finger_id` should correspond to the finger that triggered this function to be called.
162+
pub fn begin_touch_resize(finger_id: u32) {
163+
Client::window()
164+
.touch_resize_grab(TouchResizeGrabRequest { finger_id })
165+
.block_on_tokio()
166+
.unwrap();
167+
}
168+
145169
/// Connects to a [`WindowSignal`].
146170
///
147171
/// # Examples

0 commit comments

Comments
 (0)