enable experimental smooth scrolling support
This commit is contained in:
@@ -38,7 +38,7 @@ While the device-handling code itself is somewhat messy at the moment, it should
|
||||
- [x] Volume Controls
|
||||
- [x] Media Controls
|
||||
- [x] Scrolling - using a virtual mouse-wheel
|
||||
- [ ] Scrolling - using a virtual touchpad (for [smoother scrolling](https://who-t.blogspot.com/2020/04/high-resolution-wheel-scrolling-in.html)) - **WIP**
|
||||
- [x] Scrolling - using a virtual touchpad (for [smoother scrolling](https://who-t.blogspot.com/2020/04/high-resolution-wheel-scrolling-in.html)) - **EXPERIMENTAL**
|
||||
- [x] Zooming
|
||||
- [x] [Paddle](https://www.google.com/search?q=arkanoid+paddle) (emulated left, right, and space key)
|
||||
- [ ] \(meta\) custom modes specified via config file(s)
|
||||
|
||||
@@ -16,7 +16,7 @@ impl ScrollMT {
|
||||
impl ControlMode for ScrollMT {
|
||||
fn meta(&self) -> ControlModeMeta {
|
||||
ControlModeMeta {
|
||||
name: "Scroll",
|
||||
name: "Scroll (Fake Multitouch - EXPERIMENTAL)",
|
||||
icon: "input-mouse",
|
||||
haptics: false,
|
||||
steps: 3600,
|
||||
@@ -26,7 +26,13 @@ impl ControlMode for ScrollMT {
|
||||
fn on_start(&mut self, _haptics: &DialHaptics) -> Result<()> {
|
||||
self.acc_delta = 0;
|
||||
|
||||
fake_input::scroll_mt_start().map_err(Error::Evdev)?;
|
||||
// HACK: for some reason, if scroll mode is the startup mode, then just calling
|
||||
// `scroll_mt_start` doesn't work as expected.
|
||||
std::thread::spawn(move || {
|
||||
fake_input::scroll_mt_end().unwrap();
|
||||
std::thread::sleep(std::time::Duration::from_millis(200));
|
||||
fake_input::scroll_mt_start().unwrap();
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ use parking_lot::ReentrantMutex;
|
||||
|
||||
// this should be a fairly high number, as the axis is from 0..(MT_BASELINE*2)
|
||||
const MT_BASELINE: i32 = std::i32::MAX / 8;
|
||||
// higher = more sensitive
|
||||
const MT_SENSITIVITY: i32 = 64;
|
||||
// higher = slower scrolling
|
||||
const MT_SENSITIVITY: i32 = 48;
|
||||
|
||||
pub struct FakeInputs {
|
||||
keyboard: ReentrantMutex<UInputDevice>,
|
||||
|
||||
@@ -82,8 +82,8 @@ fn controller_main() -> Result<()> {
|
||||
dial,
|
||||
cfg.last_mode,
|
||||
vec![
|
||||
// Box::new(controller::controls::ScrollMT::new()),
|
||||
Box::new(controller::controls::Scroll::new()),
|
||||
Box::new(controller::controls::ScrollMT::new()),
|
||||
Box::new(controller::controls::Zoom::new()),
|
||||
Box::new(controller::controls::Volume::new()),
|
||||
Box::new(controller::controls::Media::new()),
|
||||
|
||||
Reference in New Issue
Block a user