slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.55k stars 601 forks source link

Mouse Focus Offset in Frameless Window on Windows 10 #4608

Closed forever0n closed 4 months ago

forever0n commented 9 months ago

Environment

Description

I've developed an application using Slint with a frameless window (setting no-frame to true). While the application works as expected on Windows Server 2022, I encounter an issue with mouse focus offset on Windows 10. The mouse focus does not align with the UI elements, leading to incorrect interactions.

Steps to Reproduce

  1. Set no-frame to true in the window configuration.
  2. Launch the application on Windows 10.
  3. Attempt to interact with UI elements.

Expected Behavior

Mouse focus should accurately align with UI elements, allowing for correct interaction as it does on Windows Server 2022.

Actual Behavior

There is a noticeable offset between the mouse cursor and the UI elements' actual interactive areas on Windows 10.

Additional Context

Possible Solution

I am unsure of the exact cause or a direct solution to this problem and would appreciate any guidance or fixes that can be provided.

Thank you for your assistance.

forever0n commented 9 months ago

Update:

After further investigation and testing on a friend's Windows 10 system, I've discovered that the issue with the mouse focus offset in the frameless window does not occur there. This observation leads me to believe that the problem might be specific to my own Windows 10 system configuration rather than a general issue with Slint on Windows 10.

I'm currently looking into my system settings and any potential differences that might contribute to this behavior. I'll continue to update this issue if I find anything relevant or manage to resolve the problem on my end.

In the meantime, if anyone has suggestions or has encountered similar issues and found solutions, I would greatly appreciate your input. Thank you for your patience and assistance.

tronical commented 8 months ago

Thanks for the detailed report. This is indeed rather odd. Let us know if you find out what setting might cause this.

Cursory search on the internet found this similar issue: https://discourse.dearimgui.org/t/dx11-win32-implementation-mouse-cursor-slightly-offset/63/5

So perhaps there's something about the way winit calls GetClientRect.

ogoffart commented 4 months ago

Closing this issue for now as this is unlikely not a bug in Slint. But please let us know if you can provide more info and if you think there is something we can work around.