X Tutup
Skip to content

Commit 642056a

Browse files
committed
Merge pull request #117228 from ryevdokimov/touch-optimization-no-restart
Remove restart requirement for `interface/touchscreen/enable_touch_optimizations` setting
2 parents e77db81 + 91a85af commit 642056a

File tree

8 files changed

+38
-10
lines changed

8 files changed

+38
-10
lines changed

editor/docks/editor_dock_manager.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@
5050
////////////////////////////////////////////////
5151
////////////////////////////////////////////////
5252

53+
void DockSplitContainer::_notification(int p_what) {
54+
switch (p_what) {
55+
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
56+
if (!EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen")) {
57+
return;
58+
}
59+
set_touch_dragger_enabled(EDITOR_GET("interface/touchscreen/enable_touch_optimizations"));
60+
} break;
61+
}
62+
}
63+
5364
void DockSplitContainer::_update_visibility() {
5465
if (is_updating) {
5566
return;

editor/docks/editor_dock_manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class DockSplitContainer : public SplitContainer {
5252
bool is_updating = false;
5353

5454
protected:
55+
void _notification(int p_what);
5556
void _update_visibility();
5657

5758
virtual void add_child_notify(Node *p_child) override;

editor/export/project_export.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ void ProjectExportDialog::_notification(int p_what) {
111111
}
112112
} break;
113113

114+
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
115+
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen")) {
116+
main_split->set_touch_dragger_enabled(EDITOR_GET("interface/touchscreen/enable_touch_optimizations"));
117+
}
118+
} break;
119+
114120
case NOTIFICATION_THEME_CHANGED: {
115121
_script_encryption_key_visibility_changed(show_script_key->is_pressed());
116122
duplicate_preset->set_button_icon(presets->get_editor_theme_icon(SNAME("Duplicate")));
@@ -1534,19 +1540,17 @@ ProjectExportDialog::ProjectExportDialog() {
15341540
VBoxContainer *main_vb = memnew(VBoxContainer);
15351541
add_child(main_vb);
15361542

1537-
HSplitContainer *hbox = memnew(HSplitContainer);
1538-
main_vb->add_child(hbox);
1539-
hbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
1540-
if (EDITOR_GET("interface/touchscreen/enable_touch_optimizations")) {
1541-
hbox->set_touch_dragger_enabled(true);
1542-
}
1543+
main_split = memnew(HSplitContainer);
1544+
main_vb->add_child(main_split);
1545+
main_split->set_v_size_flags(Control::SIZE_EXPAND_FILL);
1546+
main_split->set_touch_dragger_enabled(EDITOR_GET("interface/touchscreen/enable_touch_optimizations"));
15431547

15441548
// Presets list.
15451549

15461550
VBoxContainer *preset_vb = memnew(VBoxContainer);
15471551
preset_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
15481552
preset_vb->set_stretch_ratio(0.35);
1549-
hbox->add_child(preset_vb);
1553+
main_split->add_child(preset_vb);
15501554

15511555
Label *l = memnew(Label(TTR("Presets")));
15521556
l->set_theme_type_variation("HeaderSmall");
@@ -1586,7 +1590,7 @@ ProjectExportDialog::ProjectExportDialog() {
15861590
settings_vb = memnew(VBoxContainer);
15871591
settings_vb->hide();
15881592
settings_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
1589-
hbox->add_child(settings_vb);
1593+
main_split->add_child(settings_vb);
15901594

15911595
PanelContainer *panel = memnew(PanelContainer);
15921596
panel->set_theme_type_variation(SNAME("PanelForeground"));
@@ -1935,7 +1939,7 @@ ProjectExportDialog::ProjectExportDialog() {
19351939
empty_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
19361940
empty_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
19371941
empty_label->hide();
1938-
hbox->add_child(empty_label);
1942+
main_split->add_child(empty_label);
19391943

19401944
// Deletion dialog.
19411945

editor/export/project_export.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
class CheckBox;
3838
class CheckButton;
39+
class HSplitContainer;
3940
class EditorFileDialog;
4041
class EditorFileSystemDirectory;
4142
class EditorInspector;
@@ -73,6 +74,7 @@ class ProjectExportTextureFormatError : public HBoxContainer {
7374
class ProjectExportDialog : public ConfirmationDialog {
7475
GDCLASS(ProjectExportDialog, ConfirmationDialog);
7576

77+
HSplitContainer *main_split = nullptr;
7678
TabContainer *sections = nullptr;
7779

7880
MenuButton *add_preset = nullptr;

editor/settings/editor_settings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
625625
bool is_native_touchscreen = has_touchscreen_ui && !OS::get_singleton()->has_feature("xr_editor"); // Disable some touchscreen settings by default for the XR Editor.
626626

627627
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_touch_optimizations", is_native_touchscreen, "")
628-
set_restart_if_changed("interface/touchscreen/enable_touch_optimizations", true);
629628
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_long_press_as_right_click", is_native_touchscreen, "")
630629
set_restart_if_changed("interface/touchscreen/enable_long_press_as_right_click", true);
631630

editor/settings/editor_settings_dialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ void EditorSettingsDialog::_notification(int p_what) {
304304
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/localization/localize_settings")) {
305305
inspector->update_category_list();
306306
}
307+
308+
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen")) {
309+
inspector->set_touch_dragger_enabled(EDITOR_GET("interface/touchscreen/enable_touch_optimizations"));
310+
}
307311
} break;
308312
}
309313
}

editor/settings/project_settings_editor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,12 @@ void ProjectSettingsEditor::_notification(int p_what) {
678678
case NOTIFICATION_THEME_CHANGED: {
679679
_update_theme();
680680
} break;
681+
682+
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
683+
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen")) {
684+
general_settings_inspector->set_touch_dragger_enabled(EDITOR_GET("interface/touchscreen/enable_touch_optimizations"));
685+
}
686+
} break;
681687
}
682688
}
683689

editor/themes/editor_theme_manager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ bool EditorThemeManager::is_generated_theme_outdated() {
718718
// TODO: We can use this information more intelligently to do partial theme updates and speed things up.
719719
outdated_cache = EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") ||
720720
EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/fonts") ||
721+
EditorSettings::get_singleton()->check_changed_settings_in_group("interface/touchscreen/enable_touch_optimizations") ||
721722
EditorSettings::get_singleton()->check_changed_settings_in_group("editors/visual_editors") ||
722723
EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") ||
723724
EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") ||

0 commit comments

Comments
 (0)
X Tutup