GH-1199 Fix ColorPicker closing when pressing spacebar#1203
GH-1199 Fix ColorPicker closing when pressing spacebar#1203Arctis-Fireblight merged 1 commit intoRedot-Engine:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
WalkthroughRemoved handling of the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scene/gui/color_picker.cpp (1)
2417-2422:⚠️ Potential issue | 🟠 MajorRemove the redundant
ui_cancelcheck to avoid double-close.The fix to use
ui_cancelinstead ofui_acceptis correct. However, the explicitui_cancelcheck at lines 2418–2420 is redundant and causes_close_pressed()to be called twice:
- First call:
ColorPickerPopupPanel::_input_from_windowexplicitly checksui_canceland calls_close_pressed()(line 2419)- Second call: The subsequent
PopupPanel::_input_from_window(p_event)(line 2421) delegates toPopup::_input_from_window, which also checksui_canceland calls_close_pressed()Since
Popup::_input_from_window(the grandparent class) already handlesui_cancelnatively, the explicit check inColorPickerPopupPanelshould be removed entirely. The base class behavior is sufficient.Class hierarchy showing redundant ui_cancel handling
// Popup::_input_from_window (popup.cpp:42-48) if (get_flag(FLAG_POPUP) && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { hide_reason = HIDE_REASON_CANCELED; _close_pressed(); } Window::_input_from_window(p_event); // PopupPanel::_input_from_window (popup.cpp:248-270) // ... handles mouse clicks ... Popup::_input_from_window(p_event); // Delegates to parent // ColorPickerPopupPanel::_input_from_window (current) if (p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { _close_pressed(); // REDUNDANT - Popup already handles this } PopupPanel::_input_from_window(p_event); // Will trigger Popup's ui_cancel check againRecommended fix: Remove lines 2418–2420 entirely and just call
PopupPanel::_input_from_window(p_event)directly.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scene/gui/color_picker.cpp` around lines 2417 - 2422, Remove the redundant explicit ui_cancel handling in ColorPickerPopupPanel::_input_from_window: delete the if block that checks p_event->is_action_pressed(SNAME("ui_cancel"), ...) and calls _close_pressed(), and let the existing PopupPanel::_input_from_window(p_event) call handle ui_cancel via the Popup::_input_from_window path; this prevents _close_pressed() from being invoked twice.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@scene/gui/color_picker.cpp`:
- Around line 2417-2422: Remove the redundant explicit ui_cancel handling in
ColorPickerPopupPanel::_input_from_window: delete the if block that checks
p_event->is_action_pressed(SNAME("ui_cancel"), ...) and calls _close_pressed(),
and let the existing PopupPanel::_input_from_window(p_event) call handle
ui_cancel via the Popup::_input_from_window path; this prevents _close_pressed()
from being invoked twice.
59e4fc0
into
Redot-Engine:master
Fixes #1199
Before when you press spacebar it would cause the window to be closed, now spacebar can be used in the popup window.
Pressing escape, or clicking off the colorpicker still works in closing the color picker.
Summary by CodeRabbit