Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_custom_mouse_cursor() while set_mouse_mode(Input.MOUSE_MODE_HIDDEN) results in incorrect cursor when the cursor is made visible again #49815

Closed
ErwinBr opened this issue May 27, 2020 · 2 comments · Fixed by #49848

Comments

@ErwinBr
Copy link

ErwinBr commented May 27, 2020

Describe the project you are working on:

A classic point & click adventure game.

Describe the problem or limitation you are having in your project:

My custom mouse cursor in my game changes by setting set_custom_mouse_cursor when hovering over interactive objects and hotspots. When the game is "busy" with displaying dialogue, for example, the mouse is hidden with set_mouse_mode(Input.MOUSE_MODE_HIDDEN). Users can however still mouse around. Unfortunately this results in the wrong mouse cursor being displayed when we return to normal, as a hidden cursor does not seem to be updated. I now have to manage a lot of exception handling to mitigate the issue, and it's a pain to get it right.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

Simply being able to change the custom mouse cursor while it's hidden would help tremendously.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

N/A

If this enhancement will not be used often, can it be worked around with a few lines of script?:

I need to do a lot of exception handling resulting In messy code for something which could be easily solved. (I assume!)

Is there a reason why this should be core and not an add-on in the asset library?:

I believe the nature of this feature/enhancement would lend more to a change in the core model rather than an add-on.

@Calinou
Copy link
Member

Calinou commented May 28, 2020

This check is currently done on Windows, macOS and Linux. HTML5 doesn't check for the mouse mode before setting a custom cursor image.

if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
SetCursor(cursors[p_shape]);
}

if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
[cursor set];
}

if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
XDefineCursor(x11_display, E->get().x11_window, cursors[p_shape]);
}
}

Feel free to remove the check, build the engine and test it to see if it works as expected.

@Calinou
Copy link
Member

Calinou commented Jun 21, 2021

I can't reproduce this issue on both 3.3.2 and master Git 8d4f56a with the following minimal reproduction projects on Linux. This is likely a Windows-specific issue.

I'll move this to the main Godot repository as this is a bug, rather than a feature proposal.

@Calinou Calinou transferred this issue from godotengine/godot-proposals Jun 21, 2021
@Calinou Calinou changed the title set_custom_mouse_cursor while set_mouse_mode(Input.MOUSE_MODE_HIDDEN) set_custom_mouse_cursor() while set_mouse_mode(Input.MOUSE_MODE_HIDDEN) results in incorrect cursor when the cursor is made visible again Jun 21, 2021
@akien-mga akien-mga added this to the 4.0 milestone Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants