1
0
Fork 0
forked from wry/wry

it: test natural scrolling

This commit is contained in:
Julian Orth 2024-04-02 10:26:42 +02:00
parent f562f887f0
commit adf6d2ae2b
12 changed files with 149 additions and 2 deletions

View file

@ -1,6 +1,7 @@
use {
crate::{
client::{ClientId, RequestParser},
fixed::Fixed,
ifs::wl_seat::WlSeatGlobal,
it::{
test_backend::{TestBackend, TestBackendKb, TestBackendMouse, TestConnector},
@ -146,3 +147,12 @@ pub struct DefaultSetup {
pub mouse: Rc<TestBackendMouse>,
pub seat: Rc<WlSeatGlobal>,
}
impl DefaultSetup {
pub fn move_to(&self, x: i32, y: i32) {
let (ox, oy) = self.seat.position();
let (nx, ny) = (Fixed::from_int(x), Fixed::from_int(y));
let (dx, dy) = (nx - ox, ny - oy);
self.mouse.rel(dx.to_f64(), dy.to_f64())
}
}