Skip to content

Conversation

F0bes
Copy link
Member

@F0bes F0bes commented Oct 16, 2025

Description of Changes

When the feature was developed, I didn't think about how QWindow::geometry() might not be scaled to the current DPI.

I now scale the window geometry to the current monitors pixel scale, and then clamp.

I also made the function safer, as I was assuming a fixed size of data from GetRawInputData, and I wasn't checking if GetCursorPos was successful or not before using its result.

Also removed some unused global mouse hook stuff. Don't ever want to use that anyways.

Also implemented support for 'render to separate window'

Rationale behind Changes

Fixes #12695

Suggested Testing Steps

Test different DPIs

Did you use AI to help find, test, or implement this issue or feature?

yeah, copilot auto complete

@F0bes
Copy link
Member Author

F0bes commented Oct 18, 2025

Added support for "render to separate window".

@chaoticgd tested x11 and found that one axis did not clamp properly on a non-100 DPI but I could not reproduce it here.

@F0bes F0bes force-pushed the mouselocking-dpi-aware branch from 4341583 to a875fdd Compare October 18, 2025 17:04
@F0bes F0bes changed the title Qt: Make mouse screen locking DPI aware Qt: Make mouse screen locking DPI aware and support render to separate window Oct 18, 2025
@F0bes
Copy link
Member Author

F0bes commented Oct 18, 2025

Added support for "render to separate window".

@chaoticgd tested x11 and found that one axis did not clamp properly on a non-100 DPI but I could not reproduce it here.

The issue happens when

  • You have more than one monitor
  • The monitors are different resolutions
  • Your DPI is not at 100%

I don't think there is much I can or want to do about that right now, so I've gone ahead and added a warning in the options description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Mouse lock option not working correctly

1 participant