summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2021-12-16 15:00:55 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2021-12-18 10:14:07 +0200
commitea5bb8b47dce95aa98f47d13ada8297670559c8b (patch)
tree17868fd701035115690b9d751a47da7858b9870f /platform/osx
parentb0e93711b36bae3d2bb3a7e9a4a88faf055499fb (diff)
[Windows] Improve console handling and execute/create_process.
Always build with the GUI subsystem. Redirect stdout and stderr output to the parent process console. Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with `create_process`). Add `open_console` argument to the `execute` and `create_process` to open a new console window. Remove `interface/editor/hide_console_window` editor setting. Remove `Toggle System Console` menu option. Remove `set_console_visible` and `is_console_visible` functions.
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/display_server_osx.h3
-rw-r--r--platform/osx/display_server_osx.mm9
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm10
4 files changed, 6 insertions, 18 deletions
diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h
index 3cc0b10c5b..44901e8ce6 100644
--- a/platform/osx/display_server_osx.h
+++ b/platform/osx/display_server_osx.h
@@ -314,9 +314,6 @@ public:
virtual void set_native_icon(const String &p_filename) override;
virtual void set_icon(const Ref<Image> &p_icon) override;
- virtual void console_set_visible(bool p_enabled) override;
- virtual bool is_console_visible() const override;
-
static DisplayServer *create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error);
static Vector<String> get_rendering_drivers_func();
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index fec5c98a99..cde00f2028 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -1480,7 +1480,6 @@ bool DisplayServerOSX::has_feature(Feature p_feature) const {
case FEATURE_CURSOR_SHAPE:
case FEATURE_CUSTOM_CURSOR_SHAPE:
case FEATURE_NATIVE_DIALOG:
- //case FEATURE_CONSOLE_WINDOW:
case FEATURE_IME:
case FEATURE_WINDOW_TRANSPARENCY:
case FEATURE_HIDPI:
@@ -3682,14 +3681,6 @@ void DisplayServerOSX::swap_buffers() {
#endif
}
-void DisplayServerOSX::console_set_visible(bool p_enabled) {
- //TODO - open terminal and redirect
-}
-
-bool DisplayServerOSX::is_console_visible() const {
- return isatty(STDIN_FILENO);
-}
-
DisplayServerOSX::DisplayServerOSX(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 7e02f4e154..daaaf3c18e 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -94,7 +94,7 @@ public:
String get_locale() const override;
virtual String get_executable_path() const override;
- virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr) override;
+ virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) override;
virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) override;
virtual String get_unique_id() const override; //++
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 39608bdea8..93e5fc7b79 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -497,13 +497,13 @@ Error OS_OSX::create_instance(const List<String> &p_arguments, ProcessID *r_chil
if (nsappname != nil) {
String path;
path.parse_utf8([[[NSBundle mainBundle] bundlePath] UTF8String]);
- return create_process(path, p_arguments, r_child_id);
+ return create_process(path, p_arguments, r_child_id, false);
} else {
- return create_process(get_executable_path(), p_arguments, r_child_id);
+ return create_process(get_executable_path(), p_arguments, r_child_id, false);
}
}
-Error OS_OSX::create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id) {
+Error OS_OSX::create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id, bool p_open_console) {
if (@available(macOS 10.15, *)) {
// Use NSWorkspace if path is an .app bundle.
NSURL *url = [NSURL fileURLWithPath:@(p_path.utf8().get_data())];
@@ -542,10 +542,10 @@ Error OS_OSX::create_process(const String &p_path, const List<String> &p_argumen
return err;
} else {
- return OS_Unix::create_process(p_path, p_arguments, r_child_id);
+ return OS_Unix::create_process(p_path, p_arguments, r_child_id, p_open_console);
}
} else {
- return OS_Unix::create_process(p_path, p_arguments, r_child_id);
+ return OS_Unix::create_process(p_path, p_arguments, r_child_id, p_open_console);
}
}