diff options
Diffstat (limited to 'platform')
70 files changed, 271 insertions, 159 deletions
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index 46bd691290..4fab40d534 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -30,8 +30,8 @@ #include "audio_driver_jandroid.h" -#include "os/os.h" -#include "project_settings.h" +#include "core/os/os.h" +#include "core/project_settings.h" #include "thread_jandroid.h" #ifndef ANDROID_NATIVE_ACTIVITY diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h index 88cb122414..8e879b27c5 100644 --- a/platform/android/audio_driver_opensl.h +++ b/platform/android/audio_driver_opensl.h @@ -31,7 +31,7 @@ #ifndef AUDIO_DRIVER_OPENSL_H #define AUDIO_DRIVER_OPENSL_H -#include "os/mutex.h" +#include "core/os/mutex.h" #include "servers/audio_server.h" #include <SLES/OpenSLES.h> diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h index 085d7160cd..3ac0bd6332 100644 --- a/platform/android/dir_access_android.h +++ b/platform/android/dir_access_android.h @@ -33,7 +33,7 @@ #ifdef ANDROID_NATIVE_ACTIVITY -#include "os/dir_access.h" +#include "core/os/dir_access.h" #include <android/asset_manager.h> #include <android/log.h> #include <android_native_app_glue.h> diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index ee5ae156b7..6a95277585 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -31,8 +31,8 @@ #ifndef ANDROID_NATIVE_ACTIVITY #include "dir_access_jandroid.h" +#include "core/print_string.h" #include "file_access_jandroid.h" -#include "print_string.h" #include "thread_jandroid.h" jobject DirAccessJAndroid::io = NULL; diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 8dc52ab9c8..1653fb0aa5 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -33,8 +33,8 @@ #ifndef ANDROID_NATIVE_ACTIVITY +#include "core/os/dir_access.h" #include "java_glue.h" -#include "os/dir_access.h" #include <stdio.h> class DirAccessJAndroid : public DirAccess { diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 5c8d9e078f..fa9474bfe8 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -30,17 +30,17 @@ #include "export.h" +#include "core/io/marshalls.h" +#include "core/io/zip_io.h" +#include "core/os/file_access.h" +#include "core/os/os.h" +#include "core/project_settings.h" +#include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "io/marshalls.h" -#include "io/zip_io.h" -#include "os/file_access.h" -#include "os/os.h" #include "platform/android/logo.gen.h" #include "platform/android/run_icon.gen.h" -#include "project_settings.h" -#include "version.h" #include <string.h> @@ -1337,7 +1337,7 @@ public: if (!FileAccess::exists(adb)) { valid = false; - err += "ADB executable not configured in editor settings.\n"; + err += "ADB executable not configured in the Editor Settings.\n"; } String js = EditorSettings::get_singleton()->get("export/android/jarsigner"); @@ -1345,7 +1345,7 @@ public: if (!FileAccess::exists(js)) { valid = false; - err += "OpenJDK 6 jarsigner not configured in editor settings.\n"; + err += "OpenJDK 8 jarsigner not configured in the Editor Settings.\n"; } String dk = EditorSettings::get_singleton()->get("export/android/debug_keystore"); @@ -1353,7 +1353,7 @@ public: if (!FileAccess::exists(dk)) { valid = false; - err += "Debug Keystore not configured in editor settings.\n"; + err += "Debug keystore not configured in the Editor Settings.\n"; } bool apk_expansion = p_preset->get("apk_expansion/enable"); @@ -1372,7 +1372,7 @@ public: if (apk_expansion_pkey == "") { valid = false; - err += "Invalid public key for apk expansion.\n"; + err += "Invalid public key for APK expansion.\n"; } } @@ -1680,7 +1680,7 @@ public: String jarsigner = EditorSettings::get_singleton()->get("export/android/jarsigner"); if (!FileAccess::exists(jarsigner)) { - EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the editor settings.\nResulting apk is unsigned."); + EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the Editor Settings.\nThe resulting APK is unsigned."); return OK; } @@ -1692,14 +1692,14 @@ public: password = EditorSettings::get_singleton()->get("export/android/debug_keystore_pass"); user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user"); - ep.step("Signing Debug APK...", 103); + ep.step("Signing debug APK...", 103); } else { keystore = release_keystore; password = release_password; user = release_username; - ep.step("Signing Release APK...", 103); + ep.step("Signing release APK...", 103); } if (!FileAccess::exists(keystore)) { @@ -1742,7 +1742,7 @@ public: OS::get_singleton()->execute(jarsigner, args, true, NULL, NULL, &retval); if (retval) { - EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6."); + EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use a jarsigner from OpenJDK 8."); return ERR_CANT_CREATE; } } diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index c2eed50e4c..4c7436a5dc 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "file_access_android.h" -#include "print_string.h" +#include "core/print_string.h" AAssetManager *FileAccessAndroid::asset_manager = NULL; diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index 03f4c59521..1ee8697fa4 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -31,7 +31,7 @@ #ifndef FILE_ACCESS_ANDROID_H #define FILE_ACCESS_ANDROID_H -#include "os/file_access.h" +#include "core/os/file_access.h" #include <android/asset_manager.h> #include <android/log.h> #include <stdio.h> diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index 214e273d9b..573200bcf9 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -31,7 +31,7 @@ #ifndef ANDROID_NATIVE_ACTIVITY #include "file_access_jandroid.h" -#include "os/os.h" +#include "core/os/os.h" #include "thread_jandroid.h" #include <unistd.h> diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h index 72f81ee02e..39c201ba85 100644 --- a/platform/android/file_access_jandroid.h +++ b/platform/android/file_access_jandroid.h @@ -33,8 +33,8 @@ #ifndef ANDROID_NATIVE_ACTIVITY +#include "core/os/file_access.h" #include "java_glue.h" -#include "os/file_access.h" class FileAccessJAndroid : public FileAccess { static jobject io; diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index a315f80452..efeb8598e5 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "global_defaults.h" -#include "project_settings.h" +#include "core/project_settings.h" void register_android_global_defaults() { } diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 061e05f5ee..54692dc831 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -30,11 +30,11 @@ #ifdef ANDROID_NATIVE_ACTIVITY -#include "engine.h" +#include "core/engine.h" +#include "core/project_settings.h" #include "file_access_android.h" #include "main/main.h" #include "os_android.h" -#include "project_settings.h" #include <EGL/egl.h> #include <android/log.h> diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index ef798fc790..92c9be5d43 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -59,6 +59,9 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.net.Uri; import android.media.MediaPlayer; +import android.content.ClipboardManager; +import android.content.ClipData; + import java.lang.reflect.Method; import java.util.List; import java.util.ArrayList; @@ -103,6 +106,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC private TextView mAverageSpeed; private TextView mTimeRemaining; private ProgressBar mPB; + private ClipboardManager mClipboard; private View mDashboard; private View mCellMessage; @@ -441,6 +445,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC Window window = getWindow(); //window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); + mClipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); //check for apk expansion API if (true) { @@ -607,6 +612,24 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC } } + public String getClipboard() { + + String copiedText = ""; + + if (mClipboard.getPrimaryClip() != null) { + ClipData.Item item = mClipboard.getPrimaryClip().getItemAt(0); + copiedText = item.getText().toString(); + } + + return copiedText; + } + + public void setClipboard(String p_text) { + + ClipData clip = ClipData.newPlainText("myLabel", p_text); + mClipboard.setPrimaryClip(clip); + } + @Override protected void onResume() { super.onResume(); diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h index 648c147ca8..ea3760452f 100644 --- a/platform/android/java_class_wrapper.h +++ b/platform/android/java_class_wrapper.h @@ -31,7 +31,7 @@ #ifndef JAVA_CLASS_WRAPPER_H #define JAVA_CLASS_WRAPPER_H -#include "reference.h" +#include "core/reference.h" #include <android/log.h> #include <jni.h> diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 8bb1c38345..6cf49758bc 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -33,16 +33,16 @@ #include "java_glue.h" #include "android/asset_manager_jni.h" #include "audio_driver_jandroid.h" +#include "core/engine.h" #include "core/os/keyboard.h" +#include "core/project_settings.h" #include "dir_access_jandroid.h" -#include "engine.h" #include "file_access_android.h" #include "file_access_jandroid.h" #include "java_class_wrapper.h" #include "main/input_default.h" #include "main/main.h" #include "os_android.h" -#include "project_settings.h" #include "thread_jandroid.h" #include <unistd.h> @@ -607,6 +607,8 @@ static jobject _godot_instance; static jmethodID _openURI = 0; static jmethodID _getDataDir = 0; static jmethodID _getLocale = 0; +static jmethodID _getClipboard = 0; +static jmethodID _setClipboard = 0; static jmethodID _getModel = 0; static jmethodID _getScreenDPI = 0; static jmethodID _showKeyboard = 0; @@ -646,6 +648,19 @@ static String _get_locale() { return String(env->GetStringUTFChars(s, NULL)); } +static String _get_clipboard() { + JNIEnv *env = ThreadAndroid::get_env(); + jstring s = (jstring)env->CallObjectMethod(_godot_instance, _getClipboard); + return String(env->GetStringUTFChars(s, NULL)); +} + +static void _set_clipboard(const String &p_text) { + + JNIEnv *env = ThreadAndroid::get_env(); + jstring jStr = env->NewStringUTF(p_text.utf8().get_data()); + env->CallVoidMethod(_godot_instance, _setClipboard, jStr); +} + static String _get_model() { JNIEnv *env = ThreadAndroid::get_env(); @@ -774,6 +789,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en _setKeepScreenOn = env->GetMethodID(cls, "setKeepScreenOn", "(Z)V"); _alertDialog = env->GetMethodID(cls, "alert", "(Ljava/lang/String;Ljava/lang/String;)V"); _getGLESVersionCode = env->GetMethodID(cls, "getGLESVersionCode", "()I"); + _getClipboard = env->GetMethodID(cls, "getClipboard", "()Ljava/lang/String;"); + _setClipboard = env->GetMethodID(cls, "setClipboard", "(Ljava/lang/String;)V"); jclass clsio = env->FindClass("org/godotengine/godot/Godot"); if (cls) { @@ -807,7 +824,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en AudioDriverAndroid::setup(gob); } - os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _get_gles_version_code, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion); + os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _get_gles_version_code, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, _set_clipboard, _get_clipboard, p_use_apk_expansion); os_android->set_need_reload_hooks(p_need_reload_hook); char wd[500]; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 74c40bde72..484ca4fff8 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -257,13 +257,10 @@ int OS_Android::get_mouse_button_state() const { return 0; } + void OS_Android::set_window_title(const String &p_title) { } -//interesting byt not yet -//void set_clipboard(const String& p_text); -//String get_clipboard() const; - void OS_Android::set_video_mode(const VideoMode &p_video_mode, int p_screen) { } @@ -599,6 +596,23 @@ String OS_Android::get_locale() const { return OS_Unix::get_locale(); } +void OS_Android::set_clipboard(const String &p_text) { + + if (set_clipboard_func) { + set_clipboard_func(p_text); + } else { + OS_Unix::set_clipboard(p_text); + } +} + +String OS_Android::get_clipboard() const { + if (get_clipboard_func) { + return get_clipboard_func(); + } + + return OS_Unix::get_clipboard(); +} + String OS_Android::get_model_name() const { if (get_model_func) @@ -732,7 +746,7 @@ bool OS_Android::_check_internal_feature_support(const String &p_feature) { return false; } -OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) { +OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, SetClipboardFunc p_set_clipboard_func, GetClipboardFunc p_get_clipboard_func, bool p_use_apk_expansion) { use_apk_expansion = p_use_apk_expansion; default_videomode.width = 800; @@ -765,6 +779,9 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI hide_virtual_keyboard_func = p_hide_vk; get_virtual_keyboard_height_func = p_vk_height_func; + set_clipboard_func = p_set_clipboard_func; + get_clipboard_func = p_get_clipboard_func; + set_screen_orientation_func = p_screen_orient; set_keep_screen_on_func = p_set_keep_screen_on_func; alert_func = p_alert_func; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index c4220906a3..9594c6fdf4 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -33,10 +33,10 @@ #include "audio_driver_jandroid.h" #include "audio_driver_opensl.h" +#include "core/os/input.h" +#include "core/os/main_loop.h" #include "drivers/unix/os_unix.h" #include "main/input_default.h" -#include "os/input.h" -#include "os/main_loop.h" //#include "power_android.h" #include "servers/audio_server.h" #include "servers/visual/rasterizer.h" @@ -51,6 +51,8 @@ typedef void (*GFXInitFunc)(void *ud, bool gl2); typedef int (*OpenURIFunc)(const String &); typedef String (*GetUserDataDirFunc)(); typedef String (*GetLocaleFunc)(); +typedef void (*SetClipboardFunc)(const String &); +typedef String (*GetClipboardFunc)(); typedef String (*GetModelFunc)(); typedef int (*GetScreenDPIFunc)(); typedef String (*GetUniqueIDFunc)(); @@ -119,6 +121,8 @@ private: OpenURIFunc open_uri_func; GetUserDataDirFunc get_user_data_dir_func; GetLocaleFunc get_locale_func; + SetClipboardFunc set_clipboard_func; + GetClipboardFunc get_clipboard_func; GetModelFunc get_model_func; GetScreenDPIFunc get_screen_dpi_func; ShowVirtualKeyboardFunc show_virtual_keyboard_func; @@ -140,7 +144,7 @@ private: int video_driver_index; public: - // functions used by main to initialize/deintialize the OS + // functions used by main to initialize/deinitialize the OS virtual int get_video_driver_count() const; virtual const char *get_video_driver_name(int p_driver) const; @@ -172,9 +176,6 @@ public: virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); - //virtual void set_clipboard(const String& p_text); - //virtual String get_clipboard() const; - virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); virtual VideoMode get_video_mode(int p_screen = 0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; @@ -218,6 +219,8 @@ public: virtual String get_user_data_dir() const; virtual String get_resource_dir() const; virtual String get_locale() const; + virtual void set_clipboard(const String &p_text); + virtual String get_clipboard() const; virtual String get_model_name() const; virtual int get_screen_dpi(int p_screen = 0) const; @@ -244,7 +247,7 @@ public: void joy_connection_changed(int p_device, bool p_connected, String p_name); virtual bool _check_internal_feature_support(const String &p_feature); - OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion); + OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, SetClipboardFunc p_set_clipboard, GetClipboardFunc p_get_clipboard, bool p_use_apk_expansion); ~OS_Android(); }; diff --git a/platform/android/power_android.h b/platform/android/power_android.h index f0d1bee1e2..c39764222e 100644 --- a/platform/android/power_android.h +++ b/platform/android/power_android.h @@ -31,7 +31,7 @@ #ifndef PLATFORM_ANDROID_POWER_ANDROID_H_ #define PLATFORM_ANDROID_POWER_ANDROID_H_ -#include "os/os.h" +#include "core/os/os.h" #include <android/native_window_jni.h> class power_android { diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp index b13baf69c2..6795315e63 100644 --- a/platform/android/thread_jandroid.cpp +++ b/platform/android/thread_jandroid.cpp @@ -30,9 +30,9 @@ #include "thread_jandroid.h" +#include "core/os/memory.h" #include "core/safe_refcount.h" -#include "os/memory.h" -#include "script_language.h" +#include "core/script_language.h" static pthread_key_t _create_thread_id_key() { pthread_key_t key; diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h index 2bb64f3db2..a57bc47e6d 100644 --- a/platform/android/thread_jandroid.h +++ b/platform/android/thread_jandroid.h @@ -35,7 +35,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ -#include "os/thread.h" +#include "core/os/thread.h" #include <jni.h> #include <pthread.h> #include <sys/types.h> diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp index aeaf698015..7e68c01fad 100644 --- a/platform/haiku/audio_driver_media_kit.cpp +++ b/platform/haiku/audio_driver_media_kit.cpp @@ -32,7 +32,7 @@ #ifdef MEDIA_KIT_ENABLED -#include "project_settings.h" +#include "core/project_settings.h" int32_t *AudioDriverMediaKit::samples_in = NULL; diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp index 7eeb226167..150e90be65 100644 --- a/platform/haiku/haiku_direct_window.cpp +++ b/platform/haiku/haiku_direct_window.cpp @@ -30,10 +30,10 @@ #include <UnicodeChar.h> +#include "core/os/keyboard.h" #include "haiku_direct_window.h" #include "key_mapping_haiku.h" #include "main/main.h" -#include "os/keyboard.h" HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) : BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) { diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp index 28a282e25c..ebe8117d5d 100644 --- a/platform/haiku/key_mapping_haiku.cpp +++ b/platform/haiku/key_mapping_haiku.cpp @@ -30,8 +30,8 @@ #include <InterfaceDefs.h> +#include "core/os/keyboard.h" #include "key_mapping_haiku.h" -#include "os/keyboard.h" struct _HaikuTranslatePair { unsigned int keysym; diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 008e213e5e..aae9d97a28 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -29,18 +29,18 @@ /*************************************************************************/ #include "export.h" +#include "core/io/marshalls.h" +#include "core/io/resource_saver.h" +#include "core/io/zip_io.h" +#include "core/os/file_access.h" +#include "core/os/os.h" +#include "core/project_settings.h" +#include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "io/marshalls.h" -#include "io/resource_saver.h" -#include "io/zip_io.h" -#include "os/file_access.h" -#include "os/os.h" #include "platform/iphone/logo.gen.h" -#include "project_settings.h" #include "string.h" -#include "version.h" #include <sys/stat.h> diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp index ccc90665c5..423f50995e 100644 --- a/platform/iphone/globals/global_defaults.cpp +++ b/platform/iphone/globals/global_defaults.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "global_defaults.h" -#include "project_settings.h" +#include "core/project_settings.h" void register_iphone_global_defaults() { } diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp index dacbf42087..f9b9654a8c 100644 --- a/platform/iphone/godot_iphone.cpp +++ b/platform/iphone/godot_iphone.cpp @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "core/ustring.h" #include "main/main.h" #include "os_iphone.h" -#include "ustring.h" #include <stdio.h> #include <string.h> diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index db2912ad93..64a3c6355a 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -33,9 +33,9 @@ #ifndef OS_IPHONE_H #define OS_IPHONE_H +#include "core/os/input.h" #include "drivers/coreaudio/audio_driver_coreaudio.h" #include "drivers/unix/os_unix.h" -#include "os/input.h" #include "game_center.h" #include "icloud.h" diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h index 94e4e5fa3b..34338d92e7 100644 --- a/platform/iphone/platform_refcount.h +++ b/platform/iphone/platform_refcount.h @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "safe_refcount.h" +#include "core/safe_refcount.h" #ifdef IPHONE_ENABLED diff --git a/platform/iphone/sem_iphone.cpp b/platform/iphone/sem_iphone.cpp index ec1337d63f..ebab9db8fa 100644 --- a/platform/iphone/sem_iphone.cpp +++ b/platform/iphone/sem_iphone.cpp @@ -70,7 +70,7 @@ void cgsem_destroy(cgsem_t *cgsem) { close(cgsem->pipefd[0]); } -#include "os/memory.h" +#include "core/os/memory.h" #include <errno.h> Error SemaphoreIphone::wait() { diff --git a/platform/iphone/sem_iphone.h b/platform/iphone/sem_iphone.h index ebd4e4ee43..3edc4492eb 100644 --- a/platform/iphone/sem_iphone.h +++ b/platform/iphone/sem_iphone.h @@ -37,7 +37,7 @@ struct cgsem { typedef struct cgsem cgsem_t; -#include "os/semaphore.h" +#include "core/os/semaphore.h" class SemaphoreIphone : public Semaphore { diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp index b377ca4e52..c7a6d53561 100644 --- a/platform/javascript/api/api.cpp +++ b/platform/javascript/api/api.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "api.h" -#include "engine.h" +#include "core/engine.h" #include "javascript_eval.h" static JavaScript *javascript_eval; diff --git a/platform/javascript/api/javascript_eval.h b/platform/javascript/api/javascript_eval.h index 05f7c9f38a..49d5309737 100644 --- a/platform/javascript/api/javascript_eval.h +++ b/platform/javascript/api/javascript_eval.h @@ -31,7 +31,7 @@ #ifndef JAVASCRIPT_EVAL_H #define JAVASCRIPT_EVAL_H -#include "object.h" +#include "core/object.h" class JavaScript : public Object { private: diff --git a/platform/javascript/dom_keys.inc b/platform/javascript/dom_keys.inc index dc8d67d52b..a30818decc 100644 --- a/platform/javascript/dom_keys.inc +++ b/platform/javascript/dom_keys.inc @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "os/keyboard.h" +#include "core/os/keyboard.h" // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#Constants_for_keyCode_value #define DOM_VK_CANCEL 0x03 diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index a7f0084562..1e47d8db95 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "core/io/zip_io.h" #include "editor/editor_node.h" #include "editor_export.h" -#include "io/zip_io.h" #include "main/splash.gen.h" #include "platform/javascript/logo.gen.h" #include "platform/javascript/run_icon.gen.h" diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index 8d90e01ae1..4fb41d4dc9 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "core/io/http_client.h" #include "http_request.h" -#include "io/http_client.h" Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) { diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 3829e8d406..ec60571402 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "io/resource_loader.h" +#include "core/io/resource_loader.h" #include "main/main.h" #include "os_javascript.h" diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index a7a26411b7..3515eeeb60 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -30,9 +30,9 @@ #include "os_javascript.h" +#include "core/io/file_access_buffered_fa.h" #include "gles2/rasterizer_gles2.h" #include "gles3/rasterizer_gles3.h" -#include "io/file_access_buffered_fa.h" #include "main/main.h" #include "servers/visual/visual_server_raster.h" #include "unix/dir_access_unix.h" @@ -708,7 +708,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, video_driver_index = p_video_driver; video_mode = p_desired; - // Can't fulfil fullscreen request during start-up due to browser security. + // Can't fulfill fullscreen request during start-up due to browser security. video_mode.fullscreen = false; /* clang-format off */ if (EM_ASM_INT_V({ return Module.resizeCanvasOnStart })) { diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm index 1664c5ce8e..9ad3437f0f 100644 --- a/platform/osx/crash_handler_osx.mm +++ b/platform/osx/crash_handler_osx.mm @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "core/project_settings.h" #include "main/main.h" #include "os_osx.h" -#include "project_settings.h" #include <string.h> #include <unistd.h> diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h index e01ff2fe4d..a9d6d63a8e 100644 --- a/platform/osx/dir_access_osx.h +++ b/platform/osx/dir_access_osx.h @@ -38,8 +38,8 @@ #include <sys/types.h> #include <unistd.h> +#include "core/os/dir_access.h" #include "drivers/unix/dir_access_unix.h" -#include "os/dir_access.h" /** @author Juan Linietsky <reduzio@gmail.com> diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 880705b507..b0232e2990 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -29,18 +29,18 @@ /*************************************************************************/ #include "export.h" +#include "core/io/marshalls.h" +#include "core/io/resource_saver.h" +#include "core/io/zip_io.h" +#include "core/os/file_access.h" +#include "core/os/os.h" +#include "core/project_settings.h" +#include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "io/marshalls.h" -#include "io/resource_saver.h" -#include "io/zip_io.h" -#include "os/file_access.h" -#include "os/os.h" #include "platform/osx/logo.gen.h" -#include "project_settings.h" #include "string.h" -#include "version.h" #include <sys/stat.h> class EditorExportPlatformOSX : public EditorExportPlatform { diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 686e3f8c90..6fd52f09d1 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -31,13 +31,13 @@ #ifndef OS_OSX_H #define OS_OSX_H +#include "core/os/input.h" #include "crash_handler_osx.h" #include "drivers/coreaudio/audio_driver_coreaudio.h" #include "drivers/coremidi/core_midi.h" #include "drivers/unix/os_unix.h" #include "joypad_osx.h" #include "main/input_default.h" -#include "os/input.h" #include "power_osx.h" #include "servers/audio_server.h" #include "servers/visual/rasterizer.h" diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 44b4223a65..c0de4e3f2a 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -30,15 +30,15 @@ #include "os_osx.h" +#include "core/os/keyboard.h" +#include "core/print_string.h" +#include "core/version_generated.gen.h" #include "dir_access_osx.h" #include "drivers/gles2/rasterizer_gles2.h" #include "drivers/gles3/rasterizer_gles3.h" #include "main/main.h" -#include "os/keyboard.h" -#include "print_string.h" #include "sem_osx.h" #include "servers/visual/visual_server_raster.h" -#include "version_generated.gen.h" #include <mach-o/dyld.h> diff --git a/platform/osx/power_osx.h b/platform/osx/power_osx.h index 7123e34a03..9ad51e505b 100644 --- a/platform/osx/power_osx.h +++ b/platform/osx/power_osx.h @@ -31,9 +31,9 @@ #ifndef PLATFORM_OSX_POWER_OSX_H_ #define PLATFORM_OSX_POWER_OSX_H_ +#include "core/os/file_access.h" +#include "core/os/os.h" #include "dir_access_osx.h" -#include "os/file_access.h" -#include "os/os.h" #include <CoreFoundation/CoreFoundation.h> class power_osx { diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp index 92f749322e..9b42abdb8d 100644 --- a/platform/osx/sem_osx.cpp +++ b/platform/osx/sem_osx.cpp @@ -65,7 +65,7 @@ void cgsem_destroy(cgsem_t *cgsem) { close(cgsem->pipefd[0]); } -#include "os/memory.h" +#include "core/os/memory.h" #include <errno.h> Error SemaphoreOSX::wait() { diff --git a/platform/osx/sem_osx.h b/platform/osx/sem_osx.h index ce31e966b7..0ab82873c6 100644 --- a/platform/osx/sem_osx.h +++ b/platform/osx/sem_osx.h @@ -37,7 +37,7 @@ struct cgsem { typedef struct cgsem cgsem_t; -#include "os/semaphore.h" +#include "core/os/semaphore.h" class SemaphoreOSX : public Semaphore { diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index 1c17780ad7..1069d6bbed 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -29,10 +29,10 @@ /*************************************************************************/ #include "os_server.h" +#include "core/print_string.h" #include "drivers/dummy/audio_driver_dummy.h" #include "drivers/dummy/rasterizer_dummy.h" #include "drivers/dummy/texture_loader_dummy.h" -#include "print_string.h" #include "servers/visual/visual_server_raster.h" #include "main/main.h" diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 1ad5293b44..6a7284f770 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -29,16 +29,16 @@ /*************************************************************************/ #include "export.h" -#include "bind/core_bind.h" +#include "core/bind/core_bind.h" +#include "core/io/marshalls.h" +#include "core/io/zip_io.h" +#include "core/object.h" +#include "core/os/file_access.h" +#include "core/project_settings.h" +#include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" -#include "io/marshalls.h" -#include "io/zip_io.h" -#include "object.h" -#include "os/file_access.h" #include "platform/uwp/logo.gen.h" -#include "project_settings.h" -#include "version.h" #include "thirdparty/minizip/unzip.h" #include "thirdparty/minizip/zip.h" diff --git a/platform/uwp/gl_context_egl.h b/platform/uwp/gl_context_egl.h index df0108c124..3e3c4a0f57 100644 --- a/platform/uwp/gl_context_egl.h +++ b/platform/uwp/gl_context_egl.h @@ -34,9 +34,9 @@ #include <wrl.h> #include "EGL/egl.h" +#include "core/error_list.h" +#include "core/os/os.h" #include "drivers/gl_context/context_gl.h" -#include "error_list.h" -#include "os/os.h" using namespace Windows::UI::Core; diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index b2eb3450e2..5b5f30244e 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -28,23 +28,23 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +// Must include Winsock before windows.h (included by os_uwp.h) +#include "drivers/unix/net_socket_posix.h" + #include "os_uwp.h" +#include "core/io/marshalls.h" +#include "core/project_settings.h" #include "drivers/gles2/rasterizer_gles2.h" #include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/ip_unix.h" #include "drivers/windows/dir_access_windows.h" #include "drivers/windows/file_access_windows.h" #include "drivers/windows/mutex_windows.h" -#include "drivers/windows/packet_peer_udp_winsock.h" #include "drivers/windows/rw_lock_windows.h" #include "drivers/windows/semaphore_windows.h" -#include "drivers/windows/stream_peer_tcp_winsock.h" -#include "drivers/windows/tcp_server_winsock.h" -#include "io/marshalls.h" #include "main/main.h" #include "platform/windows/windows_terminal_logger.h" -#include "project_settings.h" #include "servers/audio_server.h" #include "servers/visual/visual_server_raster.h" #include "thread_uwp.h" @@ -151,9 +151,7 @@ void OSUWP::initialize_core() { DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_USERDATA); DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM); - TCPServerWinsock::make_default(); - StreamPeerTCPWinsock::make_default(); - PacketPeerUDPWinsock::make_default(); + NetSocketPosix::make_default(); // We need to know how often the clock is updated if (!QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second)) diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index 89f71f0013..9641b9cde9 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -32,13 +32,13 @@ #define OSUWP_H #include "core/math/transform_2d.h" +#include "core/os/input.h" +#include "core/os/os.h" #include "core/ustring.h" #include "drivers/xaudio2/audio_driver_xaudio2.h" #include "gl_context_egl.h" #include "joypad_uwp.h" #include "main/input_default.h" -#include "os/input.h" -#include "os/os.h" #include "power_uwp.h" #include "servers/audio_server.h" #include "servers/visual/rasterizer.h" @@ -152,7 +152,7 @@ private: Windows::Devices::Sensors::Magnetometer ^ magnetometer; Windows::Devices::Sensors::Gyrometer ^ gyrometer; - // functions used by main to initialize/deintialize the OS + // functions used by main to initialize/deinitialize the OS protected: virtual int get_video_driver_count() const; virtual int get_current_video_driver() const; diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h index 09572a15f4..da1cffe8f0 100644 --- a/platform/uwp/power_uwp.h +++ b/platform/uwp/power_uwp.h @@ -31,9 +31,9 @@ #ifndef PLATFORM_UWP_POWER_UWP_H_ #define PLATFORM_UWP_POWER_UWP_H_ -#include "os/dir_access.h" -#include "os/file_access.h" -#include "os/os.h" +#include "core/os/dir_access.h" +#include "core/os/file_access.h" +#include "core/os/os.h" class PowerUWP { diff --git a/platform/uwp/thread_uwp.cpp b/platform/uwp/thread_uwp.cpp index 25cd29190f..c755204ec4 100644 --- a/platform/uwp/thread_uwp.cpp +++ b/platform/uwp/thread_uwp.cpp @@ -30,7 +30,7 @@ #include "thread_uwp.h" -#include "os/memory.h" +#include "core/os/memory.h" Thread *ThreadUWP::create_func_uwp(ThreadCreateCallback p_callback, void *p_user, const Settings &) { diff --git a/platform/uwp/thread_uwp.h b/platform/uwp/thread_uwp.h index 89081f3b2b..16e7efb60b 100644 --- a/platform/uwp/thread_uwp.h +++ b/platform/uwp/thread_uwp.h @@ -33,7 +33,7 @@ #ifdef UWP_ENABLED -#include "os/thread.h" +#include "core/os/thread.h" #include <thread> diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h index e7578a1aeb..af2f89568e 100644 --- a/platform/windows/context_gl_win.h +++ b/platform/windows/context_gl_win.h @@ -35,9 +35,9 @@ #ifndef CONTEXT_GL_WIN_H #define CONTEXT_GL_WIN_H +#include "core/error_list.h" +#include "core/os/os.h" #include "drivers/gl_context/context_gl.h" -#include "error_list.h" -#include "os/os.h" #include <windows.h> diff --git a/platform/windows/crash_handler_win.cpp b/platform/windows/crash_handler_win.cpp index 76a227c608..2760e87b8b 100644 --- a/platform/windows/crash_handler_win.cpp +++ b/platform/windows/crash_handler_win.cpp @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "core/project_settings.h" #include "main/main.h" #include "os_windows.h" -#include "project_settings.h" #ifdef CRASH_HANDLER_EXCEPTION diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 150d418502..5d5af17086 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -208,8 +208,8 @@ def configure_msvc(env, manual_msvc_config): 'RTAUDIO_ENABLED', 'WASAPI_ENABLED', 'WINMIDI_ENABLED', 'TYPED_METHOD_BIND', 'WIN32', 'MSVC', - {'WINVER' : '$target_win_version', - '_WIN32_WINNT': '$target_win_version'}]) + 'WINVER=$target_win_version', + '_WIN32_WINNT=$target_win_version']) env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros if env["bits"] == "64": env.AppendUnique(CPPDEFINES=['_WIN64']) diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index 38fd6366c7..dcaae40b10 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "core/os/file_access.h" +#include "core/os/os.h" #include "editor/editor_export.h" #include "editor/editor_settings.h" -#include "os/file_access.h" -#include "os/os.h" #include "platform/windows/logo.gen.h" class EditorExportPlatformWindows : public EditorExportPlatformPC { diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp index 69dd385354..80580a63b3 100644 --- a/platform/windows/key_mapping_win.cpp +++ b/platform/windows/key_mapping_win.cpp @@ -212,7 +212,7 @@ static _WinTranslatePair _vk_to_keycode[] = { { KEY_SEMICOLON, VK_OEM_1 }, // (0xBA) { KEY_EQUAL, VK_OEM_PLUS }, // (0xBB) // Windows 2000/XP: For any country/region, the '+' key - { KEY_COLON, VK_OEM_COMMA }, // (0xBC) // Windows 2000/XP: For any country/region, the ',' key + { KEY_COMMA, VK_OEM_COMMA }, // (0xBC) // Windows 2000/XP: For any country/region, the ',' key { KEY_MINUS, VK_OEM_MINUS }, // (0xBD) // Windows 2000/XP: For any country/region, the '-' key { KEY_PERIOD, VK_OEM_PERIOD }, // (0xBE) // Windows 2000/XP: For any country/region, the '.' key { KEY_SLASH, VK_OEM_2 }, // (0xBF) //Windows 2000/XP: For the US standard keyboard, the '/?' key diff --git a/platform/windows/key_mapping_win.h b/platform/windows/key_mapping_win.h index 8d6461f27d..340f916e1c 100644 --- a/platform/windows/key_mapping_win.h +++ b/platform/windows/key_mapping_win.h @@ -31,7 +31,7 @@ #ifndef KEY_MAPPING_WINDOWS_H #define KEY_MAPPING_WINDOWS_H -#include "os/keyboard.h" +#include "core/os/keyboard.h" #include <windows.h> diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 88793386ab..6723210432 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -28,27 +28,27 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +// Must include Winsock before windows.h (included by os_windows.h) +#include "drivers/unix/net_socket_posix.h" + #include "os_windows.h" +#include "core/io/marshalls.h" +#include "core/version_generated.gen.h" #include "drivers/gles2/rasterizer_gles2.h" #include "drivers/gles3/rasterizer_gles3.h" #include "drivers/windows/dir_access_windows.h" #include "drivers/windows/file_access_windows.h" #include "drivers/windows/mutex_windows.h" -#include "drivers/windows/packet_peer_udp_winsock.h" #include "drivers/windows/rw_lock_windows.h" #include "drivers/windows/semaphore_windows.h" -#include "drivers/windows/stream_peer_tcp_winsock.h" -#include "drivers/windows/tcp_server_winsock.h" #include "drivers/windows/thread_windows.h" -#include "io/marshalls.h" #include "joypad.h" #include "lang_table.h" #include "main/main.h" #include "servers/audio_server.h" #include "servers/visual/visual_server_raster.h" #include "servers/visual/visual_server_wrap_mt.h" -#include "version_generated.gen.h" #include "windows_terminal_logger.h" #include <process.h> @@ -219,9 +219,7 @@ void OS_Windows::initialize_core() { DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_USERDATA); DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM); - TCPServerWinsock::make_default(); - StreamPeerTCPWinsock::make_default(); - PacketPeerUDPWinsock::make_default(); + NetSocketPosix::make_default(); // We need to know how often the clock is updated if (!QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second)) @@ -1514,9 +1512,6 @@ void OS_Windows::finalize_core() { timeEndPeriod(1); memdelete(process_map); - - TCPServerWinsock::cleanup(); - StreamPeerTCPWinsock::cleanup(); } void OS_Windows::alert(const String &p_alert, const String &p_title) { @@ -1711,6 +1706,15 @@ void OS_Windows::set_window_position(const Point2 &p_position) { RECT r; GetWindowRect(hWnd, &r); MoveWindow(hWnd, p_position.x, p_position.y, r.right - r.left, r.bottom - r.top, TRUE); + + // Don't let the mouse leave the window when moved + if (mouse_mode == MOUSE_MODE_CONFINED) { + RECT rect; + GetClientRect(hWnd, &rect); + ClientToScreen(hWnd, (POINT *)&rect.left); + ClientToScreen(hWnd, (POINT *)&rect.right); + ClipCursor(&rect); + } } Size2 OS_Windows::get_window_size() const { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index c9fa46052a..01e1c51ca5 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -31,13 +31,13 @@ #ifndef OS_WINDOWS_H #define OS_WINDOWS_H #include "context_gl_win.h" +#include "core/os/input.h" +#include "core/os/os.h" #include "core/project_settings.h" #include "crash_handler_win.h" #include "drivers/rtaudio/audio_driver_rtaudio.h" #include "drivers/wasapi/audio_driver_wasapi.h" #include "drivers/winmidi/win_midi.h" -#include "os/input.h" -#include "os/os.h" #include "power_windows.h" #include "servers/audio_server.h" #include "servers/visual/rasterizer.h" @@ -157,7 +157,7 @@ class OS_Windows : public OS { void _update_window_style(bool repaint = true); - // functions used by main to initialize/deintialize the OS + // functions used by main to initialize/deinitialize the OS protected: virtual int get_current_video_driver() const; diff --git a/platform/windows/power_windows.h b/platform/windows/power_windows.h index 1c1a8c0876..4984b473ca 100644 --- a/platform/windows/power_windows.h +++ b/platform/windows/power_windows.h @@ -31,9 +31,9 @@ #ifndef PLATFORM_WINDOWS_POWER_WINDOWS_H_ #define PLATFORM_WINDOWS_POWER_WINDOWS_H_ -#include "os/dir_access.h" -#include "os/file_access.h" -#include "os/os.h" +#include "core/os/dir_access.h" +#include "core/os/file_access.h" +#include "core/os/os.h" #include <windows.h> diff --git a/platform/windows/windows_terminal_logger.h b/platform/windows/windows_terminal_logger.h index 1ad2bcb0fd..1cd1941b8a 100644 --- a/platform/windows/windows_terminal_logger.h +++ b/platform/windows/windows_terminal_logger.h @@ -33,7 +33,7 @@ #ifdef WINDOWS_ENABLED -#include "io/logger.h" +#include "core/io/logger.h" class WindowsTerminalLogger : public StdLogger { public: @@ -44,4 +44,4 @@ public: #endif -#endif
\ No newline at end of file +#endif diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h index b8f3eb95d4..ab0379a2fe 100644 --- a/platform/x11/context_gl_x11.h +++ b/platform/x11/context_gl_x11.h @@ -38,8 +38,8 @@ #if defined(OPENGL_ENABLED) +#include "core/os/os.h" #include "drivers/gl_context/context_gl.h" -#include "os/os.h" #include <X11/Xlib.h> #include <X11/extensions/Xrender.h> diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp index 960105271b..ab9275e49f 100644 --- a/platform/x11/crash_handler_x11.cpp +++ b/platform/x11/crash_handler_x11.cpp @@ -33,9 +33,9 @@ #endif #include "crash_handler_x11.h" +#include "core/os/os.h" +#include "core/project_settings.h" #include "main/main.h" -#include "os/os.h" -#include "project_settings.h" #ifdef CRASH_HANDLER_ENABLED #include <cxxabi.h> diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h index 1187acac23..34b240abf1 100644 --- a/platform/x11/joypad_linux.h +++ b/platform/x11/joypad_linux.h @@ -33,9 +33,9 @@ #define JOYPAD_LINUX_H #ifdef JOYDEV_ENABLED +#include "core/os/mutex.h" +#include "core/os/thread.h" #include "main/input_default.h" -#include "os/mutex.h" -#include "os/thread.h" struct input_absinfo; diff --git a/platform/x11/key_mapping_x11.h b/platform/x11/key_mapping_x11.h index 62dfcf3a4d..6f05941c19 100644 --- a/platform/x11/key_mapping_x11.h +++ b/platform/x11/key_mapping_x11.h @@ -41,7 +41,7 @@ #define XK_XKB_KEYS #include <X11/keysymdef.h> -#include "os/keyboard.h" +#include "core/os/keyboard.h" class KeyMappingX11 { KeyMappingX11(){}; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index a57a8c6bb9..b80a20ce40 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -29,12 +29,12 @@ /*************************************************************************/ #include "os_x11.h" +#include "core/os/dir_access.h" +#include "core/print_string.h" #include "drivers/gles2/rasterizer_gles2.h" #include "drivers/gles3/rasterizer_gles3.h" #include "errno.h" #include "key_mapping_x11.h" -#include "os/dir_access.h" -#include "print_string.h" #include "servers/visual/visual_server_raster.h" #include "servers/visual/visual_server_wrap_mt.h" @@ -581,6 +581,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a } } + update_real_mouse_position(); + return OK; } @@ -742,12 +744,15 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) { ERR_PRINT("NO GRAB"); } - center.x = current_videomode.width / 2; - center.y = current_videomode.height / 2; - XWarpPointer(x11_display, None, x11_window, - 0, 0, 0, 0, (int)center.x, (int)center.y); + if (mouse_mode == MOUSE_MODE_CAPTURED) { + center.x = current_videomode.width / 2; + center.y = current_videomode.height / 2; - input->set_mouse_position(center); + XWarpPointer(x11_display, None, x11_window, + 0, 0, 0, 0, (int)center.x, (int)center.y); + + input->set_mouse_position(center); + } } else { do_mouse_warp = false; } @@ -1050,6 +1055,7 @@ Point2 OS_X11::get_window_position() const { void OS_X11::set_window_position(const Point2 &p_position) { XMoveWindow(x11_display, x11_window, p_position.x, p_position.y); + update_real_mouse_position(); } Size2 OS_X11::get_window_size() const { @@ -1079,6 +1085,16 @@ Size2 OS_X11::get_real_window_size() const { } void OS_X11::set_window_size(const Size2 p_size) { + + if (current_videomode.width == p_size.width && current_videomode.height == p_size.height) + return; + + XWindowAttributes xwa; + XSync(x11_display, False); + XGetWindowAttributes(x11_display, x11_window, &xwa); + int old_w = xwa.width; + int old_h = xwa.height; + // If window resizable is disabled we need to update the attributes first if (is_window_resizable() == false) { XSizeHints *xsh; @@ -1098,6 +1114,16 @@ void OS_X11::set_window_size(const Size2 p_size) { // Update our videomode width and height current_videomode.width = p_size.x; current_videomode.height = p_size.y; + + for (int timeout = 0; timeout < 50; ++timeout) { + XSync(x11_display, False); + XGetWindowAttributes(x11_display, x11_window, &xwa); + + if (old_w != xwa.width || old_h != xwa.height) + break; + + usleep(10000); + } } void OS_X11::set_window_fullscreen(bool p_enabled) { @@ -2044,6 +2070,10 @@ void OS_X11::process_xevents() { Point2i rel = pos - last_mouse_pos; + if (mouse_mode == MOUSE_MODE_CAPTURED) { + pos = Point2i(current_videomode.width / 2, current_videomode.height / 2); + } + Ref<InputEventMouseMotion> mm; mm.instance(); @@ -2972,6 +3002,25 @@ OS::LatinKeyboardVariant OS_X11::get_latin_keyboard_variant() const { return LATIN_KEYBOARD_QWERTY; } +void OS_X11::update_real_mouse_position() { + Window root_return, child_return; + int root_x, root_y, win_x, win_y; + unsigned int mask_return; + + Bool xquerypointer_result = XQueryPointer(x11_display, x11_window, &root_return, &child_return, &root_x, &root_y, + &win_x, &win_y, &mask_return); + + if (xquerypointer_result) { + if (win_x > 0 && win_y > 0 && win_x <= current_videomode.width && win_y <= current_videomode.height) { + + last_mouse_pos.x = win_x; + last_mouse_pos.y = win_y; + last_mouse_pos_valid = true; + input->set_mouse_position(last_mouse_pos); + } + } +} + OS_X11::OS_X11() { #ifdef PULSEAUDIO_ENABLED diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 44455a2d8d..47ff257455 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -32,9 +32,9 @@ #define OS_X11_H #include "context_gl_x11.h" +#include "core/os/input.h" #include "crash_handler_x11.h" #include "drivers/unix/os_unix.h" -#include "os/input.h" #include "servers/visual_server.h" //#include "servers/visual/visual_server_wrap_mt.h" #include "drivers/alsa/audio_driver_alsa.h" @@ -313,6 +313,7 @@ public: virtual LatinKeyboardVariant get_latin_keyboard_variant() const; + void update_real_mouse_position(); OS_X11(); }; diff --git a/platform/x11/power_x11.h b/platform/x11/power_x11.h index 4077887998..d0805b6f8a 100644 --- a/platform/x11/power_x11.h +++ b/platform/x11/power_x11.h @@ -31,9 +31,9 @@ #ifndef X11_POWER_H_ #define X11_POWER_H_ -#include "os/dir_access.h" -#include "os/file_access.h" -#include "os/os.h" +#include "core/os/dir_access.h" +#include "core/os/file_access.h" +#include "core/os/os.h" class PowerX11 { |