summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2024-07-29 23:44:01 +0200
committerkobewi <kobewi4e@gmail.com>2024-07-29 23:44:01 +0200
commit385284311ab63b787448b6387e3bd046aeb15032 (patch)
tree0ae2c92478b3338d61f747f61b1ce7516d2716e9
parent0e9caa2d9cb20737f8dcf08b75fcf2a78d980569 (diff)
downloadredot-engine-385284311ab63b787448b6387e3bd046aeb15032.tar.gz
Use legacy color picking in single window mode
-rw-r--r--scene/gui/color_picker.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index a2aee353f9..8a3edc25b9 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -54,6 +54,18 @@ void ColorPicker::_notification(int p_what) {
_update_color();
} break;
+ case NOTIFICATION_READY: {
+ // FIXME: The embedding check is needed to fix a bug in single-window mode (GH-93718).
+ if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SCREEN_CAPTURE) && !get_tree()->get_root()->is_embedding_subwindows()) {
+ btn_pick->set_tooltip_text(ETR("Pick a color from the screen."));
+ btn_pick->connect(SceneStringName(pressed), callable_mp(this, &ColorPicker::_pick_button_pressed));
+ } else {
+ // On unsupported platforms, use a legacy method for color picking.
+ btn_pick->set_tooltip_text(ETR("Pick a color from the application window."));
+ btn_pick->connect(SceneStringName(pressed), callable_mp(this, &ColorPicker::_pick_button_pressed_legacy));
+ }
+ } break;
+
case NOTIFICATION_TRANSLATION_CHANGED: {
List<BaseButton *> buttons;
preset_group->get_buttons(&buttons);
@@ -1834,14 +1846,6 @@ ColorPicker::ColorPicker() {
btn_pick = memnew(Button);
sample_hbc->add_child(btn_pick);
- if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SCREEN_CAPTURE)) {
- btn_pick->set_tooltip_text(ETR("Pick a color from the screen."));
- btn_pick->connect(SceneStringName(pressed), callable_mp(this, &ColorPicker::_pick_button_pressed));
- } else {
- // On unsupported platforms, use a legacy method for color picking.
- btn_pick->set_tooltip_text(ETR("Pick a color from the application window."));
- btn_pick->connect(SceneStringName(pressed), callable_mp(this, &ColorPicker::_pick_button_pressed_legacy));
- }
sample = memnew(TextureRect);
sample_hbc->add_child(sample);