diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-08-01 00:06:38 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-08-01 00:06:38 +0200 |
commit | 6e50da8a377437f3ae42f2bba57e574991293b6d (patch) | |
tree | c82e55af8eaba113c45c139d13695897e3891a02 | |
parent | 4aa0b5226790ea52e888e1de87466899010cda33 (diff) | |
parent | 385284311ab63b787448b6387e3bd046aeb15032 (diff) | |
download | redot-engine-6e50da8a377437f3ae42f2bba57e574991293b6d.tar.gz |
Merge pull request #94931 from KoBeWi/1_window_1_hack
Use legacy color picking in single window mode
-rw-r--r-- | scene/gui/color_picker.cpp | 20 |
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); |