slint icon indicating copy to clipboard operation
slint copied to clipboard

Mouse Focus Offset in Frameless Window on Windows 10

Open forever0n opened this issue 1 year ago • 2 comments

Environment

  • Slint version: 1.4.1
  • Operating System: Windows 10

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

  • This issue does not occur on Windows Server 2022.
  • I have tried adjusting DPI settings and ensuring that my application is DPI-aware, but the issue persists.

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 avatar Feb 12 '24 15:02 forever0n

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.

forever0n avatar Feb 13 '24 03:02 forever0n

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.

tronical avatar Feb 26 '24 09:02 tronical

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.

ogoffart avatar Jun 28 '24 13:06 ogoffart