godotengine / godot

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

NOTIFICATION_WM_MOUSE_ENTER doesn't emit when mouse button is being pressed #53170

Open Schweini07 opened 3 years ago

Schweini07 commented 3 years ago

Godot version

3.3 Stable, v4.0.dev.custom_build [916c37de0]

System information

Manjaro Linux

Issue description

When normally entering the game with the mouse, the NOTIFICATION_WM_MOUSE_ENTER notification is emitted. But when a file is dragged into the game nothing happens. This issue is present in both Godot 3.3 and Godot 4.0-dev.

https://user-images.githubusercontent.com/47503977/135075827-2f6e89ec-4eb2-400b-960e-2256bc67780b.mp4

.

Steps to reproduce

  1. Create a Node with a script including this code (3.3):
    func _notification(what):
    if what == MainLoop.NOTIFICATION_WM_MOUSE_ENTER:
       print("Emitted")
  2. Try to drag a file into the game window, "Emitted" is not printed.

Minimal reproduction project

Test.zip

KoBeWi commented 3 years ago

Might be not caused by file dragging, but the pressed mouse button. See #20881

Schweini07 commented 3 years ago

Then this is a duplicate, I suppose?

KoBeWi commented 3 years ago

Ok I confirmed this is the same problem. But it involves windows not Controls, so it's probably triggered somewhere else. I'd leave it open.

MadDogMayCry0 commented 2 years ago

Godot version

3.3 Stable, v4.0.dev.custom_build [[916c37d]

No one can correct this mistake, since no one wants to delve into the problem and does not consider it a problem. Nevertheless, this is a problem :) and this problem leads to unpredictable behavior of your game :)

This problem is solved by the logical layer that I attached in the adjacent branch, but it is not as effective as if it was solved natively, although it works correctly as you expect. https://github.com/godotengine/godot/issues/20881#issuecomment-841614529

TranquilMarmot commented 4 weeks ago

I'm running into this on 4.3 stable on macOS.

func _notification(what: int) -> void:
    if what == NOTIFICATION_WM_MOUSE_ENTER:
        print("enter")
    elif what == NOTIFICATION_WM_MOUSE_EXIT:
        print("exit")

Hold down the mouse anywhere inside the window.

Move the mouse outside of the window and then back in while holding the button down.

enter will not be printed until you release the mouse button 😢