godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.58k stars 21.27k forks source link

Mouse cursor disappears when leaving slider input in inspector after edition #66909

Closed Cevantime closed 1 year ago

Cevantime commented 2 years ago

Godot version

4.0.beta2.mono.official (commit f8745f2f7)

System information

Linux Mint, Vulkan, Nvidia Geforce GTX 1660 Ti, nvidia-driver-515.65.01

Issue description

When I edit a slider value (float or integer) in the inspector and leave the mouse, the cursor disappears often (~80% of the times). After switching to another application, the cursor is back and I can move back to Godot and use the mouse again. Moving the cursor inside the selected input also changes the input value :
bug

Note that this also happens when I move the cursor back into the input while it has been edited and is still selected.

Steps to reproduce

Open any project. Try to change the value of a slider value in the inspector (float or int) and move the cursor inside the selected input. It should disappear quite often (roughly 80% of the time)

Minimal reproduction project

No reproduction project is needed, since I can reproduce in any project on my system.

Calinou commented 2 years ago

Can you reproduce this after enabling Single Window Mode in the Editor Settings then restarting the editor?

Cevantime commented 2 years ago

Hello, I confirm I can reproduce it in single window mode.

Sauermann commented 2 years ago

For me on Debian Linux with Xfce window manager I can not reproduce this issue with non-mono Godot When I follow your instructions, my mouse cursor changes its form to the "Text"-mouse cursor:

https://user-images.githubusercontent.com/6299227/194187267-420fad9d-06ff-45a0-8ab4-a52a5df51831.mp4

Which window manager do you use?

In your video it looks like the mouse button gets pressed, which explains the vanishing mouse cursor and the value-change and afterwards gets into an inconsistent state (mouse is not pressed, but application assumes, that it is).

salamandars commented 2 years ago

Are you using a laptop trackpad? I can reproduce this on windows but only by double-tapping inside the trackpad. Regular mouse interactions work normally.

Cevantime commented 2 years ago

@salamandars Yes, I am ! And yes, I'm double clicking inside the box. @Sauermann, I'm using Cinnamon. Maybe I haven't been clear enough. To reproduce, you have to edit the value, then press enter to validate, and only then try to move the cursor. But as @salamandars says, it might be linked to trackpads.

salamandars commented 2 years ago

Here's what I think is happening. A common way to click on (at least some) trackpads is to do a quick double-tap inside the touch area. Technically this actually registers as a double-click, at least in godot.

So when I do this on a spinbox, it seems to fire off 4 mouse button events:

  1. "Left mouse button Pressed" -> received by EditorSpinSlider
  2. "Left mouse button Not Pressed" -> received by EditorSpinSlider
  3. "Left mouse button Pressed (Double click)" - almost the exact same time as 2. -> received by EditorSpinSlider 3.5. usually mouse motion event occurs here due to nature of tapping
  4. "Left mouse button Not Pressed" -> received by LineEdit

Guesswork: The first two events work correctly to put the LineEdit into input mode... but perhaps because the second click comes at the same time, it seems to also fire off before(?) the deferred call to switch focus to the line edit. So the second mouse DOWN event is received by the EditorSpinSlider, and (with a bit of accidental mouse motion) it also triggers the grabbing_spinner mouse capture behavior. However the second UP event is received by the LineEdit object instead, so the mouse is never released.

Perhaps a fix for this would be to move the mouse capturing behavior to Viewport so that it can keep track of mouse events better?

mastir commented 2 years ago

Hey @salamandars, i have same bug on ubuntu 22.04 without touchpad. And even without click event. Just click on input, write some number and press enter. After any move mouse starts altering already inactive input without cursor v4.0-beta4_linux.x86_64 without mono. I guess your commit can fix this, thanks!

snougo commented 2 years ago

I tested in Godot4 beta6 on Mac and mouse cursor only disappears when using mouse (or trackpad) draging to change inspector value

https://user-images.githubusercontent.com/64188282/203935305-a2cb3b98-27cc-4c06-ac31-433c5d3123d6.mov

akien-mga commented 1 year ago

Yeah this was fixed a while ago. The behavior described by @snougo is the intended behavior.

PIZZA-ALERT commented 5 months ago

Similar but different issue happening to me and some others online. Mouse cursor straight up hidden every time it's hovered over text input. https://github.com/godotengine/godot/issues/93748