Skip to content

Absolute mouse position #14

@fulara

Description

@fulara

I am trying to get the absolute mouse position, possibly in relation to the current screen, it may as well be some arbitrary value.

I do get an event with regards to motion, but that's relative.
How does one enable the Absolute events to work?

This is what I have:

let mut device =
    uinput::default()
    .unwrap()
    .name("name")
    .unwrap()
    .event(uinput::event::Keyboard::All)
    .unwrap();
for v in uinput::event::controller::Mouse::iter_variants() {
    device = device.event(v).unwrap();
}
device = device.event(Event::Absolute(Absolute::Position(Position::X))).unwrap().min(0).max(100);
device = device.event(Event::Absolute(Absolute::Position(Position::Y))).unwrap().min(0).max(100);
let mut device = device.create().unwrap();

The only event that is incoming for Motion is:

Pointer(Motion($struct_name @0x7fd06c0413a0))

Anything obvious I am doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions