-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Fix Viewport mouse enter+exit notifications #58042
Fix Viewport mouse enter+exit notifications #58042
Conversation
Looks quite good. @KoBeWi what do you think of it? |
This fixes the entered signals, but exit signals seem to be the same. Is this expected? |
And what about |
|
It doesn't act, but the notification is still received and can be used in scripts etc. So it should be forwarded too. |
@KoBeWi Ok, I will include that notification. Are there any additional notifications, that should be forwarded? For windows, I found the following notifications:
|
I don't think these need to be forwarded. But now that I look at this PR, it sends window-related notifications based on different notifications. I wonder if this should be documented, as users might find it unexpected. |
I find it confusing, that I see a problem with the current patch. I believe, that
|
597a92f
to
7d5931f
Compare
My updated pull request uses different notifications for two concepts:
Otherwise the global state would interfere with subviewports. |
7d5931f
to
ad4b043
Compare
Some notes of concern here that I was thinking, the WM focus in and out notifications are propagated through the whole tree to all nodes. I have my doubts whether this is really useful, maybe they should be signals of SceneTree. The problem though is that here the sub-viewport will receive them now. The problem here is that the WM notifications will be received twice by the sub-viewport. |
When I noticed, that WM-mouse-enter+exit is distributed to all Nodes, I became aware, that my initial solution would not work. In the most recent patch, I created new notifications, that trigger when the mouse enters a viewport. |
mouse enter+exit
ad4b043
to
415042a
Compare
This makes sense, I am still unhappy to have it in Node, but Viewport has no notifications so not much we can do for the time being. |
Thanks! |
resolve #57762
Viewports of a Window receive the notifications
NOTIFICATION_WM_MOUSE_ENTER
,NOTIFICATION_WM_MOUSE_EXIT
, andNOTIFICATION_WM_WINDOW_FOCUS_OUT
directly from their window:godot/scene/main/window.cpp
Lines 326 to 327 in aa069a4
Since SubViewports, that are child-nodes of a SubViewportContainer, do not have a Window, they do not receive these events, which leads to the mentioned bug.
This pull request solves this problem by propagating the notifications of SubViewportContainer to their SubViewports.