From a0fb66d802914a7833314a13430bcfef21e38fd1 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Fri, 3 Dec 2021 18:19:41 +0800 Subject: [PATCH] Fix mouse cursor and notification for force dragging (cherry picked from commit 86a47c65407fe94366c8b1a2074b60d3ce37af24) --- scene/main/viewport.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 9225d644ee0..95c9a883a81 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2275,15 +2275,12 @@ void Viewport::_gui_input_event(Ref p_event) { set_input_as_handled(); - if (gui.drag_data.get_type() != Variant::NIL && mm->get_button_mask() & BUTTON_MASK_LEFT) { - bool can_drop = _gui_drop(over, pos, true); + bool can_drop = _gui_drop(over, pos, true); - if (!can_drop) { - OS::get_singleton()->set_cursor_shape(OS::CURSOR_FORBIDDEN); - } else { - OS::get_singleton()->set_cursor_shape(OS::CURSOR_CAN_DROP); - } - //change mouse accordingly i guess + if (!can_drop) { + OS::get_singleton()->set_cursor_shape(OS::CURSOR_FORBIDDEN); + } else { + OS::get_singleton()->set_cursor_shape(OS::CURSOR_CAN_DROP); } } @@ -2526,6 +2523,7 @@ void Viewport::_gui_force_drag(Control *p_base, const Variant &p_data, Control * if (p_control) { _gui_set_drag_preview(p_base, p_control); } + _propagate_viewport_notification(this, NOTIFICATION_DRAG_BEGIN); } void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {