Delay Mouse signals until after internal processing

This commit is contained in:
Logan Detrick 2025-06-24 14:04:54 -07:00
parent 987832be46
commit c03a7b7893
2 changed files with 4 additions and 8 deletions

View file

@ -3900,14 +3900,6 @@ void Control::_notification(int p_notification) {
RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), data.clip_contents);
} break;
case NOTIFICATION_MOUSE_ENTER: {
emit_signal(SceneStringName(mouse_entered));
} break;
case NOTIFICATION_MOUSE_EXIT: {
emit_signal(SceneStringName(mouse_exited));
} break;
case NOTIFICATION_FOCUS_ENTER: {
emit_signal(SceneStringName(focus_entered));
queue_redraw();

View file

@ -2610,6 +2610,7 @@ void Viewport::_gui_update_mouse_over() {
// Send Mouse Exit notifications.
for (int exit_control_index : needs_exit) {
gui.mouse_over_hierarchy[exit_control_index]->notification(Control::NOTIFICATION_MOUSE_EXIT);
gui.mouse_over_hierarchy[exit_control_index]->emit_signal(SceneStringName(mouse_exited));
}
// Update the mouse over hierarchy.
@ -2621,6 +2622,7 @@ void Viewport::_gui_update_mouse_over() {
// Send Mouse Enter notifications.
for (int i = needs_enter.size() - 1; i >= 0; i--) {
needs_enter[i]->notification(Control::NOTIFICATION_MOUSE_ENTER);
needs_enter[i]->emit_signal(SceneStringName(mouse_entered));
}
gui.sending_mouse_enter_exit_notifications = false;
@ -3274,6 +3276,7 @@ void Viewport::_update_mouse_over(Vector2 p_pos) {
for (int i = over_ancestors.size() - 1; i >= 0; i--) {
gui.mouse_over_hierarchy.push_back(over_ancestors[i]);
over_ancestors[i]->notification(Control::NOTIFICATION_MOUSE_ENTER);
over_ancestors[i]->emit_signal(SceneStringName(mouse_entered));
}
// Send Mouse Enter Self notification.
@ -3365,6 +3368,7 @@ void Viewport::_drop_mouse_over(Control *p_until_control) {
for (int i = gui.mouse_over_hierarchy.size() - 1; i >= notification_until; i--) {
if (gui.mouse_over_hierarchy[i]->is_inside_tree()) {
gui.mouse_over_hierarchy[i]->notification(Control::NOTIFICATION_MOUSE_EXIT);
gui.mouse_over_hierarchy[i]->emit_signal(SceneStringName(mouse_exited));
}
}
gui.mouse_over_hierarchy.resize(notification_until);