On Lyra-based project, mouse capture is not fully capturing in Windowed Mode

Mouse capture works as expected when in full screen mode, but when windowed, it doesn’t fully capture.
In Widowed mode, the mouse turns invisible as expected and I can play the game normally, but if I move the mouse quickly and use the left mouse button, I am able to click on things in my desktop. Worsening the situation clicking on anything in the desktop will make the game lose focus and the windows mouse cursor to appear.

Doing some testing, I can see that in windowed mode the mouse is still moving, albeit invisible, and the game tries to keep the mouse within the confines of the window., but it’s not perfect and moving the mouse very quickly can get the mouse momentarily out of the window.
I’m on UE 5.1.

This is a Lyra-based project so all the mouse capturing settings seem generally correct. In the project settings I can see I have Capture Mouse On Launched enabled, and Default Viewport Mouse Capture Mode to “Capture Mouse Permanently Including Initial Mouse Down”.
I do use “SetInputModeGameOnly” in my character blueprint as well.
Any ideas why this would be? Is it a limitation using Unreal?

I still can’t figure out how to fix. Any ideas?

I moved the SetInputModeGameOnly to the playercontroller on BeginPlay but the problem is still there.

Ok, I figured it out. Seems like a bug to me. When not in fullscreen mode, we use a borderless window and in the Engine in SlateUser.cpp , the function LockCursorInternal has the following code:
const int32 ClipRectAdjustment = bIsBorderlessGameWindow ? 0 : 1;
which allows the OS cursor to become visible at the margins of the game window and allows players to click on the desktop.
Changing it to:
const int32 ClipRectAdjustment = 1;
fixed the issue for us.