-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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 connecting a signal with a double click is too difficult #95044
base: master
Are you sure you want to change the base?
Fix connecting a signal with a double click is too difficult #95044
Conversation
This issue that this PR fixes is in the Release Blocker for 4.3, is it normal that it has been put in 4.4 Milestone? |
I wanted to see if this also solved a similar problem with the revert button (you have to click the button two times because of the tooltip) Screencast_20240725_155139.webmBut that problem is still there. Should I open another issues for that? |
Also with this fix, I don't seem to be able to open documentation when clicking inside the tooltips for signals, instead it highlights the text. System info: Fedora Linux 40 (KDE Plasma) - Wayland - Vulkan (Forward+) - (software emulation on CPU) |
Thanks for testing @Giganzo
I'll make the same fix for the tooltip in the Inspector to fix that.
Hum... I feared that could cause issues on other platforms. On Windows, as you can see in my video, click on the tooltip on open documentation works on Windows. I'm setuping my Linux machine to test that right now, I'll check if I can find a work around. Unfortunately, I don't have access to a Mac to test it. |
f8d4fad
to
a56efe3
Compare
I debugged it on Ubuntu Wayland and I have the same issue where I cannot click on documentation link. The problem comes from the fact that the mouse up event is not received by the If someone with more experience can help on Wayland, I would appreciate it. EDITED: I finally found a way to fix the problem. |
a56efe3
to
d88765a
Compare
94763f1
to
fa718ea
Compare
fa718ea
to
7289305
Compare
The issue isn't critical, and the fix is not trivial, so at this stage (mere days to stable release) we prefer to be cautious and merge after the 4.3 release. It can then be cherry-picked for 4.3.1 once we've confirmed in the |
254f0e1
to
f2dfa65
Compare
This pr also fixes #94030 |
This pr looks like it also fixes #94615 |
Wonderful, thanks for testing! |
Similar issue happens with menu items that have sub menus, such as the Editor Docks or the Editor Layout items in the Editor menu. But to me at least it seems incorrect for the submenu to grab the mouse focus as soon as the menu opens, instead it should only take the mouse focus when mouse moves over the items. Mouse focus should always be where the cursor is, no? But maybe there's a reason it's this way. To be clear I don't know if the tooltip handling is different from how the editor handles opening its submenus, so this might be an off-topic comment so pardon if that is the case. I was however reminded of this while reading this issue and figured I'd mention it all the same. I also don't know if the behavior is the same on other platforms, I've only used Godot on Windows. |
Needs rebase to fix conflicts.
|
Doing this will re-open #98135 if
|
f2dfa65
to
afce73e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me. 👍 I tested it on Linux and everything seems to work correctly. There is a comment about custom descriptions in the inspector and minor code style suggestions.
bool EditorHelpBitTooltip::_is_tooltip_visible = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there is a convention, but I would move this below /// EditorHelpBitTooltip ///
.
@@ -3835,6 +3837,14 @@ void EditorHelpBitTooltip::_safe_queue_free() { | |||
void EditorHelpBitTooltip::_target_gui_input(const Ref<InputEvent> &p_event) { | |||
const Ref<InputEventMouse> mouse_event = p_event; | |||
if (mouse_event.is_valid()) { | |||
// For some unknown reason, we receive mouse motion of zero when the tooltip | |||
// is opened even if the mouse is not moving on Windows now that the toolip | |||
// FLAG_POPUP is false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// FLAG_POPUP is false. | |
// `FLAG_POPUP` is false. |
ERR_FAIL_NULL(p_help_bit); | ||
Control *EditorHelpBitTooltip::show_tooltip(const String &p_symbol, Control *p_target, const String &p_description) { | ||
// Show the custom tooltip only if it is not already visible. | ||
// The Viewport will retrigger make_custom_tooltip every few seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The Viewport will retrigger make_custom_tooltip every few seconds | |
// The viewport will retrigger `make_custom_tooltip()` every few seconds |
EditorHelpBit *help_bit = memnew(EditorHelpBit(p_symbol)); | ||
if (!p_description.is_empty()) { | ||
help_bit->set_description(p_description); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
// When FLAG_POPUP is false, it prevents the editor from losing focus when displaying the tooltip. | ||
// This way, clicks and double-clicks are still available outside the tooltip. | ||
tooltip->set_flag(Window::FLAG_POPUP, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// When FLAG_POPUP is false, it prevents the editor from losing focus when displaying the tooltip. | |
// This way, clicks and double-clicks are still available outside the tooltip. | |
tooltip->set_flag(Window::FLAG_POPUP, false); | |
// When `FLAG_POPUP` is false, it prevents the editor from losing focus when displaying the tooltip. | |
// This way, clicks and double-clicks are still available outside the tooltip. | |
tooltip->set_flag(Window::FLAG_POPUP, false); |
I would move this to popup_under_cursor()
for consistency, since FLAG_NO_FOCUS
is set there.
Timer *timer = nullptr; | ||
int _pushing_input = 0; | ||
bool _need_free = false; | ||
|
||
void _start_timer(); | ||
void _safe_queue_free(); | ||
void _target_gui_input(const Ref<InputEvent> &p_event); | ||
static Control *_make_invisible_control(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's a best practice, but I personally prefer to place static methods before non-static ones.
if (has_doc_tooltip || !custom_warning.is_empty()) { | ||
EditorHelpBit *help_bit = memnew(EditorHelpBit); | ||
|
||
String symbol; | ||
String description; | ||
if (has_doc_tooltip) { | ||
help_bit->parse_symbol(p_text); | ||
symbol = p_text; | ||
|
||
const EditorInspector *inspector = get_parent_inspector(); | ||
if (inspector) { | ||
const String custom_description = inspector->get_custom_property_description(p_text); | ||
if (!custom_description.is_empty()) { | ||
help_bit->set_description(custom_description); | ||
description = custom_description; | ||
} | ||
} | ||
} | ||
|
||
if (!custom_warning.is_empty()) { | ||
String description = "[b][color=" + get_theme_color(SNAME("warning_color")).to_html(false) + "]" + custom_warning + "[/color][/b]"; | ||
if (!help_bit->get_description().is_empty()) { | ||
description += "\n" + help_bit->get_description(); | ||
const String custom_warning_description = "[b][color=" + get_theme_color(SNAME("warning_color")).to_html(false) + "]" + custom_warning + "[/color][/b]"; | ||
if (description.is_empty()) { | ||
description = custom_warning_description; | ||
} else { | ||
description = custom_warning_description + "\n" + description; | ||
} | ||
help_bit->set_description(description); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the logic, since parse_symbol()
set the description, it is read using get_description()
. The previous logic appends/prepends the symbol description, rather than replacing it.
I didn't notice that copying text in the tooltip and hiding it by pressing Escape stopped working. This is because with the |
The main issue was that when showing the tooltip, the editor was losing focus due to the custom tooltip popup. After that, the first mouse click was used to refocus the editor, making a double-click impossible.
Setting
FLAG_POPUP
to false solved the focus issue but created a new problem where the "normal" tooltip with the empty Control returned bymake_custom_tooltip
was also displayed. I modifiedViewport::_gui_show_tooltip
to skip creating the tooltip if the returned control is not visible. This is a bit of a hack; I did not know a better way. It's was not possible inViewport::_gui_show_tooltip
to have a tooltip text but preventing the tooltip to be showned.Additionally, it created another problem where
EditorHelpBitTooltip::_target_gui_input
was triggered when the tooltip was shown, even if the mouse did not move. I don't know exactly why this happens. I added a flag to skip the first_target_gui_input
.Finally, without the "real" tooltip, the Viewport tries to create it every few seconds. I added the method
EditorHelpBitTooltip::is_tooltip_visible
to prevent displaying multiple custom tooltips inConnectionsDockTree::make_custom_tooltip
, and I created an_invisible_tooltip
control global to the class to prevent the creation of a new Control every time.Tested only on Windows 11 on Linux.
That's the result:
godot.windows.editor.dev.x86_64_VI9VD9voL0.mp4
Edit: Tested on Linux
Edit 2: Added #94030 and #96008 to the fixed issue list.
Edit 3: Added #94615 to the fixed issue list.