From 727b06a79f6cbfab3c01dfb23da343cf1a0d17b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 3 Mar 2026 14:57:27 +0100 Subject: [PATCH] Move ProcessID typedef out of OS This allows decoupling a number of files from `os.h`. --- core/config/engine.cpp | 1 + core/core_bind.cpp | 5 +-- core/core_bind.h | 1 + core/input/input_event_codec.cpp | 1 - core/object/worker_thread_pool.h | 3 +- core/os/os.h | 3 +- core/os/process_id.h | 35 +++++++++++++++++++ core/variant/variant_construct.h | 1 - .../apple_embedded/app_delegate_service.mm | 1 + .../display_server_apple_embedded.mm | 1 + drivers/apple_embedded/godot_view_renderer.mm | 1 + drivers/apple_embedded/os_apple_embedded.mm | 2 ++ drivers/coreaudio/audio_driver_coreaudio.mm | 1 + drivers/gles3/rasterizer_gles3.cpp | 8 +++++ drivers/gles3/rasterizer_gles3.h | 9 +---- drivers/unix/file_access_unix.cpp | 3 +- drivers/unix/file_access_unix_pipe.cpp | 3 +- drivers/windows/file_access_windows_pipe.cpp | 3 +- drivers/xaudio2/audio_driver_xaudio2.cpp | 3 +- editor/debugger/script_editor_debugger.cpp | 1 + editor/debugger/script_editor_debugger.h | 4 +-- editor/editor_node.cpp | 4 +-- editor/editor_node.h | 6 ++-- editor/export/editor_export_platform.cpp | 3 +- editor/export/editor_export_platform.h | 8 ++--- .../editor_export_platform_apple_embedded.cpp | 4 ++- .../editor_export_platform_apple_embedded.h | 1 - editor/project_manager/project_list.cpp | 9 +++++ editor/project_manager/project_list.h | 11 +----- editor/run/editor_run.cpp | 13 +++---- editor/run/editor_run.h | 16 ++++++--- editor/run/editor_run_bar.cpp | 6 ++-- editor/run/editor_run_bar.h | 7 ++-- editor/run/embedded_process.cpp | 4 +-- editor/run/embedded_process.h | 10 +++--- editor/run/game_view_plugin.cpp | 3 +- .../scene/2d/tiles/tile_map_layer_editor.cpp | 12 +++---- main/main.cpp | 3 +- main/steam_tracker.cpp | 1 + main/steam_tracker.h | 2 -- modules/fbx/register_types.cpp | 1 + .../tests/gdscript_test_runner_suite.h | 8 ++++- .../editor/editor_import_blend_runner.cpp | 5 +++ .../gltf/editor/editor_import_blend_runner.h | 6 ++-- modules/gltf/register_types.cpp | 1 + modules/gltf/tests/test_gltf.h | 1 - modules/gltf/tests/test_gltf_extras.h | 1 - modules/godot_physics_3d/register_types.cpp | 1 + modules/jolt_physics/register_types.cpp | 1 + modules/text_server_fb/thorvg_svg_in_ot.cpp | 1 - platform/android/export/export_plugin.cpp | 1 + platform/android/export/export_plugin.h | 1 - .../android/export/gradle_export_util.cpp | 1 + platform/android/export/gradle_export_util.h | 1 - .../file_access_filesystem_jandroid.cpp | 1 - platform/android/os_android.h | 2 -- platform/linuxbsd/export/export_plugin.h | 3 +- .../linuxbsd/freedesktop_at_spi_monitor.cpp | 2 -- .../wayland/display_server_wayland.cpp | 10 +++--- .../linuxbsd/wayland/display_server_wayland.h | 9 ++--- platform/linuxbsd/wayland/wayland_thread.cpp | 3 +- platform/linuxbsd/wayland/wayland_thread.h | 6 ++-- platform/linuxbsd/x11/display_server_x11.cpp | 8 ++--- platform/linuxbsd/x11/display_server_x11.h | 11 +++--- platform/linuxbsd/x11/gl_manager_x11.cpp | 1 + platform/linuxbsd/x11/gl_manager_x11.h | 2 +- platform/linuxbsd/x11/gl_manager_x11_egl.h | 1 - platform/macos/display_server_macos.h | 10 +++--- platform/macos/display_server_macos.mm | 13 +++---- platform/macos/display_server_macos_base.mm | 1 + .../macos/display_server_macos_embedded.mm | 1 + .../macos/editor/embedded_game_view_plugin.mm | 1 + .../macos/editor/embedded_process_macos.h | 5 +-- .../macos/editor/embedded_process_macos.mm | 3 +- platform/macos/export/export_plugin.cpp | 1 + platform/macos/export/export_plugin.h | 4 +-- platform/macos/godot_application.h | 2 -- platform/macos/godot_application_delegate.h | 2 -- platform/macos/godot_content_view.mm | 1 + platform/macos/os_macos.mm | 9 +++-- platform/windows/display_server_windows.cpp | 13 +++---- platform/windows/display_server_windows.h | 16 ++++----- platform/windows/export/export_plugin.cpp | 1 + platform/windows/export/export_plugin.h | 4 +-- platform/windows/gl_manager_windows_angle.h | 1 - .../windows/gl_manager_windows_native.cpp | 1 + platform/windows/gl_manager_windows_native.h | 1 - scene/gui/video_stream_player.cpp | 1 - servers/audio/audio_server.cpp | 10 ++++++ servers/audio/audio_server.h | 5 ++- servers/display/display_server.cpp | 11 +++--- servers/display/display_server.h | 12 +++---- .../physics_2d/physics_server_2d_wrap_mt.h | 14 ++++---- .../physics_3d/physics_server_3d_wrap_mt.h | 17 +++++---- servers/server_wrap_mt_common.h | 2 ++ 95 files changed, 273 insertions(+), 191 deletions(-) create mode 100644 core/os/process_id.h diff --git a/core/config/engine.cpp b/core/config/engine.cpp index 154fed8fa17..9a2c9318da1 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -34,6 +34,7 @@ #include "core/config/project_settings.h" #include "core/donors.gen.h" #include "core/license.gen.h" +#include "core/object/ref_counted.h" #include "core/variant/typed_array.h" #include "core/version.h" #include "servers/rendering/rendering_device.h" diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 3c29cced122..e78b5a56227 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -44,6 +44,7 @@ #include "core/os/keyboard.h" #include "core/os/main_loop.h" #include "core/os/os.h" +#include "core/os/process_id.h" #include "core/os/thread_safe.h" #include "core/variant/typed_array.h" @@ -428,7 +429,7 @@ int OS::create_instance(const Vector &p_arguments) { for (const String &arg : p_arguments) { args.push_back(arg); } - ::OS::ProcessID pid = 0; + ProcessID pid = 0; Error err = ::OS::get_singleton()->create_instance(args, &pid); if (err != OK) { return -1; @@ -449,7 +450,7 @@ int OS::create_process(const String &p_path, const Vector &p_arguments, for (const String &arg : p_arguments) { args.push_back(arg); } - ::OS::ProcessID pid = 0; + ProcessID pid = 0; Error err = ::OS::get_singleton()->create_process(p_path, args, &pid, p_open_console); if (err != OK) { return -1; diff --git a/core/core_bind.h b/core/core_bind.h index 3accebb7bca..547c1f0b660 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -31,6 +31,7 @@ #pragma once #include "core/debugger/engine_profiler.h" +#include "core/io/logger.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/object/class_db.h" diff --git a/core/input/input_event_codec.cpp b/core/input/input_event_codec.cpp index 85c0416aa3c..ac24eb45027 100644 --- a/core/input/input_event_codec.cpp +++ b/core/input/input_event_codec.cpp @@ -32,7 +32,6 @@ #include "core/input/input.h" #include "core/io/marshalls.h" -#include "core/os/os.h" enum class BoolShift : uint8_t { SHIFT = 0, diff --git a/core/object/worker_thread_pool.h b/core/object/worker_thread_pool.h index 293a5cdc0c9..d774da3ac58 100644 --- a/core/object/worker_thread_pool.h +++ b/core/object/worker_thread_pool.h @@ -30,9 +30,9 @@ #pragma once +#include "core/object/object.h" #include "core/os/condition_variable.h" #include "core/os/memory.h" -#include "core/os/os.h" #include "core/os/semaphore.h" #include "core/os/thread.h" #include "core/templates/local_vector.h" @@ -40,6 +40,7 @@ #include "core/templates/rid.h" #include "core/templates/safe_refcount.h" #include "core/templates/self_list.h" +#include "core/variant/callable.h" class WorkerThreadPool : public Object { GDCLASS(WorkerThreadPool, Object) diff --git a/core/os/os.h b/core/os/os.h index c8efac5a034..c6a12dd9339 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -33,6 +33,7 @@ #include "core/config/engine.h" #include "core/io/logger.h" #include "core/io/remote_filesystem_client.h" +#include "core/os/process_id.h" #include "core/os/time_enums.h" #include "core/string/ustring.h" #include "core/templates/list.h" @@ -137,8 +138,6 @@ protected: virtual bool _check_internal_feature_support(const String &p_feature) = 0; public: - typedef int64_t ProcessID; - static OS *get_singleton(); static bool prefer_meta_over_ctrl(); diff --git a/core/os/process_id.h b/core/os/process_id.h new file mode 100644 index 00000000000..9f2dc43c16e --- /dev/null +++ b/core/os/process_id.h @@ -0,0 +1,35 @@ +/**************************************************************************/ +/* process_id.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#pragma once + +#include + +typedef int64_t ProcessID; diff --git a/core/variant/variant_construct.h b/core/variant/variant_construct.h index 60bfbf275cf..2f6b5d00f26 100644 --- a/core/variant/variant_construct.h +++ b/core/variant/variant_construct.h @@ -36,7 +36,6 @@ #include "core/debugger/engine_debugger.h" #include "core/io/compression.h" #include "core/object/class_db.h" -#include "core/os/os.h" #include "core/templates/a_hash_map.h" #include "core/templates/local_vector.h" diff --git a/drivers/apple_embedded/app_delegate_service.mm b/drivers/apple_embedded/app_delegate_service.mm index ee2d03d0ce6..f649a8e9ed0 100644 --- a/drivers/apple_embedded/app_delegate_service.mm +++ b/drivers/apple_embedded/app_delegate_service.mm @@ -36,6 +36,7 @@ #include "core/config/project_settings.h" #include "core/os/main_loop.h" +#include "core/os/os.h" #import "drivers/coreaudio/audio_driver_coreaudio.h" #include "main/main.h" diff --git a/drivers/apple_embedded/display_server_apple_embedded.mm b/drivers/apple_embedded/display_server_apple_embedded.mm index d382a8558fa..739dbe29a81 100644 --- a/drivers/apple_embedded/display_server_apple_embedded.mm +++ b/drivers/apple_embedded/display_server_apple_embedded.mm @@ -42,6 +42,7 @@ #include "core/config/project_settings.h" #include "core/input/input.h" #include "core/io/file_access_pack.h" +#include "core/os/os.h" #include "servers/display/native_menu.h" #import diff --git a/drivers/apple_embedded/godot_view_renderer.mm b/drivers/apple_embedded/godot_view_renderer.mm index 95789c873bd..1cff7767cc5 100644 --- a/drivers/apple_embedded/godot_view_renderer.mm +++ b/drivers/apple_embedded/godot_view_renderer.mm @@ -35,6 +35,7 @@ #include "core/config/project_settings.h" #include "core/os/keyboard.h" +#include "core/os/os.h" #include "main/main.h" #include "servers/audio/audio_server.h" diff --git a/drivers/apple_embedded/os_apple_embedded.mm b/drivers/apple_embedded/os_apple_embedded.mm index b1be6226f76..d7178ecd78c 100644 --- a/drivers/apple_embedded/os_apple_embedded.mm +++ b/drivers/apple_embedded/os_apple_embedded.mm @@ -37,10 +37,12 @@ #import "godot_view_apple_embedded.h" #import "godot_view_controller.h" +#include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/io/dir_access.h" #include "core/io/file_access.h" #include "core/os/main_loop.h" +#include "core/os/os.h" #include "core/profiling/profiling.h" #import "drivers/apple/os_log_logger.h" #ifdef SDL_ENABLED diff --git a/drivers/coreaudio/audio_driver_coreaudio.mm b/drivers/coreaudio/audio_driver_coreaudio.mm index 7e5fef0cf33..7109756f8a0 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.mm +++ b/drivers/coreaudio/audio_driver_coreaudio.mm @@ -32,6 +32,7 @@ #ifdef COREAUDIO_ENABLED +#include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/os/os.h" diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 687c8004e1d..c3781f87db8 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -37,6 +37,7 @@ #include "core/io/dir_access.h" #include "core/io/image.h" #include "core/os/os.h" +#include "drivers/gles3/rasterizer_util_gles3.h" #include "servers/display/display_server.h" #include "servers/rendering/rendering_server.h" #include "servers/rendering/rendering_server_types.h" @@ -213,6 +214,13 @@ void RasterizerGLES3::finalize() { memdelete(config); } +void RasterizerGLES3::make_current(bool p_gles_over_gl) { + RasterizerUtilGLES3::set_gles_over_gl(p_gles_over_gl); + OS::get_singleton()->set_gles_over_gl(p_gles_over_gl); + _create_func = _create_current; + low_end = true; +} + RasterizerGLES3 *RasterizerGLES3::singleton = nullptr; #ifdef EGL_ENABLED diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index 24ab9de9226..0db1af75c39 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -32,7 +32,6 @@ #ifdef GLES3_ENABLED -#include "core/os/os.h" #include "drivers/gles3/effects/copy_effects.h" #include "drivers/gles3/effects/cubemap_filter.h" #include "drivers/gles3/effects/feed_effects.h" @@ -42,7 +41,6 @@ #include "drivers/gles3/environment/gi.h" #include "drivers/gles3/rasterizer_canvas_gles3.h" #include "drivers/gles3/rasterizer_scene_gles3.h" -#include "drivers/gles3/rasterizer_util_gles3.h" #include "drivers/gles3/storage/config.h" #include "drivers/gles3/storage/light_storage.h" #include "drivers/gles3/storage/material_storage.h" @@ -113,12 +111,7 @@ public: return memnew(RasterizerGLES3); } - static void make_current(bool p_gles_over_gl) { - RasterizerUtilGLES3::set_gles_over_gl(p_gles_over_gl); - OS::get_singleton()->set_gles_over_gl(p_gles_over_gl); - _create_func = _create_current; - low_end = true; - } + static void make_current(bool p_gles_over_gl); #ifdef WINDOWS_ENABLED static void set_screen_flipped_y(bool p_flipped) { diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 303d4174098..1e5081af9b4 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -32,8 +32,7 @@ #if defined(UNIX_ENABLED) -#include "core/os/os.h" -#include "core/string/print_string.h" +#include "core/string/ustring.h" #include #include diff --git a/drivers/unix/file_access_unix_pipe.cpp b/drivers/unix/file_access_unix_pipe.cpp index e808c5ded23..b74d94f6633 100644 --- a/drivers/unix/file_access_unix_pipe.cpp +++ b/drivers/unix/file_access_unix_pipe.cpp @@ -32,8 +32,7 @@ #if defined(UNIX_ENABLED) -#include "core/os/os.h" -#include "core/string/print_string.h" +#include "core/string/ustring.h" #include #include diff --git a/drivers/windows/file_access_windows_pipe.cpp b/drivers/windows/file_access_windows_pipe.cpp index 94dec737c70..d956596804e 100644 --- a/drivers/windows/file_access_windows_pipe.cpp +++ b/drivers/windows/file_access_windows_pipe.cpp @@ -32,8 +32,7 @@ #include "file_access_windows_pipe.h" -#include "core/os/os.h" -#include "core/string/print_string.h" +#include "core/string/ustring.h" Error FileAccessWindowsPipe::open_existing(HANDLE p_rfd, HANDLE p_wfd, bool p_blocking) { // Open pipe using handles created by CreatePipe(rfd, wfd, NULL, 4096) call in the OS.execute_with_pipe. diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index f5a043cfe10..bfd504058eb 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -31,8 +31,7 @@ #include "audio_driver_xaudio2.h" #include "core/config/engine.h" -#include "core/config/project_settings.h" -#include "core/os/os.h" +#include "core/math/math_funcs_binary.h" Error AudioDriverXAudio2::init() { active.clear(); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 448d828ea5a..a274cb3ea5b 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -34,6 +34,7 @@ #include "core/debugger/debugger_marshalls.h" #include "core/debugger/remote_debugger.h" #include "core/object/class_db.h" +#include "core/os/os.h" #include "core/string/ustring.h" #include "core/variant/typed_dictionary.h" #include "core/version.h" diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h index 0d4faba98cc..6364037cfb0 100644 --- a/editor/debugger/script_editor_debugger.h +++ b/editor/debugger/script_editor_debugger.h @@ -31,7 +31,7 @@ #pragma once #include "core/object/script_language.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "editor/debugger/editor_debugger_inspector.h" #include "editor/debugger/editor_debugger_node.h" #include "scene/gui/margin_container.h" @@ -164,7 +164,7 @@ private: EditorPerformanceProfiler *performance_profiler = nullptr; EditorExpressionEvaluator *expression_evaluator = nullptr; - OS::ProcessID remote_pid = 0; + ProcessID remote_pid = 0; bool move_to_foreground = true; bool can_request_idle_draw = false; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c1e63a2a060..3eb893b7b81 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5582,11 +5582,11 @@ bool EditorNode::is_scene_in_use(const String &p_path) { return false; } -OS::ProcessID EditorNode::has_child_process(OS::ProcessID p_pid) const { +ProcessID EditorNode::has_child_process(ProcessID p_pid) const { return project_run_bar->has_child_process(p_pid); } -void EditorNode::stop_child_process(OS::ProcessID p_pid) { +void EditorNode::stop_child_process(ProcessID p_pid) { project_run_bar->stop_child_process(p_pid); } diff --git a/editor/editor_node.h b/editor/editor_node.h index 06b660e77a9..b9d1476645e 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -31,7 +31,7 @@ #pragma once #include "core/object/script_language.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "core/templates/safe_refcount.h" #include "editor/editor_data.h" #include "editor/plugins/editor_plugin.h" @@ -952,8 +952,8 @@ public: void notify_all_debug_sessions_exited(); - OS::ProcessID has_child_process(OS::ProcessID p_pid) const; - void stop_child_process(OS::ProcessID p_pid); + ProcessID has_child_process(ProcessID p_pid) const; + void stop_child_process(ProcessID p_pid); Ref get_editor_theme() const { return theme; } void update_preview_themes(int p_mode); diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 67edf02a940..09087cdca0c 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -43,6 +43,7 @@ #include "core/io/resource_uid.h" #include "core/math/random_pcg.h" #include "core/object/class_db.h" +#include "core/os/os.h" #include "core/os/shared_object.h" #include "core/string/translation_server.h" #include "core/version.h" @@ -2570,7 +2571,7 @@ Error EditorExportPlatform::ssh_run_on_remote(const String &p_host, const String return OK; } -Error EditorExportPlatform::ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, OS::ProcessID *r_pid, int p_port_fwd) const { +Error EditorExportPlatform::ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, ProcessID *r_pid, int p_port_fwd) const { String ssh_path = EDITOR_GET("export/ssh/ssh"); if (ssh_path.is_empty()) { ssh_path = "ssh"; diff --git a/editor/export/editor_export_platform.h b/editor/export/editor_export_platform.h index 84554179195..918cb42624f 100644 --- a/editor/export/editor_export_platform.h +++ b/editor/export/editor_export_platform.h @@ -31,7 +31,7 @@ #pragma once #include "core/io/zip_io.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "editor/export/editor_export_preset.h" class DirAccess; @@ -193,8 +193,8 @@ protected: r_output.push_back(pipe); return err; } - OS::ProcessID _ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, int p_port_fwd = -1) const { - OS::ProcessID pid = 0; + ProcessID _ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, int p_port_fwd = -1) const { + ProcessID pid = 0; Error err = ssh_run_on_remote_no_wait(p_host, p_port, p_ssh_args, p_cmd_args, &pid, p_port_fwd); if (err != OK) { return -1; @@ -204,7 +204,7 @@ protected: } Error ssh_run_on_remote(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, String *r_out = nullptr, int p_port_fwd = -1) const; - Error ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, OS::ProcessID *r_pid = nullptr, int p_port_fwd = -1) const; + Error ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, ProcessID *r_pid = nullptr, int p_port_fwd = -1) const; Error ssh_push_to_remote(const String &p_host, const String &p_port, const Vector &p_scp_args, const String &p_src_file, const String &p_dst_file) const; Error _extract_android_assets(const String &p_bundle_path, String &r_pck_path, String &r_temp_dir); diff --git a/editor/export/editor_export_platform_apple_embedded.cpp b/editor/export/editor_export_platform_apple_embedded.cpp index 453e54d3a67..e9233a57b61 100644 --- a/editor/export/editor_export_platform_apple_embedded.cpp +++ b/editor/export/editor_export_platform_apple_embedded.cpp @@ -32,6 +32,8 @@ #include "core/io/json.h" #include "core/io/plist.h" +#include "core/os/os.h" +#include "core/os/process_id.h" #include "core/string/translation_server.h" #include "editor/editor_node.h" #include "editor/editor_string_names.h" @@ -2566,7 +2568,7 @@ int EditorExportPlatformAppleEmbedded::_execute(const String &p_path, const List Ref fa_stdout = pipe_info["stdio"]; Ref fa_stderr = pipe_info["stderr"]; - OS::ProcessID pid = pipe_info["pid"]; + ProcessID pid = pipe_info["pid"]; FileReader stdout_r(fa_stdout); FileReader stderr_r(fa_stderr); diff --git a/editor/export/editor_export_platform_apple_embedded.h b/editor/export/editor_export_platform_apple_embedded.h index 5a297ed5f3c..d41be858f41 100644 --- a/editor/export/editor_export_platform_apple_embedded.h +++ b/editor/export/editor_export_platform_apple_embedded.h @@ -39,7 +39,6 @@ #include "core/io/marshalls.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" -#include "core/os/os.h" #include "core/templates/safe_refcount.h" #include "editor/export/editor_export_platform.h" #include "editor/settings/editor_settings.h" diff --git a/editor/project_manager/project_list.cpp b/editor/project_manager/project_list.cpp index 873355e0bc0..677c1228e1b 100644 --- a/editor/project_manager/project_list.cpp +++ b/editor/project_manager/project_list.cpp @@ -492,6 +492,15 @@ struct ProjectListComparator { } }; +String ProjectList::Item::get_last_edited_string() const { + if (missing) { + return TTR("Missing Date"); + } + + OS::TimeZoneInfo tz = OS::get_singleton()->get_time_zone_info(); + return Time::get_singleton()->get_datetime_string_from_unix_time(last_edited + tz.bias * 60, true); +} + // Helpers. bool ProjectList::project_feature_looks_like_version(const String &p_feature) { diff --git a/editor/project_manager/project_list.h b/editor/project_manager/project_list.h index c62505daea4..f0c84d35aba 100644 --- a/editor/project_manager/project_list.h +++ b/editor/project_manager/project_list.h @@ -31,8 +31,6 @@ #pragma once #include "core/io/config_file.h" -#include "core/os/os.h" -#include "core/os/time.h" #include "scene/gui/box_container.h" #include "scene/gui/scroll_container.h" @@ -193,14 +191,7 @@ public: return path == l.path; } - String get_last_edited_string() const { - if (missing) { - return TTR("Missing Date"); - } - - OS::TimeZoneInfo tz = OS::get_singleton()->get_time_zone_info(); - return Time::get_singleton()->get_datetime_string_from_unix_time(last_edited + tz.bias * 60, true); - } + String get_last_edited_string() const; }; private: diff --git a/editor/run/editor_run.cpp b/editor/run/editor_run.cpp index 78a56496310..83998765b4b 100644 --- a/editor/run/editor_run.cpp +++ b/editor/run/editor_run.cpp @@ -32,6 +32,7 @@ #include "core/config/project_settings.h" #include "core/io/config_file.h" +#include "core/os/os.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/editor_node.h" #include "editor/run/run_instances_dialog.h" @@ -177,7 +178,7 @@ Error EditorRun::run(const String &p_scene, const String &p_write_movie, const V print_line(String(" ").join(output)); } - OS::ProcessID pid = 0; + ProcessID pid = 0; Error err = OS::get_singleton()->create_instance(instance_args, &pid); ERR_FAIL_COND_V(err, err); if (pid != 0) { @@ -202,8 +203,8 @@ bool EditorRun::request_screenshot(const Callable &p_callback) { } } -bool EditorRun::has_child_process(OS::ProcessID p_pid) const { - for (const OS::ProcessID &E : pids) { +bool EditorRun::has_child_process(ProcessID p_pid) const { + for (const ProcessID &E : pids) { if (E == p_pid) { return true; } @@ -211,7 +212,7 @@ bool EditorRun::has_child_process(OS::ProcessID p_pid) const { return false; } -void EditorRun::stop_child_process(OS::ProcessID p_pid) { +void EditorRun::stop_child_process(ProcessID p_pid) { if (has_child_process(p_pid)) { OS::get_singleton()->kill(p_pid); pids.erase(p_pid); @@ -220,7 +221,7 @@ void EditorRun::stop_child_process(OS::ProcessID p_pid) { void EditorRun::stop() { if (status != STATUS_STOP && pids.size() > 0) { - for (const OS::ProcessID &E : pids) { + for (const ProcessID &E : pids) { OS::get_singleton()->kill(E); } pids.clear(); @@ -230,7 +231,7 @@ void EditorRun::stop() { running_scene = ""; } -OS::ProcessID EditorRun::get_current_process() const { +ProcessID EditorRun::get_current_process() const { if (pids.front() == nullptr) { return 0; } diff --git a/editor/run/editor_run.h b/editor/run/editor_run.h index 07bd00f5565..7c6b7909f95 100644 --- a/editor/run/editor_run.h +++ b/editor/run/editor_run.h @@ -30,7 +30,13 @@ #pragma once -#include "core/os/os.h" +#include "core/math/vector2i.h" +#include "core/os/process_id.h" +#include "core/string/ustring.h" +#include "core/templates/list.h" +#include "core/variant/callable.h" + +#include // INT_MAX typedef void (*EditorRunInstanceStarting)(int p_index, List &r_arguments); typedef bool (*EditorRunInstanceRequestScreenshot)(const Callable &p_callback); @@ -43,7 +49,7 @@ public: STATUS_STOP }; - List pids; + List pids; struct WindowPlacement { int screen = 0; @@ -68,10 +74,10 @@ public: void run_native_notify() { status = STATUS_PLAY; } void stop(); - void stop_child_process(OS::ProcessID p_pid); - bool has_child_process(OS::ProcessID p_pid) const; + void stop_child_process(ProcessID p_pid); + bool has_child_process(ProcessID p_pid) const; int get_child_process_count() const { return pids.size(); } - OS::ProcessID get_current_process() const; + ProcessID get_current_process() const; static bool request_screenshot(const Callable &p_callback); diff --git a/editor/run/editor_run_bar.cpp b/editor/run/editor_run_bar.cpp index 48585751749..c61b8b5ebd7 100644 --- a/editor/run/editor_run_bar.cpp +++ b/editor/run/editor_run_bar.cpp @@ -480,11 +480,11 @@ Error EditorRunBar::start_native_device(int p_device_id) const { return run_native->start_run_native(p_device_id); } -OS::ProcessID EditorRunBar::has_child_process(OS::ProcessID p_pid) const { +ProcessID EditorRunBar::has_child_process(ProcessID p_pid) const { return editor_run.has_child_process(p_pid); } -void EditorRunBar::stop_child_process(OS::ProcessID p_pid) { +void EditorRunBar::stop_child_process(ProcessID p_pid) { if (!has_child_process(p_pid)) { return; } @@ -495,7 +495,7 @@ void EditorRunBar::stop_child_process(OS::ProcessID p_pid) { } } -OS::ProcessID EditorRunBar::get_current_process() const { +ProcessID EditorRunBar::get_current_process() const { return editor_run.get_current_process(); } diff --git a/editor/run/editor_run_bar.h b/editor/run/editor_run_bar.h index 5d383c6ba6e..1e7b16e9205 100644 --- a/editor/run/editor_run_bar.h +++ b/editor/run/editor_run_bar.h @@ -30,6 +30,7 @@ #pragma once +#include "core/os/process_id.h" #include "editor/export/editor_export.h" #include "editor/run/editor_run.h" #include "scene/gui/margin_container.h" @@ -129,9 +130,9 @@ public: Error start_native_device(int p_device_id) const; - OS::ProcessID has_child_process(OS::ProcessID p_pid) const; - void stop_child_process(OS::ProcessID p_pid); - OS::ProcessID get_current_process() const; + ProcessID has_child_process(ProcessID p_pid) const; + void stop_child_process(ProcessID p_pid); + ProcessID get_current_process() const; void set_movie_maker_enabled(bool p_enabled); bool is_movie_maker_enabled() const; diff --git a/editor/run/embedded_process.cpp b/editor/run/embedded_process.cpp index 4dfb62e52c6..377c967d957 100644 --- a/editor/run/embedded_process.cpp +++ b/editor/run/embedded_process.cpp @@ -190,7 +190,7 @@ int EmbeddedProcess::get_embedded_pid() const { return current_process_id; } -void EmbeddedProcess::embed_process(OS::ProcessID p_pid) { +void EmbeddedProcess::embed_process(ProcessID p_pid) { if (!window) { return; } @@ -395,7 +395,7 @@ void EmbeddedProcess::_check_mouse_over() { } void EmbeddedProcess::_check_focused_process_id() { - OS::ProcessID process_id = DisplayServer::get_singleton()->get_focused_process_id(); + ProcessID process_id = DisplayServer::get_singleton()->get_focused_process_id(); if (process_id != focused_process_id) { focused_process_id = process_id; if (focused_process_id == current_process_id) { diff --git a/editor/run/embedded_process.h b/editor/run/embedded_process.h index fbc9edf7177..7fdb9c4b2ff 100644 --- a/editor/run/embedded_process.h +++ b/editor/run/embedded_process.h @@ -30,7 +30,7 @@ #pragma once -#include "core/os/os.h" +#include "core/os/process_id.h" #include "scene/gui/control.h" class ScriptEditorDebugger; @@ -64,7 +64,7 @@ public: virtual bool is_embedding_completed() const = 0; virtual bool is_embedding_in_progress() const = 0; virtual bool is_process_focused() const = 0; - virtual void embed_process(OS::ProcessID p_pid) = 0; + virtual void embed_process(ProcessID p_pid) = 0; virtual int get_embedded_pid() const = 0; virtual void reset() = 0; virtual void reset_timers() = 0; @@ -87,8 +87,8 @@ class EmbeddedProcess : public EmbeddedProcessBase { bool application_has_focus = true; uint64_t last_application_focus_time = 0; - OS::ProcessID focused_process_id = 0; - OS::ProcessID current_process_id = 0; + ProcessID focused_process_id = 0; + ProcessID current_process_id = 0; bool embedding_grab_focus = false; bool embedding_completed = false; uint64_t start_embedding_time = 0; @@ -118,7 +118,7 @@ public: bool is_embedding_in_progress() const override; bool is_embedding_completed() const override; bool is_process_focused() const override; - void embed_process(OS::ProcessID p_pid) override; + void embed_process(ProcessID p_pid) override; int get_embedded_pid() const override; void reset() override; void reset_timers() override; diff --git a/editor/run/game_view_plugin.cpp b/editor/run/game_view_plugin.cpp index 9ab21d824a4..a556249992a 100644 --- a/editor/run/game_view_plugin.cpp +++ b/editor/run/game_view_plugin.cpp @@ -33,6 +33,7 @@ #include "core/config/project_settings.h" #include "core/debugger/debugger_marshalls.h" #include "core/object/class_db.h" +#include "core/os/process_id.h" #include "core/string/translation_server.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/debugger/script_editor_debugger.h" @@ -461,7 +462,7 @@ void GameView::_play_pressed() { return; } - OS::ProcessID current_process_id = EditorRunBar::get_singleton()->get_current_process(); + ProcessID current_process_id = EditorRunBar::get_singleton()->get_current_process(); if (current_process_id == 0) { return; } diff --git a/editor/scene/2d/tiles/tile_map_layer_editor.cpp b/editor/scene/2d/tiles/tile_map_layer_editor.cpp index f8e19534c8d..9fb6367a46f 100644 --- a/editor/scene/2d/tiles/tile_map_layer_editor.cpp +++ b/editor/scene/2d/tiles/tile_map_layer_editor.cpp @@ -30,9 +30,14 @@ #include "tile_map_layer_editor.h" -#include "core/object/class_db.h" #include "tiles_editor_plugin.h" +#include "core/input/input.h" +#include "core/math/geometry_2d.h" +#include "core/math/random_pcg.h" +#include "core/object/class_db.h" +#include "core/os/keyboard.h" +#include "core/os/os.h" #include "editor/editor_node.h" #include "editor/editor_undo_redo_manager.h" #include "editor/inspector/editor_resource_preview.h" @@ -46,11 +51,6 @@ #include "scene/gui/grid_container.h" #include "scene/gui/split_container.h" -#include "core/input/input.h" -#include "core/math/geometry_2d.h" -#include "core/math/random_pcg.h" -#include "core/os/keyboard.h" - void SwitchSeparator::set_vertical(bool p_vertical) { h_separator->set_visible(p_vertical); v_separator->set_visible(!p_vertical); diff --git a/main/main.cpp b/main/main.cpp index be079955bd2..1b388d912e9 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -51,6 +51,7 @@ #include "core/object/message_queue.h" #include "core/object/script_language.h" #include "core/os/os.h" +#include "core/os/process_id.h" #include "core/os/time.h" #include "core/profiling/profiling.h" #include "core/register_core_types.h" @@ -217,7 +218,7 @@ static String locale; static String log_file; static bool show_help = false; static uint64_t quit_after = 0; -static OS::ProcessID editor_pid = 0; +static ProcessID editor_pid = 0; #ifdef TOOLS_ENABLED static bool found_project = false; static bool recovery_mode = false; diff --git a/main/steam_tracker.cpp b/main/steam_tracker.cpp index 864453d7c59..871df33391e 100644 --- a/main/steam_tracker.cpp +++ b/main/steam_tracker.cpp @@ -33,6 +33,7 @@ #include "steam_tracker.h" #include "core/io/file_access.h" +#include "core/os/os.h" // https://partner.steamgames.com/doc/sdk/api#initialization_and_shutdown diff --git a/main/steam_tracker.h b/main/steam_tracker.h index 2e111c71f4d..a461bb21904 100644 --- a/main/steam_tracker.h +++ b/main/steam_tracker.h @@ -32,8 +32,6 @@ #if defined(STEAMAPI_ENABLED) -#include "core/os/os.h" - // SteamTracker is used to load SteamAPI dynamic library and initialize // the interface, this notifies Steam that Godot editor is running and // allow tracking of the usage time of child instances of the engine diff --git a/modules/fbx/register_types.cpp b/modules/fbx/register_types.cpp index 0012e7706e9..73615d426e4 100644 --- a/modules/fbx/register_types.cpp +++ b/modules/fbx/register_types.cpp @@ -39,6 +39,7 @@ #include "editor/editor_scene_importer_fbx2gltf.h" #include "editor/editor_scene_importer_ufbx.h" +#include "core/config/engine.h" #include "core/config/project_settings.h" #include "editor/editor_node.h" diff --git a/modules/gdscript/tests/gdscript_test_runner_suite.h b/modules/gdscript/tests/gdscript_test_runner_suite.h index 2eba3d9c18d..1d14b184e4f 100644 --- a/modules/gdscript/tests/gdscript_test_runner_suite.h +++ b/modules/gdscript/tests/gdscript_test_runner_suite.h @@ -32,10 +32,16 @@ #include "gdscript_test_runner.h" -#include "modules/gdscript/gdscript_cache.h" +#include "../gdscript_cache.h" + +#include "core/io/file_access.h" #include "tests/test_macros.h" #include "tests/test_utils.h" +#ifdef TOOLS_ENABLED +#include "core/os/os.h" +#endif + namespace GDScriptTests { class TestGDScriptCacheAccessor { diff --git a/modules/gltf/editor/editor_import_blend_runner.cpp b/modules/gltf/editor/editor_import_blend_runner.cpp index 4586c986992..8dd20ed0888 100644 --- a/modules/gltf/editor/editor_import_blend_runner.cpp +++ b/modules/gltf/editor/editor_import_blend_runner.cpp @@ -32,6 +32,7 @@ #include "core/io/http_client.h" #include "core/object/callable_method_pointer.h" +#include "core/os/os.h" #include "editor/editor_node.h" #include "editor/file_system/editor_file_system.h" #include "editor/settings/editor_settings.h" @@ -180,6 +181,10 @@ Error EditorImportBlendRunner::start_blender(const String &p_python_script, bool return err; } +bool EditorImportBlendRunner::is_running() { + return blender_pid != 0 && OS::get_singleton()->is_process_running(blender_pid); +} + Error EditorImportBlendRunner::do_import(const Dictionary &p_options) { if (is_using_rpc()) { Error err = do_import_rpc(p_options); diff --git a/modules/gltf/editor/editor_import_blend_runner.h b/modules/gltf/editor/editor_import_blend_runner.h index c2a087b719d..afc2e68601e 100644 --- a/modules/gltf/editor/editor_import_blend_runner.h +++ b/modules/gltf/editor/editor_import_blend_runner.h @@ -31,7 +31,7 @@ #pragma once #include "core/io/http_client.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "scene/main/node.h" #include "scene/main/timer.h" @@ -48,7 +48,7 @@ class EditorImportBlendRunner : public Node { protected: int rpc_port = 0; - OS::ProcessID blender_pid = 0; + ProcessID blender_pid = 0; Error start_blender(const String &p_python_script, bool p_blocking); Error do_import_direct(const Dictionary &p_options); Error do_import_rpc(const Dictionary &p_options); @@ -56,7 +56,7 @@ protected: public: static EditorImportBlendRunner *get_singleton() { return singleton; } - bool is_running() { return blender_pid != 0 && OS::get_singleton()->is_process_running(blender_pid); } + bool is_running(); bool is_using_rpc() { return rpc_port != 0; } Error do_import(const Dictionary &p_options); HTTPClient::Status connect_blender_rpc(const Ref &p_client, int p_timeout_usecs); diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp index d0bc92a1ce8..de54a26ace2 100644 --- a/modules/gltf/register_types.cpp +++ b/modules/gltf/register_types.cpp @@ -50,6 +50,7 @@ #include "editor/editor_scene_importer_blend.h" #include "editor/editor_scene_importer_gltf.h" +#include "core/config/engine.h" #include "core/config/project_settings.h" #include "editor/editor_node.h" #include "editor/settings/editor_settings.h" diff --git a/modules/gltf/tests/test_gltf.h b/modules/gltf/tests/test_gltf.h index 267bd1883ed..a45e2a2e9d3 100644 --- a/modules/gltf/tests/test_gltf.h +++ b/modules/gltf/tests/test_gltf.h @@ -36,7 +36,6 @@ #include "core/config/project_settings.h" #include "core/io/dir_access.h" -#include "core/os/os.h" #include "drivers/png/image_loader_png.h" #include "editor/import/3d/resource_importer_scene.h" #include "editor/import/resource_importer_texture.h" diff --git a/modules/gltf/tests/test_gltf_extras.h b/modules/gltf/tests/test_gltf_extras.h index 219d92b2922..2d4430e22d0 100644 --- a/modules/gltf/tests/test_gltf_extras.h +++ b/modules/gltf/tests/test_gltf_extras.h @@ -35,7 +35,6 @@ #ifdef TOOLS_ENABLED -#include "core/os/os.h" #include "editor/import/3d/resource_importer_scene.h" #include "scene/3d/mesh_instance_3d.h" #include "scene/3d/skeleton_3d.h" diff --git a/modules/godot_physics_3d/register_types.cpp b/modules/godot_physics_3d/register_types.cpp index 9328b8becf5..6b9c210ff56 100644 --- a/modules/godot_physics_3d/register_types.cpp +++ b/modules/godot_physics_3d/register_types.cpp @@ -32,6 +32,7 @@ #include "godot_physics_server_3d.h" +#include "core/config/project_settings.h" #include "core/object/callable_method_pointer.h" #include "servers/physics_3d/physics_server_3d.h" #include "servers/physics_3d/physics_server_3d_wrap_mt.h" diff --git a/modules/jolt_physics/register_types.cpp b/modules/jolt_physics/register_types.cpp index 888988f2202..408addff7c6 100644 --- a/modules/jolt_physics/register_types.cpp +++ b/modules/jolt_physics/register_types.cpp @@ -34,6 +34,7 @@ #include "jolt_physics_server_3d.h" #include "jolt_project_settings.h" +#include "core/config/project_settings.h" #include "core/object/callable_method_pointer.h" #include "servers/physics_3d/physics_server_3d_wrap_mt.h" diff --git a/modules/text_server_fb/thorvg_svg_in_ot.cpp b/modules/text_server_fb/thorvg_svg_in_ot.cpp index f9f6c8b8256..e65de9808e4 100644 --- a/modules/text_server_fb/thorvg_svg_in_ot.cpp +++ b/modules/text_server_fb/thorvg_svg_in_ot.cpp @@ -46,7 +46,6 @@ using namespace godot; #include "core/error/error_macros.h" #include "core/io/xml_parser.h" #include "core/os/memory.h" -#include "core/os/os.h" #include "core/string/ustring.h" #include "core/typedefs.h" #include "core/variant/variant.h" diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 18c1510d065..fccf4e3007b 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -40,6 +40,7 @@ #include "core/io/json.h" #include "core/io/marshalls.h" #include "core/math/random_pcg.h" +#include "core/os/os.h" #include "core/string/translation_server.h" #include "core/version.h" #include "editor/editor_log.h" diff --git a/platform/android/export/export_plugin.h b/platform/android/export/export_plugin.h index 038c7fb236d..2f08e89fc80 100644 --- a/platform/android/export/export_plugin.h +++ b/platform/android/export/export_plugin.h @@ -38,7 +38,6 @@ #include "core/io/image.h" #include "core/io/zip_io.h" -#include "core/os/os.h" #include "editor/export/editor_export_platform.h" class ImageTexture; diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index 90c5acfd70a..4d16cb2e61c 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -30,6 +30,7 @@ #include "gradle_export_util.h" +#include "core/os/os.h" #include "core/string/translation_server.h" #include "modules/regex/regex.h" diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index dd3c583b405..3aea2786c98 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -34,7 +34,6 @@ #include "core/io/dir_access.h" #include "core/io/file_access.h" #include "core/io/zip_io.h" -#include "core/os/os.h" #include "editor/export/editor_export.h" #include "editor/export/editor_export_platform.h" #include "servers/display/display_server_enums.h" diff --git a/platform/android/file_access_filesystem_jandroid.cpp b/platform/android/file_access_filesystem_jandroid.cpp index c8666f53240..668eb96f54b 100644 --- a/platform/android/file_access_filesystem_jandroid.cpp +++ b/platform/android/file_access_filesystem_jandroid.cpp @@ -32,7 +32,6 @@ #include "thread_jandroid.h" -#include "core/os/os.h" #include "core/templates/local_vector.h" #include diff --git a/platform/android/os_android.h b/platform/android/os_android.h index b05069b8521..f484090d016 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -106,8 +106,6 @@ public: virtual void finalize() override; - typedef int64_t ProcessID; - static OS_Android *get_singleton(); GodotJavaWrapper *get_godot_java(); GodotIOJavaWrapper *get_godot_io_java(); diff --git a/platform/linuxbsd/export/export_plugin.h b/platform/linuxbsd/export/export_plugin.h index 91f84f5a245..5b223876f82 100644 --- a/platform/linuxbsd/export/export_plugin.h +++ b/platform/linuxbsd/export/export_plugin.h @@ -31,6 +31,7 @@ #pragma once #include "core/io/file_access.h" +#include "core/os/process_id.h" #include "editor/export/editor_export_platform_pc.h" #include "editor/settings/editor_settings.h" #include "scene/resources/image_texture.h" @@ -61,7 +62,7 @@ class EditorExportPlatformLinuxBSD : public EditorExportPlatformPC { Ref stop_icon; Vector cleanup_commands; - OS::ProcessID ssh_pid = 0; + ProcessID ssh_pid = 0; int menu_options = 0; bool is_elf(const String &p_path) const; diff --git a/platform/linuxbsd/freedesktop_at_spi_monitor.cpp b/platform/linuxbsd/freedesktop_at_spi_monitor.cpp index 8f7e8bf69a4..fb9e73f1f7a 100644 --- a/platform/linuxbsd/freedesktop_at_spi_monitor.cpp +++ b/platform/linuxbsd/freedesktop_at_spi_monitor.cpp @@ -32,8 +32,6 @@ #ifdef DBUS_ENABLED -#include "core/os/os.h" - #ifdef SOWRAP_ENABLED #include "dbus-so_wrap.h" #else diff --git a/platform/linuxbsd/wayland/display_server_wayland.cpp b/platform/linuxbsd/wayland/display_server_wayland.cpp index c1f64cdc3e4..49138717377 100644 --- a/platform/linuxbsd/wayland/display_server_wayland.cpp +++ b/platform/linuxbsd/wayland/display_server_wayland.cpp @@ -1533,7 +1533,7 @@ bool DisplayServerWayland::get_swap_cancel_ok() { return swap_cancel_ok; } -Error DisplayServerWayland::embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { +Error DisplayServerWayland::embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { MutexLock mutex_lock(wayland_thread.mutex); struct godot_embedding_compositor *ec = wayland_thread.get_embedding_compositor(); @@ -1585,7 +1585,7 @@ Error DisplayServerWayland::embed_process(DisplayServerEnums::WindowID p_window, return OK; } -Error DisplayServerWayland::request_close_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerWayland::request_close_embedded_process(ProcessID p_pid) { MutexLock mutex_lock(wayland_thread.mutex); struct godot_embedding_compositor *ec = wayland_thread.get_embedding_compositor(); @@ -1606,14 +1606,14 @@ Error DisplayServerWayland::request_close_embedded_process(OS::ProcessID p_pid) return OK; } -Error DisplayServerWayland::remove_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerWayland::remove_embedded_process(ProcessID p_pid) { return request_close_embedded_process(p_pid); } -OS::ProcessID DisplayServerWayland::get_focused_process_id() { +ProcessID DisplayServerWayland::get_focused_process_id() { MutexLock mutex_lock(wayland_thread.mutex); - OS::ProcessID embedded_pid = wayland_thread.embedded_compositor_get_focused_pid(); + ProcessID embedded_pid = wayland_thread.embedded_compositor_get_focused_pid(); if (embedded_pid < 0) { return OS::get_singleton()->get_process_id(); diff --git a/platform/linuxbsd/wayland/display_server_wayland.h b/platform/linuxbsd/wayland/display_server_wayland.h index 397cccea87b..d2f63d7c598 100644 --- a/platform/linuxbsd/wayland/display_server_wayland.h +++ b/platform/linuxbsd/wayland/display_server_wayland.h @@ -34,6 +34,7 @@ #include "wayland/wayland_thread.h" +#include "core/os/process_id.h" #include "servers/display/display_server.h" class InputEvent; @@ -322,10 +323,10 @@ public: virtual bool get_swap_cancel_ok() override; - virtual Error embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) override; - virtual Error request_close_embedded_process(OS::ProcessID p_pid) override; - virtual Error remove_embedded_process(OS::ProcessID p_pid) override; - virtual OS::ProcessID get_focused_process_id() override; + virtual Error embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) override; + virtual Error request_close_embedded_process(ProcessID p_pid) override; + virtual Error remove_embedded_process(ProcessID p_pid) override; + virtual ProcessID get_focused_process_id() override; virtual int keyboard_get_layout_count() const override; virtual int keyboard_get_current_layout() const override; diff --git a/platform/linuxbsd/wayland/wayland_thread.cpp b/platform/linuxbsd/wayland/wayland_thread.cpp index 10148cd8d78..c8e98639f53 100644 --- a/platform/linuxbsd/wayland/wayland_thread.cpp +++ b/platform/linuxbsd/wayland/wayland_thread.cpp @@ -32,6 +32,7 @@ #include "core/config/engine.h" #include "core/io/image.h" +#include "core/os/os.h" #ifdef WAYLAND_ENABLED @@ -5497,7 +5498,7 @@ struct godot_embedding_compositor *WaylandThread::get_embedding_compositor() { return registry.godot_embedding_compositor; } -OS::ProcessID WaylandThread::embedded_compositor_get_focused_pid() { +ProcessID WaylandThread::embedded_compositor_get_focused_pid() { EmbeddingCompositorState *ecomp_state = godot_embedding_compositor_get_state(registry.godot_embedding_compositor); ERR_FAIL_NULL_V(ecomp_state, -1); diff --git a/platform/linuxbsd/wayland/wayland_thread.h b/platform/linuxbsd/wayland/wayland_thread.h index 1c542aa51a8..2df57dd502a 100644 --- a/platform/linuxbsd/wayland/wayland_thread.h +++ b/platform/linuxbsd/wayland/wayland_thread.h @@ -88,7 +88,7 @@ #endif // LIBDECOR_ENABLED #include "core/input/input_event.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "core/os/thread.h" #include "servers/display/display_server_enums.h" @@ -573,7 +573,7 @@ public: // Only a client per PID can create a window. HashMap mapped_clients; - OS::ProcessID focused_pid = -1; + ProcessID focused_pid = -1; }; struct EmbeddedClientState { @@ -1204,7 +1204,7 @@ public: struct godot_embedding_compositor *get_embedding_compositor(); - OS::ProcessID embedded_compositor_get_focused_pid(); + ProcessID embedded_compositor_get_focused_pid(); Error init(); void destroy(); diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 93ce1d7ec84..9abd69634e9 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -6072,7 +6072,7 @@ void DisplayServerX11::_set_window_taskbar_pager_enabled(Window p_window, bool p XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xev); } -Error DisplayServerX11::embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { +Error DisplayServerX11::embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { _THREAD_SAFE_METHOD_ ERR_FAIL_COND_V(!windows.has(p_window), FAILED); @@ -6208,7 +6208,7 @@ Error DisplayServerX11::embed_process(DisplayServerEnums::WindowID p_window, OS: return OK; } -Error DisplayServerX11::request_close_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerX11::request_close_embedded_process(ProcessID p_pid) { _THREAD_SAFE_METHOD_ if (!embedded_processes.has(p_pid)) { @@ -6241,7 +6241,7 @@ Error DisplayServerX11::request_close_embedded_process(OS::ProcessID p_pid) { return OK; } -Error DisplayServerX11::remove_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerX11::remove_embedded_process(ProcessID p_pid) { _THREAD_SAFE_METHOD_ if (!embedded_processes.has(p_pid)) { @@ -6258,7 +6258,7 @@ Error DisplayServerX11::remove_embedded_process(OS::ProcessID p_pid) { return OK; } -OS::ProcessID DisplayServerX11::get_focused_process_id() { +ProcessID DisplayServerX11::get_focused_process_id() { Window focused_window = 0; int revert_to = 0; diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h index 9c8381d49f7..289c62a129b 100644 --- a/platform/linuxbsd/x11/display_server_x11.h +++ b/platform/linuxbsd/x11/display_server_x11.h @@ -34,6 +34,7 @@ #include "core/input/input_enums.h" #include "core/os/mutex.h" +#include "core/os/process_id.h" #include "core/os/thread.h" #include "core/templates/local_vector.h" #include "servers/display/display_server.h" @@ -373,7 +374,7 @@ class DisplayServerX11 : public DisplayServer { Window process_window = 0; bool visible = true; }; - HashMap embedded_processes; + HashMap embedded_processes; Point2i _get_window_position(Window p_window) const; Rect2i _get_window_rect(Window p_window) const; @@ -531,10 +532,10 @@ public: virtual void window_start_drag(DisplayServerEnums::WindowID p_window = DisplayServerEnums::MAIN_WINDOW_ID) override; virtual void window_start_resize(DisplayServerEnums::WindowResizeEdge p_edge, DisplayServerEnums::WindowID p_window) override; - virtual Error embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) override; - virtual Error request_close_embedded_process(OS::ProcessID p_pid) override; - virtual Error remove_embedded_process(OS::ProcessID p_pid) override; - virtual OS::ProcessID get_focused_process_id() override; + virtual Error embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) override; + virtual Error request_close_embedded_process(ProcessID p_pid) override; + virtual Error remove_embedded_process(ProcessID p_pid) override; + virtual ProcessID get_focused_process_id() override; virtual void cursor_set_shape(DisplayServerEnums::CursorShape p_shape) override; virtual DisplayServerEnums::CursorShape cursor_get_shape() const override; diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp index 5f6ffffdc99..85093fce71d 100644 --- a/platform/linuxbsd/x11/gl_manager_x11.cpp +++ b/platform/linuxbsd/x11/gl_manager_x11.cpp @@ -32,6 +32,7 @@ #if defined(X11_ENABLED) && defined(GLES3_ENABLED) +#include "core/os/os.h" #include "servers/display/display_server.h" #include "thirdparty/glad/glad/glx.h" diff --git a/platform/linuxbsd/x11/gl_manager_x11.h b/platform/linuxbsd/x11/gl_manager_x11.h index 1a5d5cf5586..523d6ac1bbb 100644 --- a/platform/linuxbsd/x11/gl_manager_x11.h +++ b/platform/linuxbsd/x11/gl_manager_x11.h @@ -32,7 +32,7 @@ #if defined(X11_ENABLED) && defined(GLES3_ENABLED) -#include "core/os/os.h" +#include "core/math/vector2i.h" #include "core/templates/local_vector.h" #include "servers/display/display_server_enums.h" diff --git a/platform/linuxbsd/x11/gl_manager_x11_egl.h b/platform/linuxbsd/x11/gl_manager_x11_egl.h index 2c7d9001b5a..325f5e376d2 100644 --- a/platform/linuxbsd/x11/gl_manager_x11_egl.h +++ b/platform/linuxbsd/x11/gl_manager_x11_egl.h @@ -32,7 +32,6 @@ #if defined(X11_ENABLED) && defined(GLES3_ENABLED) -#include "core/os/os.h" #include "core/templates/local_vector.h" #include "drivers/egl/egl_manager.h" #include "servers/display/display_server_enums.h" diff --git a/platform/macos/display_server_macos.h b/platform/macos/display_server_macos.h index bf2a1d3df68..0d01fd21c95 100644 --- a/platform/macos/display_server_macos.h +++ b/platform/macos/display_server_macos.h @@ -37,6 +37,8 @@ #include "gl_manager_macos_legacy.h" #endif // GLES3_ENABLED +#include "core/os/process_id.h" + #if defined(RD_ENABLED) #include "servers/rendering/rendering_device.h" @@ -244,7 +246,7 @@ private: WindowData *wd = nullptr; CALayer *layer_host = nil; }; - HashMap embedded_processes; + HashMap embedded_processes; #endif void _window_update_display_id(WindowData *p_wd); @@ -411,11 +413,11 @@ public: virtual bool get_swap_cancel_ok() override; - virtual void enable_for_stealing_focus(OS::ProcessID pid) override; + virtual void enable_for_stealing_focus(ProcessID pid) override; #ifdef TOOLS_ENABLED Error embed_process_update(DisplayServerEnums::WindowID p_window, EmbeddedProcessMacOS *p_process); - virtual Error request_close_embedded_process(OS::ProcessID p_pid) override; - virtual Error remove_embedded_process(OS::ProcessID p_pid) override; + virtual Error request_close_embedded_process(ProcessID p_pid) override; + virtual Error remove_embedded_process(ProcessID p_pid) override; #endif void _process_events(bool p_pump); diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 9f0a9988ce1..7f071a37045 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -58,6 +58,7 @@ #include "core/object/callable_method_pointer.h" #include "core/os/keyboard.h" #include "core/os/main_loop.h" +#include "core/os/os.h" #include "drivers/png/png_driver_common.h" #include "main/main.h" #include "scene/resources/image_texture.h" @@ -2868,7 +2869,7 @@ void DisplayServerMacOS::update_screen_parameters() { } #ifdef TOOLS_ENABLED - for (KeyValue &E : embedded_processes) { + for (KeyValue &E : embedded_processes) { E.value.process->display_state_changed(); } #endif @@ -3039,7 +3040,7 @@ bool DisplayServerMacOS::get_swap_cancel_ok() { return false; } -void DisplayServerMacOS::enable_for_stealing_focus(OS::ProcessID pid) { +void DisplayServerMacOS::enable_for_stealing_focus(ProcessID pid) { } #define GET_OR_FAIL_V(m_val, m_map, m_key, m_retval) \ @@ -3065,7 +3066,7 @@ void DisplayServerMacOS::_window_update_display_id(WindowData *p_wd) { #ifdef TOOLS_ENABLED // Notify any embedded processes of the new display ID, so that they can potentially update their vsync. - for (KeyValue &E : embedded_processes) { + for (KeyValue &E : embedded_processes) { if (E.value.wd == p_wd) { E.value.process->display_state_changed(); } @@ -3081,7 +3082,7 @@ Error DisplayServerMacOS::embed_process_update(DisplayServerEnums::WindowID p_wi WindowData *wd; GET_OR_FAIL_V(wd, windows, p_window, FAILED); - OS::ProcessID p_pid = p_process->get_embedded_pid(); + ProcessID p_pid = p_process->get_embedded_pid(); [CATransaction begin]; [CATransaction setDisableActions:YES]; @@ -3118,11 +3119,11 @@ Error DisplayServerMacOS::embed_process_update(DisplayServerEnums::WindowID p_wi return OK; } -Error DisplayServerMacOS::request_close_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerMacOS::request_close_embedded_process(ProcessID p_pid) { return OK; } -Error DisplayServerMacOS::remove_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerMacOS::remove_embedded_process(ProcessID p_pid) { _THREAD_SAFE_METHOD_ EmbeddedProcessData *ed; diff --git a/platform/macos/display_server_macos_base.mm b/platform/macos/display_server_macos_base.mm index 22d180e3702..70aaf558ab2 100644 --- a/platform/macos/display_server_macos_base.mm +++ b/platform/macos/display_server_macos_base.mm @@ -35,6 +35,7 @@ #include "core/config/project_settings.h" #include "core/os/main_loop.h" +#include "core/os/os.h" #include "drivers/png/png_driver_common.h" #if defined(RD_ENABLED) diff --git a/platform/macos/display_server_macos_embedded.mm b/platform/macos/display_server_macos_embedded.mm index a3decfe4ddf..c63cbdefe72 100644 --- a/platform/macos/display_server_macos_embedded.mm +++ b/platform/macos/display_server_macos_embedded.mm @@ -58,6 +58,7 @@ #import "core/input/input_event.h" #import "core/io/marshalls.h" #import "core/os/main_loop.h" +#import "core/os/os.h" #import "servers/display/native_menu.h" DisplayServerMacOSEmbedded::DisplayServerMacOSEmbedded(const String &p_rendering_driver, DisplayServerEnums::WindowMode p_mode, DisplayServerEnums::VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, DisplayServerEnums::Context p_context, Error &r_error) { diff --git a/platform/macos/editor/embedded_game_view_plugin.mm b/platform/macos/editor/embedded_game_view_plugin.mm index d6caba5afb8..b11f0524543 100644 --- a/platform/macos/editor/embedded_game_view_plugin.mm +++ b/platform/macos/editor/embedded_game_view_plugin.mm @@ -32,6 +32,7 @@ #include "embedded_process_macos.h" +#include "core/config/engine.h" #include "core/input/input.h" #include "editor/editor_node.h" #include "editor/gui/window_wrapper.h" diff --git a/platform/macos/editor/embedded_process_macos.h b/platform/macos/editor/embedded_process_macos.h index 46672ec3e35..9afc4214b91 100644 --- a/platform/macos/editor/embedded_process_macos.h +++ b/platform/macos/editor/embedded_process_macos.h @@ -31,6 +31,7 @@ #pragma once #include "core/object/class_db.h" +#include "core/os/process_id.h" #include "editor/run/embedded_process.h" #include "scene/gui/control.h" #include "servers/display/display_server_enums.h" @@ -85,7 +86,7 @@ class EmbeddedProcessMacOS final : public EmbeddedProcessBase { uint32_t context_id = 0; ScriptEditorDebugger *script_debugger = nullptr; LayerHost *layer_host = nullptr; - OS::ProcessID current_process_id = 0; + ProcessID current_process_id = 0; // Embedded process state. @@ -118,7 +119,7 @@ public: } bool is_process_focused() const override { return layer_host->has_focus(); } - void embed_process(OS::ProcessID p_pid) override; + void embed_process(ProcessID p_pid) override; int get_embedded_pid() const override { return current_process_id; } void reset() override; void reset_timers() override {} diff --git a/platform/macos/editor/embedded_process_macos.mm b/platform/macos/editor/embedded_process_macos.mm index 568a5756fb7..f83087e6a89 100644 --- a/platform/macos/editor/embedded_process_macos.mm +++ b/platform/macos/editor/embedded_process_macos.mm @@ -35,6 +35,7 @@ #include "core/input/input_event_codec.h" #include "core/os/main_loop.h" +#include "core/os/os.h" #include "editor/debugger/script_editor_debugger.h" #include "editor/editor_main_screen.h" #include "editor/editor_node.h" @@ -79,7 +80,7 @@ void EmbeddedProcessMacOS::set_script_debugger(ScriptEditorDebugger *p_debugger) _try_embed_process(); } -void EmbeddedProcessMacOS::embed_process(OS::ProcessID p_pid) { +void EmbeddedProcessMacOS::embed_process(ProcessID p_pid) { if (!window) { return; } diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index 305e8dbcac2..4908be7e31d 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -36,6 +36,7 @@ #include "core/io/image_loader.h" #include "core/io/plist.h" #include "core/object/class_db.h" +#include "core/os/os.h" #include "core/string/translation_server.h" #include "drivers/png/png_driver_common.h" #include "editor/editor_node.h" diff --git a/platform/macos/export/export_plugin.h b/platform/macos/export/export_plugin.h index d47d6f960fb..2482a826f1d 100644 --- a/platform/macos/export/export_plugin.h +++ b/platform/macos/export/export_plugin.h @@ -36,7 +36,7 @@ #include "core/io/image.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "editor/export/editor_export.h" #include "editor/settings/editor_settings.h" #include "scene/resources/image_texture.h" @@ -82,7 +82,7 @@ class EditorExportPlatformMacOS : public EditorExportPlatform { Ref stop_icon; Vector cleanup_commands; - OS::ProcessID ssh_pid = 0; + ProcessID ssh_pid = 0; int menu_options = 0; void _fix_privacy_manifest(const Ref &p_preset, Vector &plist); diff --git a/platform/macos/godot_application.h b/platform/macos/godot_application.h index 022c02f324e..5c26fccc432 100644 --- a/platform/macos/godot_application.h +++ b/platform/macos/godot_application.h @@ -30,8 +30,6 @@ #pragma once -#include "core/os/os.h" - #import #import #import diff --git a/platform/macos/godot_application_delegate.h b/platform/macos/godot_application_delegate.h index 17fb5f65fd6..ea4695ad655 100644 --- a/platform/macos/godot_application_delegate.h +++ b/platform/macos/godot_application_delegate.h @@ -30,8 +30,6 @@ #pragma once -#include "core/os/os.h" - #import #import diff --git a/platform/macos/godot_content_view.mm b/platform/macos/godot_content_view.mm index badf8b9bf72..d3fb28f3ebd 100644 --- a/platform/macos/godot_content_view.mm +++ b/platform/macos/godot_content_view.mm @@ -37,6 +37,7 @@ #include "core/input/input.h" #include "core/input/input_event.h" #include "core/os/keyboard.h" +#include "core/os/os.h" #include "core/profiling/profiling.h" #include "main/main.h" diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index fb3cb66c8da..0bb477ee33d 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -31,17 +31,20 @@ #import "os_macos.h" #import "dir_access_macos.h" -#ifdef TOOLS_ENABLED -#import "display_server_macos_embedded.h" -#endif #import "display_server_macos.h" #import "godot_application.h" #import "godot_application_delegate.h" +#ifdef TOOLS_ENABLED +#import "display_server_macos_embedded.h" +#endif + +#include "core/config/engine.h" #include "core/crypto/crypto_core.h" #include "core/input/input.h" #include "core/io/file_access.h" #include "core/os/main_loop.h" +#include "core/os/os.h" #include "core/profiling/profiling.h" #include "core/version_generated.gen.h" #include "drivers/apple/os_log_logger.h" diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 4493b91889d..0634a2bca6e 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -43,6 +43,7 @@ #include "core/io/xml_parser.h" #include "core/object/callable_method_pointer.h" #include "core/os/main_loop.h" +#include "core/os/os.h" #include "core/version.h" #include "drivers/png/png_driver_common.h" #include "main/main.h" @@ -3321,7 +3322,7 @@ bool DisplayServerWindows::get_swap_cancel_ok() { return true; } -void DisplayServerWindows::enable_for_stealing_focus(OS::ProcessID pid) { +void DisplayServerWindows::enable_for_stealing_focus(ProcessID pid) { _THREAD_SAFE_METHOD_ AllowSetForegroundWindow(pid); @@ -3352,7 +3353,7 @@ static BOOL CALLBACK _enum_proc_find_window_from_process_id_callback(HWND hWnd, return TRUE; } -HWND DisplayServerWindows::_find_window_from_process_id(OS::ProcessID p_pid, HWND p_current_hwnd) { +HWND DisplayServerWindows::_find_window_from_process_id(ProcessID p_pid, HWND p_current_hwnd) { DWORD pid = p_pid; WindowEnumData ed = { pid, p_current_hwnd, NULL }; @@ -3461,7 +3462,7 @@ void DisplayServerWindows::_update_hdr_output_for_tracked_windows() { } } -Error DisplayServerWindows::embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { +Error DisplayServerWindows::embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { _THREAD_SAFE_METHOD_ ERR_FAIL_COND_V(!windows.has(p_window), FAILED); @@ -3517,7 +3518,7 @@ Error DisplayServerWindows::embed_process(DisplayServerEnums::WindowID p_window, return OK; } -Error DisplayServerWindows::request_close_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerWindows::request_close_embedded_process(ProcessID p_pid) { _THREAD_SAFE_METHOD_ if (!embedded_processes.has(p_pid)) { @@ -3532,7 +3533,7 @@ Error DisplayServerWindows::request_close_embedded_process(OS::ProcessID p_pid) return OK; } -Error DisplayServerWindows::remove_embedded_process(OS::ProcessID p_pid) { +Error DisplayServerWindows::remove_embedded_process(ProcessID p_pid) { _THREAD_SAFE_METHOD_ if (!embedded_processes.has(p_pid)) { @@ -3582,7 +3583,7 @@ Error DisplayServerWindows::remove_embedded_process(OS::ProcessID p_pid) { return OK; } -OS::ProcessID DisplayServerWindows::get_focused_process_id() { +ProcessID DisplayServerWindows::get_focused_process_id() { HWND hwnd = GetForegroundWindow(); if (!hwnd) { return 0; diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index f6f9e2df48c..5df9eddb6ad 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -37,7 +37,7 @@ #include "core/config/project_settings.h" #include "core/input/input_event.h" #include "core/io/image.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "core/templates/rb_map.h" #include "drivers/wasapi/audio_driver_wasapi.h" #include "drivers/winmidi/midi_driver_winmidi.h" @@ -541,9 +541,9 @@ class DisplayServerWindows : public DisplayServer { HWND parent_window_handle = 0; bool is_visible = false; }; - HashMap embedded_processes; + HashMap embedded_processes; - HWND _find_window_from_process_id(OS::ProcessID p_pid, HWND p_current_hwnd); + HWND _find_window_from_process_id(ProcessID p_pid, HWND p_current_hwnd); void initialize_tts() const; @@ -732,11 +732,11 @@ public: virtual bool get_swap_cancel_ok() override; - virtual void enable_for_stealing_focus(OS::ProcessID pid) override; - virtual Error embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) override; - virtual Error request_close_embedded_process(OS::ProcessID p_pid) override; - virtual Error remove_embedded_process(OS::ProcessID p_pid) override; - virtual OS::ProcessID get_focused_process_id() override; + virtual void enable_for_stealing_focus(ProcessID pid) override; + virtual Error embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) override; + virtual Error request_close_embedded_process(ProcessID p_pid) override; + virtual Error remove_embedded_process(ProcessID p_pid) override; + virtual ProcessID get_focused_process_id() override; virtual Error dialog_show(String p_title, String p_description, Vector p_buttons, const Callable &p_callback) override; virtual Error dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) override; diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp index 2d45406a548..84178646159 100644 --- a/platform/windows/export/export_plugin.cpp +++ b/platform/windows/export/export_plugin.cpp @@ -37,6 +37,7 @@ #include "core/config/project_settings.h" #include "core/io/dir_access.h" #include "core/io/image_loader.h" +#include "core/os/os.h" #include "editor/editor_node.h" #include "editor/editor_string_names.h" #include "editor/export/editor_export.h" diff --git a/platform/windows/export/export_plugin.h b/platform/windows/export/export_plugin.h index 976e87312f5..076f58ec00a 100644 --- a/platform/windows/export/export_plugin.h +++ b/platform/windows/export/export_plugin.h @@ -31,7 +31,7 @@ #pragma once #include "core/io/file_access.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "editor/export/editor_export_platform_pc.h" #include "editor/settings/editor_settings.h" @@ -65,7 +65,7 @@ class EditorExportPlatformWindows : public EditorExportPlatformPC { Ref stop_icon; Vector cleanup_commands; - OS::ProcessID ssh_pid = 0; + ProcessID ssh_pid = 0; int menu_options = 0; Error _process_icon(const Ref &p_preset, const String &p_src_path, const String &p_dst_path); diff --git a/platform/windows/gl_manager_windows_angle.h b/platform/windows/gl_manager_windows_angle.h index cd1fd969c82..ca3c76d1416 100644 --- a/platform/windows/gl_manager_windows_angle.h +++ b/platform/windows/gl_manager_windows_angle.h @@ -32,7 +32,6 @@ #if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED) -#include "core/os/os.h" #include "core/templates/local_vector.h" #include "drivers/egl/egl_manager.h" #include "servers/display/display_server_enums.h" diff --git a/platform/windows/gl_manager_windows_native.cpp b/platform/windows/gl_manager_windows_native.cpp index 5799afb9e75..2824c1605b5 100644 --- a/platform/windows/gl_manager_windows_native.cpp +++ b/platform/windows/gl_manager_windows_native.cpp @@ -33,6 +33,7 @@ #if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED) #include "core/config/project_settings.h" +#include "core/os/os.h" #include "core/version.h" #include "thirdparty/misc/nvapi_minimal.h" diff --git a/platform/windows/gl_manager_windows_native.h b/platform/windows/gl_manager_windows_native.h index d8028b0c3a2..2a3f97d03d2 100644 --- a/platform/windows/gl_manager_windows_native.h +++ b/platform/windows/gl_manager_windows_native.h @@ -32,7 +32,6 @@ #if defined(WINDOWS_ENABLED) && defined(GLES3_ENABLED) -#include "core/os/os.h" #include "core/templates/local_vector.h" #include "core/templates/rb_map.h" #include "servers/display/display_server_enums.h" diff --git a/scene/gui/video_stream_player.cpp b/scene/gui/video_stream_player.cpp index 526f2f62322..2833472c38c 100644 --- a/scene/gui/video_stream_player.cpp +++ b/scene/gui/video_stream_player.cpp @@ -32,7 +32,6 @@ #include "core/config/engine.h" #include "core/object/class_db.h" -#include "core/os/os.h" #include "servers/audio/audio_server.h" #include "servers/display/accessibility_server.h" diff --git a/servers/audio/audio_server.cpp b/servers/audio/audio_server.cpp index 5ac1e9efd0d..98bb2cebd94 100644 --- a/servers/audio/audio_server.cpp +++ b/servers/audio/audio_server.cpp @@ -59,6 +59,16 @@ void AudioDriver::set_singleton() { singleton = this; } +#ifdef DEBUG_ENABLED +void AudioDriver::start_counting_ticks() { + prof_ticks.set(OS::get_singleton()->get_ticks_usec()); +} + +void AudioDriver::stop_counting_ticks() { + prof_time.add(OS::get_singleton()->get_ticks_usec() - prof_ticks.get()); +} +#endif // DEBUG_ENABLED + void AudioDriver::audio_server_process(int p_frames, int32_t *p_buffer, bool p_update_mix_time) { if (p_update_mix_time) { update_mix_time(p_frames); diff --git a/servers/audio/audio_server.h b/servers/audio/audio_server.h index 5c2a9befda1..0f80572ffd6 100644 --- a/servers/audio/audio_server.h +++ b/servers/audio/audio_server.h @@ -32,7 +32,6 @@ #include "core/math/audio_frame.h" #include "core/object/class_db.h" -#include "core/os/os.h" #include "core/templates/safe_list.h" #include "core/variant/variant.h" #include "servers/audio/audio_effect.h" @@ -70,8 +69,8 @@ protected: int _get_configured_mix_rate(); #ifdef DEBUG_ENABLED - _FORCE_INLINE_ void start_counting_ticks() { prof_ticks.set(OS::get_singleton()->get_ticks_usec()); } - _FORCE_INLINE_ void stop_counting_ticks() { prof_time.add(OS::get_singleton()->get_ticks_usec() - prof_ticks.get()); } + void start_counting_ticks(); + void stop_counting_ticks(); #else _FORCE_INLINE_ void start_counting_ticks() {} _FORCE_INLINE_ void stop_counting_ticks() {} diff --git a/servers/display/display_server.cpp b/servers/display/display_server.cpp index 89b835ecf5b..5804b596b5d 100644 --- a/servers/display/display_server.cpp +++ b/servers/display/display_server.cpp @@ -38,6 +38,7 @@ STATIC_ASSERT_INCOMPLETE_TYPE(class, RenderingServer); #include "core/input/input.h" #include "core/object/class_db.h" +#include "core/os/os.h" #include "scene/resources/texture.h" #include "servers/display/accessibility_server.h" #include "servers/display/display_server_headless.h" @@ -1154,25 +1155,25 @@ bool DisplayServer::get_swap_cancel_ok() { return false; } -void DisplayServer::enable_for_stealing_focus(OS::ProcessID pid) { +void DisplayServer::enable_for_stealing_focus(ProcessID pid) { } -Error DisplayServer::embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { +Error DisplayServer::embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) { WARN_PRINT("Embedded process not supported by this display server."); return ERR_UNAVAILABLE; } -Error DisplayServer::request_close_embedded_process(OS::ProcessID p_pid) { +Error DisplayServer::request_close_embedded_process(ProcessID p_pid) { WARN_PRINT("Embedded process not supported by this display server."); return ERR_UNAVAILABLE; } -Error DisplayServer::remove_embedded_process(OS::ProcessID p_pid) { +Error DisplayServer::remove_embedded_process(ProcessID p_pid) { WARN_PRINT("Embedded process not supported by this display server."); return ERR_UNAVAILABLE; } -OS::ProcessID DisplayServer::get_focused_process_id() { +ProcessID DisplayServer::get_focused_process_id() { WARN_PRINT("Embedded process not supported by this display server."); return 0; } diff --git a/servers/display/display_server.h b/servers/display/display_server.h index e956b5697c8..00688f7c3b3 100644 --- a/servers/display/display_server.h +++ b/servers/display/display_server.h @@ -34,7 +34,7 @@ #include "core/io/resource.h" #include "core/object/object.h" #include "core/os/keyboard.h" -#include "core/os/os.h" +#include "core/os/process_id.h" #include "core/variant/callable.h" #include "core/variant/typed_array.h" #include "servers/display/display_server_enums.h" @@ -486,12 +486,12 @@ public: /* PROCESS */ - virtual void enable_for_stealing_focus(OS::ProcessID pid); + virtual void enable_for_stealing_focus(ProcessID pid); - virtual Error embed_process(DisplayServerEnums::WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus); - virtual Error request_close_embedded_process(OS::ProcessID p_pid); - virtual Error remove_embedded_process(OS::ProcessID p_pid); - virtual OS::ProcessID get_focused_process_id(); + virtual Error embed_process(DisplayServerEnums::WindowID p_window, ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus); + virtual Error request_close_embedded_process(ProcessID p_pid); + virtual Error remove_embedded_process(ProcessID p_pid); + virtual ProcessID get_focused_process_id(); /* DIALOGS */ diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.h b/servers/physics_2d/physics_server_2d_wrap_mt.h index fbea3555fa6..7f0c39c3b24 100644 --- a/servers/physics_2d/physics_server_2d_wrap_mt.h +++ b/servers/physics_2d/physics_server_2d_wrap_mt.h @@ -53,6 +53,13 @@ #endif #endif +#define ServerName PhysicsServer2D +#define ServerNameWrapMT PhysicsServer2DWrapMT +#define server_name physics_server_2d +#define WRITE_ACTION + +#include "servers/server_wrap_mt_common.h" + class PhysicsServer2DWrapMT : public PhysicsServer2D { GDSOFTCLASS(PhysicsServer2DWrapMT, PhysicsServer2D); @@ -72,13 +79,6 @@ class PhysicsServer2DWrapMT : public PhysicsServer2D { void _thread_sync(); public: -#define ServerName PhysicsServer2D -#define ServerNameWrapMT PhysicsServer2DWrapMT -#define server_name physics_server_2d -#define WRITE_ACTION - -#include "servers/server_wrap_mt_common.h" - //FUNC1RID(shape,ShapeType); todo fix FUNCRID(world_boundary_shape) FUNCRID(separation_ray_shape) diff --git a/servers/physics_3d/physics_server_3d_wrap_mt.h b/servers/physics_3d/physics_server_3d_wrap_mt.h index b0c1542413a..9912eb3dc94 100644 --- a/servers/physics_3d/physics_server_3d_wrap_mt.h +++ b/servers/physics_3d/physics_server_3d_wrap_mt.h @@ -30,7 +30,6 @@ #pragma once -#include "core/config/project_settings.h" #include "core/object/worker_thread_pool.h" #include "core/os/thread.h" #include "core/templates/command_queue_mt.h" @@ -54,6 +53,13 @@ #endif #endif +#define ServerName PhysicsServer3D +#define ServerNameWrapMT PhysicsServer3DWrapMT +#define server_name physics_server_3d +#define WRITE_ACTION + +#include "servers/server_wrap_mt_common.h" + class PhysicsServer3DWrapMT : public PhysicsServer3D { GDSOFTCLASS(PhysicsServer3DWrapMT, PhysicsServer3D); @@ -74,13 +80,6 @@ class PhysicsServer3DWrapMT : public PhysicsServer3D { void _thread_sync(); public: -#define ServerName PhysicsServer3D -#define ServerNameWrapMT PhysicsServer3DWrapMT -#define server_name physics_server_3d -#define WRITE_ACTION - -#include "servers/server_wrap_mt_common.h" - //FUNC1RID(shape,ShapeType); todo fix FUNCRID(world_boundary_shape) FUNCRID(separation_ray_shape) @@ -414,12 +413,12 @@ public: PhysicsServer3DWrapMT(PhysicsServer3D *p_contained, bool p_create_thread); ~PhysicsServer3DWrapMT(); +}; #undef ServerNameWrapMT #undef ServerName #undef server_name #undef WRITE_ACTION -}; #ifdef DEBUG_SYNC #undef DEBUG_SYNC diff --git a/servers/server_wrap_mt_common.h b/servers/server_wrap_mt_common.h index 716f5e32ae4..ed19225391b 100644 --- a/servers/server_wrap_mt_common.h +++ b/servers/server_wrap_mt_common.h @@ -30,6 +30,8 @@ #pragma once +#include "core/config/engine.h" + #ifdef DEBUG_ENABLED #define MAIN_THREAD_SYNC_CHECK \ if (unlikely(Thread::is_main_thread() && Engine::get_singleton()->notify_frame_server_synced())) { \