Added a setting to force launch the project in an adjacent window in the android editor.

This commit is contained in:
Relintai 2023-02-08 09:25:47 +01:00
parent 7f358b25a6
commit 0eb9d6648f
3 changed files with 31 additions and 11 deletions

View File

@ -32,16 +32,16 @@
#include <stdio.h>
#include "plugins/script_editor_plugin.h"
#include "script_editor_debugger.h"
#include "core/config/project_settings.h"
#include "editor_settings.h"
#include "core/containers/vector.h"
#include "core/error/error_macros.h"
#include "core/math/math_funcs.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
#include "core/variant/variant.h"
#include "core/containers/vector.h"
#include "editor_settings.h"
#include "plugins/script_editor_plugin.h"
#include "script_editor_debugger.h"
EditorRun::Status EditorRun::get_status() const {
return status;
@ -74,6 +74,14 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
}
#endif
#ifdef ANDROID_ENABLED
const bool android_force_side_by_side_window = EditorSettings::get_singleton()->get("run/window_placement/android_force_launch_adjacent");
if (android_force_side_by_side_window) {
args.push_back("--android-force-launch-adjacent");
}
#endif
args.push_back("--allow_focus_steal_pid");
args.push_back(itos(OS::get_singleton()->get_process_id()));

View File

@ -30,32 +30,32 @@
#include "editor_settings.h"
#include "core/variant/array.h"
#include "core/object/class_db.h"
#include "core/math/color.h"
#include "core/variant/dictionary.h"
#include "core/config/project_settings.h"
#include "core/containers/rb_set.h"
#include "core/error/error_list.h"
#include "core/error/error_macros.h"
#include "core/input/input_event.h"
#include "core/io/certs_compressed.gen.h"
#include "core/io/config_file.h"
#include "core/io/ip.h"
#include "core/io/ip_address.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/math/color.h"
#include "core/math/math_funcs.h"
#include "core/math/vector2.h"
#include "core/object/class_db.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/input/input_event.h"
#include "core/os/keyboard.h"
#include "core/os/main_loop.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
#include "core/config/project_settings.h"
#include "core/containers/rb_set.h"
#include "core/string/translation.h"
#include "core/typedefs.h"
#include "core/variant/array.h"
#include "core/variant/dictionary.h"
#include "core/version_generated.gen.h"
#include "editor/editor_translation.h"
#include "scene/main/node.h"
@ -642,6 +642,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("run/window_placement/rect_custom_position", Vector2());
_initial_set("run/window_placement/screen", 0);
hints["run/window_placement/screen"] = PropertyInfo(Variant::INT, "run/window_placement/screen", PROPERTY_HINT_ENUM, screen_hints);
#ifdef ANDROID_ENABLED
_initial_set("run/window_placement/android_force_launch_adjacent", 0);
#endif
// Auto save
_initial_set("run/auto_save/save_before_running", true);

View File

@ -76,6 +76,8 @@ open class PandemoniumEditor : FullScreenPandemoniumApp() {
private const val PROJECT_MANAGER_ARG = "--project-manager"
private const val PROJECT_MANAGER_ARG_SHORT = "-p"
private const val PROJECT_MANAGER_PROCESS_NAME_SUFFIX = ":PandemoniumProjectManager"
private const val FORCE_LAUNCH_ADJACENT_ARG = "--android-force-launch-adjacent"
}
private val commandLineParams = ArrayList<String>()
@ -135,6 +137,13 @@ open class PandemoniumEditor : FullScreenPandemoniumApp() {
}
}
for (arg in args) {
if (FORCE_LAUNCH_ADJACENT_ARG == arg) {
launchAdjacent = true
break
}
}
// Launch a new activity
val newInstance = Intent(this, targetClass).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra(COMMAND_LINE_PARAMS, args)