-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] MacOS inputcapture #131
base: main
Are you sure you want to change the base?
Conversation
Very nice, thank you! Unfortunately my MacOS VM nuked itself so I will have to set that up again before I can test this... Sorry about thay |
Works for me |
|
||
// After the cursor is warped the next event will carry the delta from the warp | ||
// so only half the delta is needed to move the cursor | ||
let delta_y = event.get_double_value_field(EventField::MOUSE_EVENT_DELTA_Y) / 2.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about the / 2.0
part?
The documentation for CGWarpMouseCursorPosition
states: "You can use this function to “warp” or alter the cursor position without generating or posting an event. For example, this function is often used to move the cursor position back to the center of the screen by games that do not want the cursor pinned by display edges."
So no event should be generated, if I understand that correctly.
Apparently it works like this though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, no synthetic event is produced, however the movement delta is tacked onto the next event. This explains the issue https://stackoverflow.com/questions/40904830/constrain-mouse-movement-to-region-in-os-x-without-jitter/40922095#40922095
And just FYI: I'm still debating on whether or not Modifier events should even be handled "server side" at all. |
I see, im using Hyprland so wayland/wlroots is what im using. I guess removing the events would mean tracking modifier state in wlroots emulation. |
Yeah exactly. Definitely keep it in though! Better to have it working in MacOS now. |
I hope to get back to this soon, haven't had the time, the only thing i wanted to add was detection of monitor layout changes, there is a API in |
no worries! I just got round to testing this. One thing I'm noticing is that the mouse is behaving weird when dragging: |
I had a stab at writing a macos input capture module as i was tired not being able to cross the pointer back and forth between mac and linux, and it seemed a good rust exercise. There as some things left mainly modifier handling and updating the bounds on a monitor config change. But i wanted to put it up as a draft for now if there is any other pointers or if i missed something in the architecture.