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 set_mouse_pos function #321

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

Add set_mouse_pos function #321

wants to merge 3 commits into from

Conversation

arvsrn
Copy link

@arvsrn arvsrn commented Jun 13, 2023

It only works on windows though

@arvsrn arvsrn mentioned this pull request Jun 13, 2023
unsafe {
let pos = self.get_position();

winuser::SetCursorPos(left as i32 + pos.1 as i32, top as i32 + pos.0 as i32 + 30 /* height of title bar */);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think hard coding height to 30 here is a good idea. The window may not have a title bar, or the user may have increased / decreased the font size of the title bar.

@emoon
Copy link
Owner

emoon commented Jun 13, 2023

Thanks for the PR. I can't merge this one yet tho as I strive to have the same functionally across all backends to not confuse users.

@arvsrn
Copy link
Author

arvsrn commented Jun 13, 2023

Titlebar height is not hardcoded anymore. I can't code for other platforms though as I only have a windows device. Hope you get somewhere with the code if you find the time!

@emoon
Copy link
Owner

emoon commented Jun 13, 2023

Thanks! I will try to get around implementing the other platforms also.

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.

None yet

2 participants