-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Control Default Cursor Shape has no effect in a SubViewport #74805
Comments
The reason for this behavior is, that the Cursor Shape of the As a solution, I would suggest the following approach:
I have an idea of how to implement this change, but since this is a breaking change, I would like feedback, if there are better solutions. |
I'm affected by this issue. More specifically, when moving the mouse, the cursor flickers between the proper cursor for the child node, and the default cursor for the SubViewportContainer (but the SubViewportContainer default cursor overrides it and gets shown most of the time). This is in an X11 Linux environment. Edit: The cursor flickering is very occasional and I can only reproduce it with Vsync disabled @Sauermann did you get feedback for your idea? Is there a workaround while we wait for the fix? |
Nobody did answer in this thread, so: no. After looking at the problem again, maybe my previous idea is not the best possible way to deal with this situation. In the following code-section,
If a separate mouse cursor enum value was available for the second one, then it could be used for SubViewportContainer to indicate that the Control should not set a mouse cursor. But this would still not be enough to solve the problem completely, because there might be a parent Control behind the SubViewportContainer, which could interfere with the cursor shape. Lines 1956 to 1978 in 2eec9a6
I might get back to this after #67791, which changes the way, how the Control is calculated above which the mouse cursor is. That new algorithm identifies the Control (even within nested SubViewports and embedded Windows) where the cursor is and this would provide a different, more natural solution for this issue. |
This is still an Issue in Godot 4.1.1 stable |
How about creating a new internal signal emitted by This behavior could be disabled by a new property if necessary for backward-compatibility. |
The problem is that SubViewportContainer's "mouse_default_cursor_shape" property is needlessly overriding the proper cursor that is already set by whatever is rendered in the viewport. I did this as an experiment: In my SubViewportContainer, set mouse_default_cursor_shape to "Can Drop" (arbitrarily selected a cursor that I don't need right now) Then in Godot's
Lo and behold, the cursors inside the viewport work now, as they are not being overridden. The proper fix would involve either allowing us to set a "null" value for the cursor shape, or changing the code in a way that SubViewportContainer's own cursor setting is discarded so that the cursor set by the viewport contents stays in effect. |
#67791 rewrites the methodology, how the Control is determined, which is under the mouse cursor. |
Thanks for figuring out a workaround - I might try this out until a fix happens after #67791 is merged. @Sauermann Purely out of curiosity, is the original reason |
@Koyper I'm not as familiar with the 3.x-codebase, so I can't really make the comparison. My understanding of the current implementation is, that first the SubViewport evaluates the CursorShape and sets it. |
I made a one-line fix that just skips setting the cursor for SubViewports, I opened it as a PR at #79805 I made a repro with nested SubViewports here that is also fixed by the PR: nested-subviewports-demo.zip @Sauermann I understand that this may be made obsolete by your effort, but I decided to post it anyway on the off chance that it helps. At least it demonstrates a possible simple way to fix it. |
In the editor a diferent cursor shape gets stuck instead of the arrow ? cursorShapeStuck.mp4
|
Godot version
4.0
System information
Windows 11
Issue description
When using a SubViewport contained within a SubviewportContainer, none of my child Control nodes within the Subviewport have their mouse cursors changed to align with their Control's default mouse cursor option. They are always unchanged, even when an attempt is made to change the default with code. It seems like being within a SubViewport disables it's ability to know when it needs to change mouse cursors inside that SubViewport.
Steps to reproduce
Minimal reproduction project
TestRepro.zip
The text was updated successfully, but these errors were encountered: