Skip to content
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

Add get_screen_mouse_position function for Windows and Linux X11 #486

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

InZan17
Copy link
Contributor

@InZan17 InZan17 commented Sep 19, 2024

This function will return the position of the mouse in screen coordinates. This is useful for if I wanna have my program respond to the mouse movement even when it leaves the program.

The get_screen_mouse_position function returns the added screen_mouse_position field on the NativeDisplay struct. That field gets updated every main loop iteration. To get the mouse screen position, on Linux it's XQueryPointer and on Windows it's GetCursorPos.

I tried to only get the mouse screen position whenever the function gets called, but that would require me to have access to Display and Window on Linux, which seems to only be accessible in the main loop.

I also haven't implemented this for MacOS since I do not have any devices to test on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant