Godot: Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) hides cursor even on window chrome

Created on 5 May 2016  路  3Comments  路  Source: godotengine/godot

Operating system or device:
Windows 10 Pro x64

Issue description (what happened, and what was expected):
Using Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) hides the system cursor not only inside the client area where the game is displayed, it also hides it on top of the window chrome / border / frame / non-client area. This makes it hard to hit minimize / maximize / close buttons. Maybe this can be optimized.

bug windows core

Most helpful comment

Some progress has been made here in my fork: https://github.com/mattiascibien/godot/tree/hide-cursor-fix

All 3 comments

Can't reproduce this on Linux X11, so I'll assume it's a bug in the Windows platform code.

I guess the problem resides in the call to the Win32API ShowCursor(p_mode==MOUSE_MODE_VISIBLE); which actually hides the cursor globally and not only for the client area.

It seems that for hiding the cursor a call to SetCursor(NULL) must be done. This function also returns the last cursor that was used when called so I guess we can keep it in a variable to restore it later with SetCursor(old_cursor).

I do not know how this will behave in fullscreen.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms648393(v=vs.85).aspx

EDIT: as per this it seems that setcursor must be done inside the window message loop.

EDIT2: what I think we should do is to actually use the OS_Windows::WndProc loop to hide and show it with this case. I am thinking on a solutions. As soon as I come up with one I will keep you posted.

Some progress has been made here in my fork: https://github.com/mattiascibien/godot/tree/hide-cursor-fix

Was this page helpful?
0 / 5 - 0 ratings