wayland: implement pointer-gestures-unstable-v1
This commit is contained in:
parent
afc360ea85
commit
ee24971c6d
24 changed files with 1589 additions and 18 deletions
|
|
@ -122,6 +122,104 @@ impl JaySeatEvents {
|
|||
time_usec,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_swipe_begin(&self, seat: SeatId, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(SwipeBegin {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
fingers: finger_count,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_swipe_update(
|
||||
&self,
|
||||
seat: SeatId,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
dx_unaccelerated: Fixed,
|
||||
dy_unaccelerated: Fixed,
|
||||
) {
|
||||
self.client.event(SwipeUpdate {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
dx,
|
||||
dy,
|
||||
dx_unaccelerated,
|
||||
dy_unaccelerated,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_swipe_end(&self, seat: SeatId, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(SwipeEnd {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_pinch_begin(&self, seat: SeatId, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(PinchBegin {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
fingers: finger_count,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_pinch_update(
|
||||
&self,
|
||||
seat: SeatId,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
dx_unaccelerated: Fixed,
|
||||
dy_unaccelerated: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
self.client.event(PinchUpdate {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
dx,
|
||||
dy,
|
||||
dx_unaccelerated,
|
||||
dy_unaccelerated,
|
||||
scale,
|
||||
rotation,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_pinch_end(&self, seat: SeatId, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(PinchEnd {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_hold_begin(&self, seat: SeatId, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(HoldBegin {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
fingers: finger_count,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_hold_end(&self, seat: SeatId, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(HoldEnd {
|
||||
self_id: self.id,
|
||||
seat: seat.raw(),
|
||||
time_usec,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl JaySeatEventsRequestHandler for JaySeatEvents {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
mod event_handling;
|
||||
pub mod ext_transient_seat_manager_v1;
|
||||
pub mod ext_transient_seat_v1;
|
||||
mod gesture_owner;
|
||||
mod kb_owner;
|
||||
mod pointer_owner;
|
||||
pub mod text_input;
|
||||
|
|
@ -8,6 +9,10 @@ pub mod wl_keyboard;
|
|||
pub mod wl_pointer;
|
||||
pub mod wl_touch;
|
||||
pub mod zwp_pointer_constraints_v1;
|
||||
pub mod zwp_pointer_gesture_hold_v1;
|
||||
pub mod zwp_pointer_gesture_pinch_v1;
|
||||
pub mod zwp_pointer_gesture_swipe_v1;
|
||||
pub mod zwp_pointer_gestures_v1;
|
||||
pub mod zwp_relative_pointer_manager_v1;
|
||||
pub mod zwp_relative_pointer_v1;
|
||||
pub mod zwp_virtual_keyboard_manager_v1;
|
||||
|
|
@ -37,6 +42,7 @@ use {
|
|||
DynDataSource, IpcError,
|
||||
},
|
||||
wl_seat::{
|
||||
gesture_owner::GestureOwnerHolder,
|
||||
kb_owner::KbOwnerHolder,
|
||||
pointer_owner::PointerOwnerHolder,
|
||||
text_input::{
|
||||
|
|
@ -47,6 +53,9 @@ use {
|
|||
wl_pointer::WlPointer,
|
||||
wl_touch::WlTouch,
|
||||
zwp_pointer_constraints_v1::{SeatConstraint, SeatConstraintStatus},
|
||||
zwp_pointer_gesture_hold_v1::ZwpPointerGestureHoldV1,
|
||||
zwp_pointer_gesture_pinch_v1::ZwpPointerGesturePinchV1,
|
||||
zwp_pointer_gesture_swipe_v1::ZwpPointerGestureSwipeV1,
|
||||
zwp_relative_pointer_v1::ZwpRelativePointerV1,
|
||||
},
|
||||
wl_surface::WlSurface,
|
||||
|
|
@ -62,9 +71,9 @@ use {
|
|||
Node, OutputNode, ToplevelNode, WorkspaceNode,
|
||||
},
|
||||
utils::{
|
||||
asyncevent::AsyncEvent, clonecell::CloneCell, copyhashmap::CopyHashMap,
|
||||
errorfmt::ErrorFmt, linkedlist::LinkedNode, numcell::NumCell, rc_eq::rc_eq,
|
||||
smallmap::SmallMap, transform_ext::TransformExt,
|
||||
asyncevent::AsyncEvent, bindings::PerClientBindings, clonecell::CloneCell,
|
||||
copyhashmap::CopyHashMap, errorfmt::ErrorFmt, linkedlist::LinkedNode, numcell::NumCell,
|
||||
rc_eq::rc_eq, smallmap::SmallMap, transform_ext::TransformExt,
|
||||
},
|
||||
wire::{
|
||||
wl_seat::*, ExtIdleNotificationV1Id, WlDataDeviceId, WlKeyboardId, WlPointerId,
|
||||
|
|
@ -164,6 +173,7 @@ pub struct WlSeatGlobal {
|
|||
primary_selection_serial: Cell<u32>,
|
||||
pointer_owner: PointerOwnerHolder,
|
||||
kb_owner: KbOwnerHolder,
|
||||
gesture_owner: GestureOwnerHolder,
|
||||
dropped_dnd: RefCell<Option<DroppedDnd>>,
|
||||
shortcuts: RefCell<AHashMap<u32, SmallMap<u32, u32, 2>>>,
|
||||
queue_link: Cell<Option<LinkedNode<Rc<Self>>>>,
|
||||
|
|
@ -182,6 +192,9 @@ pub struct WlSeatGlobal {
|
|||
input_method_grab: CloneCell<Option<Rc<ZwpInputMethodKeyboardGrabV2>>>,
|
||||
forward: Cell<bool>,
|
||||
focus_follows_mouse: Cell<bool>,
|
||||
swipe_bindings: PerClientBindings<ZwpPointerGestureSwipeV1>,
|
||||
pinch_bindings: PerClientBindings<ZwpPointerGesturePinchV1>,
|
||||
hold_bindings: PerClientBindings<ZwpPointerGestureHoldV1>,
|
||||
}
|
||||
|
||||
const CHANGE_CURSOR_MOVED: u32 = 1 << 0;
|
||||
|
|
@ -233,6 +246,7 @@ impl WlSeatGlobal {
|
|||
primary_selection_serial: Cell::new(0),
|
||||
pointer_owner: Default::default(),
|
||||
kb_owner: Default::default(),
|
||||
gesture_owner: Default::default(),
|
||||
dropped_dnd: RefCell::new(None),
|
||||
shortcuts: Default::default(),
|
||||
queue_link: Cell::new(None),
|
||||
|
|
@ -252,6 +266,9 @@ impl WlSeatGlobal {
|
|||
input_method_grab: Default::default(),
|
||||
forward: Cell::new(false),
|
||||
focus_follows_mouse: Cell::new(true),
|
||||
swipe_bindings: Default::default(),
|
||||
pinch_bindings: Default::default(),
|
||||
hold_bindings: Default::default(),
|
||||
});
|
||||
state.add_cursor_size(*DEFAULT_CURSOR_SIZE);
|
||||
let seat = slf.clone();
|
||||
|
|
@ -1081,6 +1098,9 @@ impl WlSeatGlobal {
|
|||
self.text_input.take();
|
||||
self.input_method.take();
|
||||
self.input_method_grab.take();
|
||||
self.swipe_bindings.clear();
|
||||
self.pinch_bindings.clear();
|
||||
self.hold_bindings.clear();
|
||||
}
|
||||
|
||||
pub fn id(&self) -> SeatId {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ use {
|
|||
pub struct NodeSeatState {
|
||||
pointer_foci: SmallMap<SeatId, Rc<WlSeatGlobal>, 1>,
|
||||
kb_foci: SmallMap<SeatId, Rc<WlSeatGlobal>, 1>,
|
||||
gesture_foci: SmallMap<SeatId, Rc<WlSeatGlobal>, 1>,
|
||||
pointer_grabs: SmallMap<SeatId, Rc<WlSeatGlobal>, 1>,
|
||||
dnd_targets: SmallMap<SeatId, Rc<WlSeatGlobal>, 1>,
|
||||
}
|
||||
|
|
@ -72,6 +73,14 @@ impl NodeSeatState {
|
|||
self.kb_foci.len() == 0
|
||||
}
|
||||
|
||||
pub(super) fn gesture_begin(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.gesture_foci.insert(seat.id, seat.clone());
|
||||
}
|
||||
|
||||
pub(super) fn gesture_end(&self, seat: &WlSeatGlobal) {
|
||||
self.gesture_foci.remove(&seat.id);
|
||||
}
|
||||
|
||||
pub(super) fn add_pointer_grab(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.pointer_grabs.insert(seat.id, seat.clone());
|
||||
}
|
||||
|
|
@ -130,6 +139,9 @@ impl NodeSeatState {
|
|||
fn destroy_node2(&self, node: &dyn Node, focus_last: bool) {
|
||||
// NOTE: Also called by set_visible(false)
|
||||
|
||||
while let Some((_, seat)) = self.gesture_foci.pop() {
|
||||
seat.gesture_owner.revert_to_default(&seat);
|
||||
}
|
||||
while let Some((_, seat)) = self.pointer_grabs.pop() {
|
||||
seat.pointer_owner.revert_to_default(&seat);
|
||||
}
|
||||
|
|
@ -180,7 +192,15 @@ impl WlSeatGlobal {
|
|||
| InputEvent::ConnectorPosition { time_usec, .. }
|
||||
| InputEvent::Motion { time_usec, .. }
|
||||
| InputEvent::Button { time_usec, .. }
|
||||
| InputEvent::AxisFrame { time_usec, .. } => {
|
||||
| InputEvent::AxisFrame { time_usec, .. }
|
||||
| InputEvent::SwipeBegin { time_usec, .. }
|
||||
| InputEvent::SwipeUpdate { time_usec, .. }
|
||||
| InputEvent::SwipeEnd { time_usec, .. }
|
||||
| InputEvent::PinchBegin { time_usec, .. }
|
||||
| InputEvent::PinchUpdate { time_usec, .. }
|
||||
| InputEvent::PinchEnd { time_usec, .. }
|
||||
| InputEvent::HoldBegin { time_usec, .. }
|
||||
| InputEvent::HoldEnd { time_usec, .. } => {
|
||||
self.last_input_usec.set(time_usec);
|
||||
if self.idle_notifications.is_not_empty() {
|
||||
for (_, notification) in self.idle_notifications.lock().drain() {
|
||||
|
|
@ -231,6 +251,54 @@ impl WlSeatGlobal {
|
|||
} => self.pointer_owner.axis_px(dist, axis, inverted),
|
||||
InputEvent::AxisStop { axis } => self.pointer_owner.axis_stop(axis),
|
||||
InputEvent::AxisFrame { time_usec } => self.pointer_owner.frame(dev, self, time_usec),
|
||||
InputEvent::SwipeBegin {
|
||||
time_usec,
|
||||
finger_count,
|
||||
} => self.swipe_begin(time_usec, finger_count),
|
||||
InputEvent::SwipeUpdate {
|
||||
time_usec,
|
||||
dx,
|
||||
dy,
|
||||
dx_unaccelerated,
|
||||
dy_unaccelerated,
|
||||
} => self.swipe_update(time_usec, dx, dy, dx_unaccelerated, dy_unaccelerated),
|
||||
InputEvent::SwipeEnd {
|
||||
time_usec,
|
||||
cancelled,
|
||||
} => self.swipe_end(time_usec, cancelled),
|
||||
InputEvent::PinchBegin {
|
||||
time_usec,
|
||||
finger_count,
|
||||
} => self.pinch_begin(time_usec, finger_count),
|
||||
InputEvent::PinchUpdate {
|
||||
time_usec,
|
||||
dx,
|
||||
dy,
|
||||
dx_unaccelerated,
|
||||
dy_unaccelerated,
|
||||
scale,
|
||||
rotation,
|
||||
} => self.pinch_update(
|
||||
time_usec,
|
||||
dx,
|
||||
dy,
|
||||
dx_unaccelerated,
|
||||
dy_unaccelerated,
|
||||
scale,
|
||||
rotation,
|
||||
),
|
||||
InputEvent::PinchEnd {
|
||||
time_usec,
|
||||
cancelled,
|
||||
} => self.pinch_end(time_usec, cancelled),
|
||||
InputEvent::HoldBegin {
|
||||
time_usec,
|
||||
finger_count,
|
||||
} => self.hold_begin(time_usec, finger_count),
|
||||
InputEvent::HoldEnd {
|
||||
time_usec,
|
||||
cancelled,
|
||||
} => self.hold_end(time_usec, cancelled),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -345,6 +413,97 @@ impl WlSeatGlobal {
|
|||
self.pointer_owner.button(self, time_usec, button, state);
|
||||
}
|
||||
|
||||
fn swipe_begin(self: &Rc<Self>, time_usec: u64, finger_count: u32) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_swipe_begin(self.id, time_usec, finger_count);
|
||||
});
|
||||
self.gesture_owner
|
||||
.swipe_begin(self, time_usec, finger_count)
|
||||
}
|
||||
|
||||
fn swipe_update(
|
||||
self: &Rc<Self>,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
dx_unaccelerated: Fixed,
|
||||
dy_unaccelerated: Fixed,
|
||||
) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_swipe_update(
|
||||
self.id,
|
||||
time_usec,
|
||||
dx,
|
||||
dy,
|
||||
dx_unaccelerated,
|
||||
dy_unaccelerated,
|
||||
);
|
||||
});
|
||||
self.gesture_owner.swipe_update(self, time_usec, dx, dy)
|
||||
}
|
||||
|
||||
fn swipe_end(self: &Rc<Self>, time_usec: u64, cancelled: bool) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_swipe_end(self.id, time_usec, cancelled);
|
||||
});
|
||||
self.gesture_owner.swipe_end(self, time_usec, cancelled)
|
||||
}
|
||||
|
||||
fn pinch_begin(self: &Rc<Self>, time_usec: u64, finger_count: u32) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_pinch_begin(self.id, time_usec, finger_count);
|
||||
});
|
||||
self.gesture_owner
|
||||
.pinch_begin(self, time_usec, finger_count)
|
||||
}
|
||||
|
||||
fn pinch_update(
|
||||
self: &Rc<Self>,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
dx_unaccelerated: Fixed,
|
||||
dy_unaccelerated: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_pinch_update(
|
||||
self.id,
|
||||
time_usec,
|
||||
dx,
|
||||
dy,
|
||||
dx_unaccelerated,
|
||||
dy_unaccelerated,
|
||||
scale,
|
||||
rotation,
|
||||
);
|
||||
});
|
||||
self.gesture_owner
|
||||
.pinch_update(self, time_usec, dx, dy, scale, rotation)
|
||||
}
|
||||
|
||||
fn pinch_end(self: &Rc<Self>, time_usec: u64, cancelled: bool) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_pinch_end(self.id, time_usec, cancelled);
|
||||
});
|
||||
self.gesture_owner.pinch_end(self, time_usec, cancelled)
|
||||
}
|
||||
|
||||
fn hold_begin(self: &Rc<Self>, time_usec: u64, finger_count: u32) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_hold_begin(self.id, time_usec, finger_count);
|
||||
});
|
||||
self.gesture_owner.hold_begin(self, time_usec, finger_count)
|
||||
}
|
||||
|
||||
fn hold_end(self: &Rc<Self>, time_usec: u64, cancelled: bool) {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_hold_end(self.id, time_usec, cancelled);
|
||||
});
|
||||
self.gesture_owner.hold_end(self, time_usec, cancelled)
|
||||
}
|
||||
|
||||
pub(super) fn key_event<F>(
|
||||
self: &Rc<Self>,
|
||||
time_usec: u64,
|
||||
|
|
@ -935,3 +1094,76 @@ impl WlSeatGlobal {
|
|||
// surface.client.flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Gesture callbacks
|
||||
impl WlSeatGlobal {
|
||||
pub fn swipe_begin_surface(&self, n: &WlSurface, time_usec: u64, finger_count: u32) {
|
||||
let serial = n.client.next_serial();
|
||||
self.swipe_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_swipe_begin(n, serial, time_usec, finger_count)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn swipe_update_surface(&self, n: &WlSurface, time_usec: u64, dx: Fixed, dy: Fixed) {
|
||||
self.swipe_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_swipe_update(time_usec, dx, dy)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn swipe_end_surface(&self, n: &WlSurface, time_usec: u64, cancelled: bool) {
|
||||
let serial = n.client.next_serial();
|
||||
self.swipe_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_swipe_end(serial, time_usec, cancelled)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn pinch_begin_surface(&self, n: &WlSurface, time_usec: u64, finger_count: u32) {
|
||||
let serial = n.client.next_serial();
|
||||
self.pinch_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_pinch_begin(n, serial, time_usec, finger_count)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn pinch_update_surface(
|
||||
&self,
|
||||
n: &WlSurface,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
self.pinch_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_pinch_update(time_usec, dx, dy, scale, rotation)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn pinch_end_surface(&self, n: &WlSurface, time_usec: u64, cancelled: bool) {
|
||||
let serial = n.client.next_serial();
|
||||
self.pinch_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_pinch_end(serial, time_usec, cancelled)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn hold_begin_surface(&self, n: &WlSurface, time_usec: u64, finger_count: u32) {
|
||||
let serial = n.client.next_serial();
|
||||
self.hold_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_hold_begin(n, serial, time_usec, finger_count)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn hold_end_surface(&self, n: &WlSurface, time_usec: u64, cancelled: bool) {
|
||||
let serial = n.client.next_serial();
|
||||
self.hold_bindings
|
||||
.for_each(n.client.id, Version::ALL, |obj| {
|
||||
obj.send_hold_end(serial, time_usec, cancelled)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
239
src/ifs/wl_seat/gesture_owner.rs
Normal file
239
src/ifs/wl_seat/gesture_owner.rs
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
use {
|
||||
crate::{
|
||||
fixed::Fixed, ifs::wl_seat::WlSeatGlobal, time::now_usec, tree::Node,
|
||||
utils::clonecell::CloneCell,
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub struct GestureOwnerHolder {
|
||||
default: Rc<NoGesture>,
|
||||
owner: CloneCell<Rc<dyn GestureOwner>>,
|
||||
}
|
||||
|
||||
impl Default for GestureOwnerHolder {
|
||||
fn default() -> Self {
|
||||
let default = Rc::new(NoGesture);
|
||||
Self {
|
||||
owner: CloneCell::new(default.clone()),
|
||||
default,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GestureOwnerHolder {
|
||||
pub fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.owner.get().revert_to_default(seat);
|
||||
self.set_default_owner();
|
||||
}
|
||||
|
||||
pub fn swipe_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
self.owner.get().swipe_begin(seat, time_usec, finger_count)
|
||||
}
|
||||
|
||||
pub fn swipe_update(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, dx: Fixed, dy: Fixed) {
|
||||
self.owner.get().swipe_update(seat, time_usec, dx, dy)
|
||||
}
|
||||
|
||||
pub fn swipe_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
self.owner.get().swipe_end(seat, time_usec, cancelled)
|
||||
}
|
||||
|
||||
pub fn pinch_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
self.owner.get().pinch_begin(seat, time_usec, finger_count)
|
||||
}
|
||||
|
||||
pub fn pinch_update(
|
||||
&self,
|
||||
seat: &Rc<WlSeatGlobal>,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
self.owner
|
||||
.get()
|
||||
.pinch_update(seat, time_usec, dx, dy, scale, rotation)
|
||||
}
|
||||
|
||||
pub fn pinch_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
self.owner.get().pinch_end(seat, time_usec, cancelled)
|
||||
}
|
||||
|
||||
pub fn hold_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
self.owner.get().hold_begin(seat, time_usec, finger_count)
|
||||
}
|
||||
|
||||
pub fn hold_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
self.owner.get().hold_end(seat, time_usec, cancelled)
|
||||
}
|
||||
|
||||
fn set_default_owner(&self) {
|
||||
self.owner.set(self.default.clone());
|
||||
}
|
||||
}
|
||||
|
||||
trait GestureOwner {
|
||||
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>);
|
||||
|
||||
fn swipe_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = finger_count;
|
||||
}
|
||||
|
||||
fn swipe_update(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, dx: Fixed, dy: Fixed) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = dx;
|
||||
let _ = dy;
|
||||
}
|
||||
|
||||
fn swipe_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = cancelled;
|
||||
}
|
||||
|
||||
fn pinch_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = finger_count;
|
||||
}
|
||||
|
||||
fn pinch_update(
|
||||
&self,
|
||||
seat: &Rc<WlSeatGlobal>,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = dx;
|
||||
let _ = dy;
|
||||
let _ = scale;
|
||||
let _ = rotation;
|
||||
}
|
||||
|
||||
fn pinch_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = cancelled;
|
||||
}
|
||||
|
||||
fn hold_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = finger_count;
|
||||
}
|
||||
|
||||
fn hold_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
let _ = cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
struct NoGesture;
|
||||
|
||||
impl GestureOwner for NoGesture {
|
||||
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
let _ = seat;
|
||||
}
|
||||
|
||||
fn swipe_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
let Some(node) = seat.pointer_node() else {
|
||||
return;
|
||||
};
|
||||
node.node_seat_state().gesture_begin(seat);
|
||||
node.node_on_swipe_begin(seat, time_usec, finger_count);
|
||||
seat.gesture_owner.owner.set(Rc::new(SwipeGesture { node }));
|
||||
}
|
||||
|
||||
fn pinch_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
let Some(node) = seat.pointer_node() else {
|
||||
return;
|
||||
};
|
||||
node.node_seat_state().gesture_begin(seat);
|
||||
node.node_on_pinch_begin(seat, time_usec, finger_count);
|
||||
seat.gesture_owner.owner.set(Rc::new(PinchGesture { node }));
|
||||
}
|
||||
|
||||
fn hold_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
let Some(node) = seat.pointer_node() else {
|
||||
return;
|
||||
};
|
||||
node.node_seat_state().gesture_begin(seat);
|
||||
node.node_on_hold_begin(seat, time_usec, finger_count);
|
||||
seat.gesture_owner.owner.set(Rc::new(HoldGesture { node }));
|
||||
}
|
||||
}
|
||||
|
||||
struct SwipeGesture {
|
||||
node: Rc<dyn Node>,
|
||||
}
|
||||
|
||||
impl GestureOwner for SwipeGesture {
|
||||
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.swipe_end(seat, now_usec(), true);
|
||||
}
|
||||
|
||||
fn swipe_update(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, dx: Fixed, dy: Fixed) {
|
||||
self.node.node_on_swipe_update(seat, time_usec, dx, dy);
|
||||
}
|
||||
|
||||
fn swipe_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
self.node.node_on_swipe_end(seat, time_usec, cancelled);
|
||||
self.node.node_seat_state().gesture_end(seat);
|
||||
seat.gesture_owner.set_default_owner();
|
||||
}
|
||||
}
|
||||
|
||||
struct PinchGesture {
|
||||
node: Rc<dyn Node>,
|
||||
}
|
||||
|
||||
impl GestureOwner for PinchGesture {
|
||||
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.pinch_end(seat, now_usec(), true);
|
||||
}
|
||||
|
||||
fn pinch_update(
|
||||
&self,
|
||||
seat: &Rc<WlSeatGlobal>,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
self.node
|
||||
.node_on_pinch_update(seat, time_usec, dx, dy, scale, rotation)
|
||||
}
|
||||
|
||||
fn pinch_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
self.node.node_on_pinch_end(seat, time_usec, cancelled);
|
||||
self.node.node_seat_state().gesture_end(seat);
|
||||
seat.gesture_owner.set_default_owner();
|
||||
}
|
||||
}
|
||||
|
||||
struct HoldGesture {
|
||||
node: Rc<dyn Node>,
|
||||
}
|
||||
|
||||
impl GestureOwner for HoldGesture {
|
||||
fn revert_to_default(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
self.hold_end(seat, now_usec(), true);
|
||||
}
|
||||
|
||||
fn hold_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
self.node.node_on_hold_end(seat, time_usec, cancelled);
|
||||
self.node.node_seat_state().gesture_end(seat);
|
||||
seat.gesture_owner.set_default_owner();
|
||||
}
|
||||
}
|
||||
74
src/ifs/wl_seat/zwp_pointer_gesture_hold_v1.rs
Normal file
74
src/ifs/wl_seat/zwp_pointer_gesture_hold_v1.rs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{Client, ClientError},
|
||||
ifs::{wl_seat::WlSeatGlobal, wl_surface::WlSurface},
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
wire::{zwp_pointer_gesture_hold_v1::*, ZwpPointerGestureHoldV1Id},
|
||||
},
|
||||
std::rc::Rc,
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
pub struct ZwpPointerGestureHoldV1 {
|
||||
pub id: ZwpPointerGestureHoldV1Id,
|
||||
pub client: Rc<Client>,
|
||||
pub seat: Rc<WlSeatGlobal>,
|
||||
pub tracker: Tracker<Self>,
|
||||
pub version: Version,
|
||||
}
|
||||
|
||||
impl ZwpPointerGestureHoldV1 {
|
||||
fn detach(&self) {
|
||||
self.seat.hold_bindings.remove(&self.client, self);
|
||||
}
|
||||
|
||||
pub fn send_hold_begin(&self, n: &WlSurface, serial: u32, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(Begin {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time: (time_usec / 1000) as u32,
|
||||
surface: n.id,
|
||||
fingers: finger_count,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_hold_end(&self, serial: u32, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(End {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time: (time_usec / 1000) as u32,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl ZwpPointerGestureHoldV1RequestHandler for ZwpPointerGestureHoldV1 {
|
||||
type Error = ZwpPointerGestureHoldV1Error;
|
||||
|
||||
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
self.detach();
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
object_base! {
|
||||
self = ZwpPointerGestureHoldV1;
|
||||
version = self.version;
|
||||
}
|
||||
|
||||
impl Object for ZwpPointerGestureHoldV1 {
|
||||
fn break_loops(&self) {
|
||||
self.detach();
|
||||
}
|
||||
}
|
||||
|
||||
simple_add_obj!(ZwpPointerGestureHoldV1);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPointerGestureHoldV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ZwpPointerGestureHoldV1Error, ClientError);
|
||||
93
src/ifs/wl_seat/zwp_pointer_gesture_pinch_v1.rs
Normal file
93
src/ifs/wl_seat/zwp_pointer_gesture_pinch_v1.rs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{Client, ClientError},
|
||||
fixed::Fixed,
|
||||
ifs::{wl_seat::WlSeatGlobal, wl_surface::WlSurface},
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
wire::{zwp_pointer_gesture_pinch_v1::*, ZwpPointerGesturePinchV1Id},
|
||||
},
|
||||
std::rc::Rc,
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
pub struct ZwpPointerGesturePinchV1 {
|
||||
pub id: ZwpPointerGesturePinchV1Id,
|
||||
pub client: Rc<Client>,
|
||||
pub seat: Rc<WlSeatGlobal>,
|
||||
pub tracker: Tracker<Self>,
|
||||
pub version: Version,
|
||||
}
|
||||
|
||||
impl ZwpPointerGesturePinchV1 {
|
||||
fn detach(&self) {
|
||||
self.seat.pinch_bindings.remove(&self.client, self);
|
||||
}
|
||||
|
||||
pub fn send_pinch_begin(&self, n: &WlSurface, serial: u32, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(Begin {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time: (time_usec / 1000) as u32,
|
||||
surface: n.id,
|
||||
fingers: finger_count,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_pinch_update(
|
||||
&self,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
self.client.event(Update {
|
||||
self_id: self.id,
|
||||
time: (time_usec / 1000) as u32,
|
||||
dx,
|
||||
dy,
|
||||
scale,
|
||||
rotation,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_pinch_end(&self, serial: u32, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(End {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time: (time_usec / 1000) as u32,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl ZwpPointerGesturePinchV1RequestHandler for ZwpPointerGesturePinchV1 {
|
||||
type Error = ZwpPointerGesturePinchV1Error;
|
||||
|
||||
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
self.detach();
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
object_base! {
|
||||
self = ZwpPointerGesturePinchV1;
|
||||
version = self.version;
|
||||
}
|
||||
|
||||
impl Object for ZwpPointerGesturePinchV1 {
|
||||
fn break_loops(&self) {
|
||||
self.detach();
|
||||
}
|
||||
}
|
||||
|
||||
simple_add_obj!(ZwpPointerGesturePinchV1);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPointerGesturePinchV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ZwpPointerGesturePinchV1Error, ClientError);
|
||||
84
src/ifs/wl_seat/zwp_pointer_gesture_swipe_v1.rs
Normal file
84
src/ifs/wl_seat/zwp_pointer_gesture_swipe_v1.rs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{Client, ClientError},
|
||||
fixed::Fixed,
|
||||
ifs::{wl_seat::WlSeatGlobal, wl_surface::WlSurface},
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
wire::{zwp_pointer_gesture_swipe_v1::*, ZwpPointerGestureSwipeV1Id},
|
||||
},
|
||||
std::rc::Rc,
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
pub struct ZwpPointerGestureSwipeV1 {
|
||||
pub id: ZwpPointerGestureSwipeV1Id,
|
||||
pub client: Rc<Client>,
|
||||
pub seat: Rc<WlSeatGlobal>,
|
||||
pub tracker: Tracker<Self>,
|
||||
pub version: Version,
|
||||
}
|
||||
|
||||
impl ZwpPointerGestureSwipeV1 {
|
||||
fn detach(&self) {
|
||||
self.seat.swipe_bindings.remove(&self.client, self);
|
||||
}
|
||||
|
||||
pub fn send_swipe_begin(&self, n: &WlSurface, serial: u32, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(Begin {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time: (time_usec / 1000) as u32,
|
||||
surface: n.id,
|
||||
fingers: finger_count,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_swipe_update(&self, time_usec: u64, dx: Fixed, dy: Fixed) {
|
||||
self.client.event(Update {
|
||||
self_id: self.id,
|
||||
time: (time_usec / 1000) as u32,
|
||||
dx,
|
||||
dy,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_swipe_end(&self, serial: u32, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(End {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
time: (time_usec / 1000) as u32,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl ZwpPointerGestureSwipeV1RequestHandler for ZwpPointerGestureSwipeV1 {
|
||||
type Error = ZwpPointerGestureSwipeV1Error;
|
||||
|
||||
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
self.detach();
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
object_base! {
|
||||
self = ZwpPointerGestureSwipeV1;
|
||||
version = self.version;
|
||||
}
|
||||
|
||||
impl Object for ZwpPointerGestureSwipeV1 {
|
||||
fn break_loops(&self) {
|
||||
self.detach();
|
||||
}
|
||||
}
|
||||
|
||||
simple_add_obj!(ZwpPointerGestureSwipeV1);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPointerGestureSwipeV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ZwpPointerGestureSwipeV1Error, ClientError);
|
||||
135
src/ifs/wl_seat/zwp_pointer_gestures_v1.rs
Normal file
135
src/ifs/wl_seat/zwp_pointer_gestures_v1.rs
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{Client, ClientError},
|
||||
globals::{Global, GlobalName},
|
||||
ifs::wl_seat::{
|
||||
zwp_pointer_gesture_hold_v1::ZwpPointerGestureHoldV1,
|
||||
zwp_pointer_gesture_pinch_v1::ZwpPointerGesturePinchV1,
|
||||
zwp_pointer_gesture_swipe_v1::ZwpPointerGestureSwipeV1,
|
||||
},
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
wire::{zwp_pointer_gestures_v1::*, ZwpPointerGesturesV1Id},
|
||||
},
|
||||
std::rc::Rc,
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
pub struct ZwpPointerGesturesV1Global {
|
||||
pub name: GlobalName,
|
||||
}
|
||||
|
||||
pub struct ZwpPointerGesturesV1 {
|
||||
pub id: ZwpPointerGesturesV1Id,
|
||||
pub client: Rc<Client>,
|
||||
pub tracker: Tracker<Self>,
|
||||
pub version: Version,
|
||||
}
|
||||
|
||||
impl ZwpPointerGesturesV1Global {
|
||||
pub fn new(name: GlobalName) -> Self {
|
||||
Self { name }
|
||||
}
|
||||
|
||||
fn bind_(
|
||||
self: Rc<Self>,
|
||||
id: ZwpPointerGesturesV1Id,
|
||||
client: &Rc<Client>,
|
||||
version: Version,
|
||||
) -> Result<(), ZwpPointerGesturesV1Error> {
|
||||
let obj = Rc::new(ZwpPointerGesturesV1 {
|
||||
id,
|
||||
client: client.clone(),
|
||||
tracker: Default::default(),
|
||||
version,
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
global_base!(
|
||||
ZwpPointerGesturesV1Global,
|
||||
ZwpPointerGesturesV1,
|
||||
ZwpPointerGesturesV1Error
|
||||
);
|
||||
|
||||
impl Global for ZwpPointerGesturesV1Global {
|
||||
fn singleton(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn version(&self) -> u32 {
|
||||
3
|
||||
}
|
||||
}
|
||||
|
||||
simple_add_global!(ZwpPointerGesturesV1Global);
|
||||
|
||||
impl ZwpPointerGesturesV1RequestHandler for ZwpPointerGesturesV1 {
|
||||
type Error = ZwpPointerGesturesV1Error;
|
||||
|
||||
fn get_swipe_gesture(&self, req: GetSwipeGesture, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let seat = self.client.lookup(req.pointer)?.seat.global.clone();
|
||||
let obj = Rc::new(ZwpPointerGestureSwipeV1 {
|
||||
id: req.id,
|
||||
client: self.client.clone(),
|
||||
seat: seat.clone(),
|
||||
tracker: Default::default(),
|
||||
version: self.version,
|
||||
});
|
||||
self.client.add_client_obj(&obj)?;
|
||||
seat.swipe_bindings.add(&self.client, &obj);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_pinch_gesture(&self, req: GetPinchGesture, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let seat = self.client.lookup(req.pointer)?.seat.global.clone();
|
||||
let obj = Rc::new(ZwpPointerGesturePinchV1 {
|
||||
id: req.id,
|
||||
client: self.client.clone(),
|
||||
seat: seat.clone(),
|
||||
tracker: Default::default(),
|
||||
version: self.version,
|
||||
});
|
||||
self.client.add_client_obj(&obj)?;
|
||||
seat.pinch_bindings.add(&self.client, &obj);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn release(&self, _req: Release, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_hold_gesture(&self, req: GetHoldGesture, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let seat = self.client.lookup(req.pointer)?.seat.global.clone();
|
||||
let obj = Rc::new(ZwpPointerGestureHoldV1 {
|
||||
id: req.id,
|
||||
client: self.client.clone(),
|
||||
seat: seat.clone(),
|
||||
tracker: Default::default(),
|
||||
version: self.version,
|
||||
});
|
||||
self.client.add_client_obj(&obj)?;
|
||||
seat.hold_bindings.add(&self.client, &obj);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
object_base! {
|
||||
self = ZwpPointerGesturesV1;
|
||||
version = self.version;
|
||||
}
|
||||
|
||||
impl Object for ZwpPointerGesturesV1 {}
|
||||
|
||||
simple_add_obj!(ZwpPointerGesturesV1);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPointerGesturesV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ZwpPointerGesturesV1Error, ClientError);
|
||||
|
|
@ -1507,6 +1507,46 @@ impl Node for WlSurface {
|
|||
fn node_is_xwayland_surface(&self) -> bool {
|
||||
self.client.is_xwayland
|
||||
}
|
||||
|
||||
fn node_on_swipe_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
seat.swipe_begin_surface(self, time_usec, finger_count)
|
||||
}
|
||||
|
||||
fn node_on_swipe_update(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, dx: Fixed, dy: Fixed) {
|
||||
seat.swipe_update_surface(self, time_usec, dx, dy)
|
||||
}
|
||||
|
||||
fn node_on_swipe_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
seat.swipe_end_surface(self, time_usec, cancelled)
|
||||
}
|
||||
|
||||
fn node_on_pinch_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
seat.pinch_begin_surface(self, time_usec, finger_count)
|
||||
}
|
||||
|
||||
fn node_on_pinch_update(
|
||||
&self,
|
||||
seat: &Rc<WlSeatGlobal>,
|
||||
time_usec: u64,
|
||||
dx: Fixed,
|
||||
dy: Fixed,
|
||||
scale: Fixed,
|
||||
rotation: Fixed,
|
||||
) {
|
||||
seat.pinch_update_surface(self, time_usec, dx, dy, scale, rotation)
|
||||
}
|
||||
|
||||
fn node_on_pinch_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
seat.pinch_end_surface(self, time_usec, cancelled)
|
||||
}
|
||||
|
||||
fn node_on_hold_begin(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, finger_count: u32) {
|
||||
seat.hold_begin_surface(self, time_usec, finger_count)
|
||||
}
|
||||
|
||||
fn node_on_hold_end(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64, cancelled: bool) {
|
||||
seat.hold_end_surface(self, time_usec, cancelled)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue