Mouse drag doesn't work
First of all, thank you for this library.
When I tried the example https://github.com/Narsil/rdev/blob/main/examples/grab.rs, it prints mouse move and click events. But, when I click and move the mouse while the mouse button is being clicked, it doesn't print those events. I expect MouseMove events to be printed between the ButtonPress(Left) and ButtonRelease(Left) events.
Here's the output:
My callback Event { time: SystemTime { tv_sec: 1677442442, tv_nsec: 943688000 }, name: None, event_type: ButtonPress(Left) }
My callback Event { time: SystemTime { tv_sec: 1677442448, tv_nsec: 466498000 }, name: None, event_type: ButtonRelease(Left) }
My callback Event { time: SystemTime { tv_sec: 1677442448, tv_nsec: 466626000 }, name: None, event_type: MouseMove { x: 474.41796875, y: 1146.15625 } }
Here's what I expect:
My callback Event { time: SystemTime { tv_sec: 1677442442, tv_nsec: 943688000 }, name: None, event_type: ButtonPress(Left) }
My callback Event { time: SystemTime { tv_sec: 1677442448, tv_nsec: 466626000 }, name: None, event_type: MouseMove { x: 123, y: 123 } }
My callback Event { time: SystemTime { tv_sec: 1677442448, tv_nsec: 466626000 }, name: None, event_type: MouseMove { x: 124, y: 124 } }
...
My callback Event { time: SystemTime { tv_sec: 1677442448, tv_nsec: 466498000 }, name: None, event_type: ButtonRelease(Left) }
My callback Event { time: SystemTime { tv_sec: 1677442448, tv_nsec: 466626000 }, name: None, event_type: MouseMove { x: 474.41796875, y: 1146.15625 } }
I'm using macOS Ventura 13.1 and rdev version 0.5.2.
I also encountered this problem in macOS Ventura 13.4 and rdev 0.5.3. Did you solve it?
grabbing is unstable (it's really hard to make an OS independant API for it as not everything is even grabbable)
. Does the listen work ?
listen also doesn't work.
Here is my try:
fn main() {
if let Err(error) = listen(callback) {
println!("Error: {:?}", error)
}
fn callback(event: Event) {
println!("My callback {:?}", event);
match event.event_type {
EventType::ButtonPress(button) => match button {
Button::Right => {
println!("right btn press");
},
_ => (),
},
EventType::ButtonRelease(button) => match button {
Button::Right => {
println!("right btn release");
},
_ => (),
},
EventType::MouseMove { x, y } => {
println!("x: {}, y: {}", x, y);
},
_ => (),
}
}
}
This is output when I press right button, then move the mouse, and finally release right button.
My callback Event { time: SystemTime { tv_sec: 1688384409, tv_nsec: 912707000 }, name: None, event_type: ButtonPress(Right) }
right btn press
My callback Event { time: SystemTime { tv_sec: 1688384414, tv_nsec: 232347000 }, name: None, event_type: ButtonRelease(Right) }
right btn release
Did you find a solution to this?