summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/SCsub2
-rw-r--r--platform/android/SCsub10
-rw-r--r--platform/android/audio_driver_jandroid.cpp4
-rw-r--r--platform/android/audio_driver_opensl.h2
-rw-r--r--platform/android/detect.py3
-rw-r--r--platform/android/dir_access_android.h2
-rw-r--r--platform/android/dir_access_jandroid.cpp2
-rw-r--r--platform/android/dir_access_jandroid.h2
-rw-r--r--platform/android/export/export.cpp57
-rw-r--r--platform/android/file_access_android.cpp2
-rw-r--r--platform/android/file_access_android.h2
-rw-r--r--platform/android/file_access_jandroid.cpp2
-rw-r--r--platform/android/file_access_jandroid.h2
-rw-r--r--platform/android/globals/global_defaults.cpp2
-rw-r--r--platform/android/godot_android.cpp4
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java33
-rw-r--r--platform/android/java_class_wrapper.h2
-rw-r--r--platform/android/java_glue.cpp23
-rw-r--r--platform/android/os_android.cpp27
-rw-r--r--platform/android/os_android.h17
-rw-r--r--platform/android/power_android.h2
-rw-r--r--platform/android/thread_jandroid.cpp4
-rw-r--r--platform/android/thread_jandroid.h2
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp2
-rw-r--r--platform/haiku/detect.py2
-rw-r--r--platform/haiku/haiku_direct_window.cpp2
-rw-r--r--platform/haiku/key_mapping_haiku.cpp2
-rw-r--r--platform/haiku/platform_config.h4
-rw-r--r--platform/iphone/SCsub3
-rw-r--r--platform/iphone/export/export.cpp22
-rw-r--r--platform/iphone/globals/global_defaults.cpp2
-rw-r--r--platform/iphone/godot_iphone.cpp2
-rw-r--r--platform/iphone/os_iphone.h2
-rw-r--r--platform/iphone/platform_refcount.h2
-rw-r--r--platform/iphone/sem_iphone.cpp2
-rw-r--r--platform/iphone/sem_iphone.h2
-rw-r--r--platform/javascript/api/api.cpp2
-rw-r--r--platform/javascript/api/javascript_eval.h2
-rw-r--r--platform/javascript/detect.py1
-rw-r--r--platform/javascript/dom_keys.inc2
-rw-r--r--platform/javascript/export/export.cpp2
-rw-r--r--platform/javascript/http_client_javascript.cpp8
-rw-r--r--platform/javascript/javascript_eval.cpp3
-rw-r--r--platform/javascript/javascript_main.cpp2
-rw-r--r--platform/javascript/os_javascript.cpp95
-rw-r--r--platform/javascript/os_javascript.h3
-rw-r--r--platform/osx/SCsub2
-rw-r--r--platform/osx/crash_handler_osx.mm8
-rw-r--r--platform/osx/dir_access_osx.h2
-rw-r--r--platform/osx/export/export.cpp18
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm18
-rw-r--r--platform/osx/platform_config.h4
-rw-r--r--platform/osx/power_osx.h4
-rw-r--r--platform/osx/sem_osx.cpp2
-rw-r--r--platform/osx/sem_osx.h2
-rw-r--r--platform/server/SCsub2
-rw-r--r--platform/server/detect.py6
-rw-r--r--platform/server/os_server.cpp2
-rw-r--r--platform/uwp/export/export.cpp14
-rw-r--r--platform/uwp/gl_context_egl.h4
-rw-r--r--platform/uwp/os_uwp.cpp18
-rw-r--r--platform/uwp/os_uwp.h6
-rw-r--r--platform/uwp/power_uwp.h6
-rw-r--r--platform/uwp/thread_uwp.cpp2
-rw-r--r--platform/uwp/thread_uwp.h2
-rw-r--r--platform/windows/SCsub16
-rw-r--r--platform/windows/context_gl_win.h4
-rw-r--r--platform/windows/crash_handler_win.cpp2
-rw-r--r--platform/windows/detect.py4
-rw-r--r--platform/windows/export/export.cpp4
-rw-r--r--platform/windows/godot.natvis129
-rw-r--r--platform/windows/key_mapping_win.cpp2
-rw-r--r--platform/windows/key_mapping_win.h2
-rw-r--r--platform/windows/os_windows.cpp51
-rw-r--r--platform/windows/os_windows.h6
-rw-r--r--platform/windows/platform_config.h4
-rw-r--r--platform/windows/power_windows.h6
-rw-r--r--platform/windows/windows_terminal_logger.h4
-rw-r--r--platform/x11/SCsub2
-rw-r--r--platform/x11/context_gl_x11.h2
-rw-r--r--platform/x11/crash_handler_x11.cpp10
-rw-r--r--platform/x11/detect.py11
-rw-r--r--platform/x11/joypad_linux.h4
-rw-r--r--platform/x11/key_mapping_x11.h2
-rw-r--r--platform/x11/os_x11.cpp97
-rw-r--r--platform/x11/os_x11.h14
-rw-r--r--platform/x11/platform_config.h4
-rw-r--r--platform/x11/power_x11.h6
89 files changed, 607 insertions, 280 deletions
diff --git a/platform/SCsub b/platform/SCsub
index 0f9c2047a0..aa83154ee0 100644
--- a/platform/SCsub
+++ b/platform/SCsub
@@ -29,5 +29,3 @@ platform_sources.append('register_platform_apis.gen.cpp')
lib = env.add_library('platform', platform_sources)
env.Prepend(LIBS=lib)
-
-Export('env')
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 31fee5722c..807506000f 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -1,12 +1,12 @@
#!/usr/bin/env python
+Import('env')
+
import shutil
from compat import open_utf8
from distutils.version import LooseVersion
from detect import get_ndk_version
-Import('env')
-
android_files = [
'os_android.cpp',
@@ -26,10 +26,6 @@ android_files = [
# 'power_android.cpp'
]
-# env.Depends('#core/math/vector3.h', 'vector3_psp.h')
-
-#obj = env.SharedObject('godot_android.cpp')
-
env_android = env.Clone()
if env['target'] == "profile":
env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
@@ -174,4 +170,4 @@ if lib_arch_dir != '':
ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so'
- env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE")) \ No newline at end of file
+ env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
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/detect.py b/platform/android/detect.py
index b22e85b2c1..953a2fa6d2 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -258,9 +258,10 @@ def configure(env):
if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
if LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"):
env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a','-Wl,--exclude-libs,libatomic.a','-nostdlib++'])
+ else:
+ env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/libandroid_support.a"])
env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/"])
- env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/libandroid_support.a"])
env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/libc++_shared.so"])
else:
env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
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..021a92ca1e 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>
@@ -194,8 +194,8 @@ static const char *android_perms[] = {
};
struct LauncherIcon {
- char *option_id;
- char *export_path;
+ const char *option_id;
+ const char *export_path;
};
static const LauncherIcon launcher_icons[] = {
@@ -344,6 +344,7 @@ class EditorExportAndroid : public EditorExportPlatform {
}
d.name = vendor + " " + device;
+ if (device == String()) continue;
}
ndevices.push_back(d);
@@ -576,11 +577,11 @@ class EditorExportAndroid : public EditorExportPlatform {
uint32_t ofs = 8;
uint32_t string_count = 0;
- uint32_t styles_count = 0;
+ //uint32_t styles_count = 0;
uint32_t string_flags = 0;
uint32_t string_data_offset = 0;
- uint32_t styles_offset = 0;
+ //uint32_t styles_offset = 0;
uint32_t string_table_begins = 0;
uint32_t string_table_ends = 0;
Vector<uint8_t> stable_extra;
@@ -630,16 +631,16 @@ class EditorExportAndroid : public EditorExportPlatform {
int iofs = ofs + 8;
string_count = decode_uint32(&p_manifest[iofs]);
- styles_count = decode_uint32(&p_manifest[iofs + 4]);
+ //styles_count = decode_uint32(&p_manifest[iofs + 4]);
string_flags = decode_uint32(&p_manifest[iofs + 8]);
string_data_offset = decode_uint32(&p_manifest[iofs + 12]);
- styles_offset = decode_uint32(&p_manifest[iofs + 16]);
+ //styles_offset = decode_uint32(&p_manifest[iofs + 16]);
/*
printf("string count: %i\n",string_count);
printf("flags: %i\n",string_flags);
printf("sdata ofs: %i\n",string_data_offset);
printf("styles ofs: %i\n",styles_offset);
- */
+ */
uint32_t st_offset = iofs + 20;
string_table.resize(string_count);
uint32_t string_end = 0;
@@ -759,7 +760,6 @@ class EditorExportAndroid : public EditorExportPlatform {
// save manifest ending so we can restore it
Vector<uint8_t> manifest_end;
uint32_t manifest_cur_size = p_manifest.size();
- uint32_t node_size = size;
manifest_end.resize(p_manifest.size() - ofs);
memcpy(manifest_end.ptrw(), &p_manifest[ofs], manifest_end.size());
@@ -1054,7 +1054,12 @@ public:
if (api == 0)
r_features->push_back("etc");
else*/
- r_features->push_back("etc2");
+ String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name");
+ if (driver == "GLES2") {
+ r_features->push_back("etc");
+ } else {
+ r_features->push_back("etc2");
+ }
Vector<String> abis = get_enabled_abis(p_preset);
for (int i = 0; i < abis.size(); ++i) {
@@ -1081,7 +1086,7 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_large"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true));
- for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "*.png"), ""));
}
@@ -1337,7 +1342,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 +1350,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 +1358,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 +1377,7 @@ public:
if (apk_expansion_pkey == "") {
valid = false;
- err += "Invalid public key for apk expansion.\n";
+ err += "Invalid public key for APK expansion.\n";
}
}
@@ -1485,7 +1490,7 @@ public:
if (file == "res/drawable/icon.png") {
bool found = false;
- for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges();
if (icon_path != "" && icon_path.ends_with(".png")) {
FileAccess *f = FileAccess::open(icon_path, FileAccess::READ);
@@ -1619,7 +1624,7 @@ public:
APKExportData ed;
ed.ep = &ep;
ed.apk = unaligned_apk;
- for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) {
String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges();
if (icon_path != "" && icon_path.ends_with(".png") && FileAccess::exists(icon_path)) {
Vector<uint8_t> data = FileAccess::get_file_as_array(icon_path);
@@ -1680,7 +1685,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 +1697,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 +1747,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..c23037f3e0 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;
@@ -180,6 +184,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
protected void onMainActivityResult(int requestCode, int resultCode, Intent data) {
}
+ protected void onMainRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ }
+
protected void onMainPause() {}
protected void onMainResume() {}
protected void onMainDestroy() {}
@@ -247,6 +254,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
}
};
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ for (int i = 0; i < singleton_count; i++) {
+ singletons[i].onMainRequestPermissionsResult(requestCode, permissions, grantResults);
+ }
+ };
+
public void onVideoInit() {
boolean use_gl3 = getGLESVersionCode() >= 0x00030000;
@@ -441,6 +455,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 +622,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/detect.py b/platform/haiku/detect.py
index 7ecdd2bb11..8d704ac657 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -148,7 +148,7 @@ def configure(env):
## Flags
env.Append(CPPPATH=['#platform/haiku'])
- env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED', '-DGLES_OVER_GL'])
+ env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
# env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
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/haiku/platform_config.h b/platform/haiku/platform_config.h
index 72c8ee2535..b00510f5a1 100644
--- a/platform/haiku/platform_config.h
+++ b/platform/haiku/platform_config.h
@@ -33,5 +33,5 @@
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
#define _BSD_SOURCE 1
-#define GLES3_INCLUDE_H "glad/glad.h"
-#define GLES2_INCLUDE_H "glad/glad.h"
+#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
+#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index b96bec16b4..debf051eda 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -1,8 +1,9 @@
#!/usr/bin/env python
-import os
Import('env')
+import os
+
iphone_lib = [
'godot_iphone.cpp',
'os_iphone.cpp',
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 008e213e5e..63bc4a519b 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>
@@ -203,7 +203,7 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight on devices with retina display
- for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, loading_screen_infos[i].preset_key, PROPERTY_HINT_FILE, "*.png"), ""));
}
@@ -353,7 +353,7 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr
DirAccess *da = DirAccess::open(p_iconset_dir);
ERR_FAIL_COND_V(!da, ERR_CANT_OPEN);
- for (int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) {
+ for (unsigned int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) {
IconInfo info = icon_infos[i];
String icon_path = p_preset->get(info.preset_key);
if (icon_path.length() == 0) {
@@ -403,7 +403,7 @@ Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPre
DirAccess *da = DirAccess::open(p_dest_dir);
ERR_FAIL_COND_V(!da, ERR_CANT_OPEN);
- for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
+ for (unsigned int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
LoadingScreenInfo info = loading_screen_infos[i];
String loading_screen_file = p_preset->get(info.preset_key);
if (loading_screen_file.size() > 0) {
@@ -490,7 +490,7 @@ private:
static String _hex_pad(uint32_t num) {
Vector<char> ret;
ret.resize(sizeof(num) * 2);
- for (int i = 0; i < sizeof(num) * 2; ++i) {
+ for (unsigned int i = 0; i < sizeof(num) * 2; ++i) {
uint8_t four_bits = (num >> (sizeof(num) * 8 - (i + 1) * 4)) & 0xF;
ret.write[i] = _hex_char(four_bits);
}
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/detect.py b/platform/javascript/detect.py
index fc909f6619..17b31f8d73 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -25,7 +25,6 @@ def get_opts():
def get_flags():
return [
('tools', False),
- ('module_theora_enabled', False),
# Disabling the mbedtls module reduces file size.
# The module has little use due to the limited networking functionality
# in this platform. For the available networking methods, the browser
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..ccf4f8a11b 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) {
@@ -237,7 +237,7 @@ Error HTTPClient::poll() {
case STATUS_CONNECTION_ERROR:
return ERR_CONNECTION_ERROR;
- case STATUS_REQUESTING:
+ case STATUS_REQUESTING: {
#ifdef DEBUG_ENABLED
if (!has_polled) {
@@ -281,6 +281,10 @@ Error HTTPClient::poll() {
godot_xhr_get_response(xhr_id, write.ptr(), polled_response.size());
write = PoolByteArray::Write();
break;
+ }
+
+ default:
+ ERR_FAIL_V(ERR_BUG);
}
return OK;
}
diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp
index 07b4c192e6..9b8174cc71 100644
--- a/platform/javascript/javascript_eval.cpp
+++ b/platform/javascript/javascript_eval.cpp
@@ -140,8 +140,9 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
case Variant::POOL_BYTE_ARRAY:
arr_write = PoolByteArray::Write();
return arr;
+ default:
+ return Variant();
}
- return Variant();
}
#endif // JAVASCRIPT_EVAL_ENABLED
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 80699b0d32..7c7aeac980 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -30,15 +30,16 @@
#include "os_javascript.h"
-#include "gles2/rasterizer_gles2.h"
-#include "gles3/rasterizer_gles3.h"
-#include "io/file_access_buffered_fa.h"
+#include "core/io/file_access_buffered_fa.h"
+#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
+#include "drivers/unix/dir_access_unix.h"
+#include "drivers/unix/file_access_unix.h"
#include "main/main.h"
#include "servers/visual/visual_server_raster.h"
-#include "unix/dir_access_unix.h"
-#include "unix/file_access_unix.h"
#include <emscripten.h>
+#include <png.h>
#include <stdlib.h>
#include "dom_keys.inc"
@@ -120,14 +121,14 @@ void OS_JavaScript::set_window_size(const Size2 p_size) {
emscripten_exit_soft_fullscreen();
window_maximized = false;
}
- emscripten_set_canvas_size(p_size.x, p_size.y);
+ emscripten_set_canvas_element_size(NULL, p_size.x, p_size.y);
}
}
Size2 OS_JavaScript::get_window_size() const {
- int canvas[3];
- emscripten_get_canvas_size(canvas, canvas + 1, canvas + 2);
+ int canvas[2];
+ emscripten_get_canvas_element_size(NULL, canvas, canvas + 1);
return Size2(canvas[0], canvas[1]);
}
@@ -377,15 +378,13 @@ static void set_css_cursor(const char *p_cursor) {
/* clang-format on */
}
-static const char *get_css_cursor() {
+static bool is_css_cursor_hidden() {
- char cursor[16];
/* clang-format off */
- EM_ASM_INT({
- stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16);
- }, cursor);
+ return EM_ASM_INT({
+ return Module.canvas.style.cursor === 'none';
+ });
/* clang-format on */
- return cursor;
}
void OS_JavaScript::set_cursor_shape(CursorShape p_shape) {
@@ -429,7 +428,7 @@ void OS_JavaScript::set_mouse_mode(OS::MouseMode p_mode) {
OS::MouseMode OS_JavaScript::get_mouse_mode() const {
- if (String::utf8(get_css_cursor()) == "none")
+ if (is_css_cursor_hidden())
return MOUSE_MODE_HIDDEN;
EmscriptenPointerlockChangeEvent ev;
@@ -565,8 +564,11 @@ void OS_JavaScript::process_joypads() {
int joypad_count = emscripten_get_num_gamepads();
for (int joypad = 0; joypad < joypad_count; joypad++) {
EmscriptenGamepadEvent state;
- emscripten_get_gamepad_status(joypad, &state);
- if (state.connected) {
+ EMSCRIPTEN_RESULT query_result = emscripten_get_gamepad_status(joypad, &state);
+ // Chromium reserves gamepads slots, so NO_DATA is an expected result.
+ ERR_CONTINUE(query_result != EMSCRIPTEN_RESULT_SUCCESS &&
+ query_result != EMSCRIPTEN_RESULT_NO_DATA);
+ if (query_result == EMSCRIPTEN_RESULT_SUCCESS && state.connected) {
int button_count = MIN(state.numButtons, 18);
int axis_count = MIN(state.numAxes, 8);
@@ -705,7 +707,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 })) {
@@ -831,13 +833,13 @@ bool OS_JavaScript::main_loop_iterate() {
strategy.canvasResizedCallback = NULL;
emscripten_enter_soft_fullscreen(NULL, &strategy);
} else {
- emscripten_set_canvas_size(windowed_size.width, windowed_size.height);
+ emscripten_set_canvas_element_size(NULL, windowed_size.width, windowed_size.height);
}
just_exited_fullscreen = false;
}
- int canvas[3];
- emscripten_get_canvas_size(canvas, canvas + 1, canvas + 2);
+ int canvas[2];
+ emscripten_get_canvas_element_size(NULL, canvas, canvas + 1);
video_mode.width = canvas[0];
video_mode.height = canvas[1];
if (!window_maximized && !video_mode.fullscreen && !just_exited_fullscreen && !entering_fullscreen) {
@@ -909,6 +911,57 @@ void OS_JavaScript::set_window_title(const String &p_title) {
/* clang-format on */
}
+void OS_JavaScript::set_icon(const Ref<Image> &p_icon) {
+
+ ERR_FAIL_COND(p_icon.is_null());
+ Ref<Image> icon = p_icon;
+ if (icon->is_compressed()) {
+ icon = icon->duplicate();
+ ERR_FAIL_COND(icon->decompress() != OK)
+ }
+ if (icon->get_format() != Image::FORMAT_RGBA8) {
+ if (icon == p_icon)
+ icon = icon->duplicate();
+ icon->convert(Image::FORMAT_RGBA8);
+ }
+
+ png_image png_meta;
+ memset(&png_meta, 0, sizeof png_meta);
+ png_meta.version = PNG_IMAGE_VERSION;
+ png_meta.width = icon->get_width();
+ png_meta.height = icon->get_height();
+ png_meta.format = PNG_FORMAT_RGBA;
+
+ PoolByteArray png;
+ size_t len;
+ PoolByteArray::Read r = icon->get_data().read();
+ ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL));
+
+ png.resize(len);
+ PoolByteArray::Write w = png.write();
+ ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL));
+ w = PoolByteArray::Write();
+
+ r = png.read();
+ /* clang-format off */
+ EM_ASM_ARGS({
+ var PNG_PTR = $0;
+ var PNG_LEN = $1;
+
+ var png = new Blob([HEAPU8.slice(PNG_PTR, PNG_PTR + PNG_LEN)], { type: "image/png" });
+ var url = URL.createObjectURL(png);
+ var link = document.getElementById('-gd-engine-icon');
+ if (link === null) {
+ link = document.createElement('link');
+ link.rel = 'icon';
+ link.id = '-gd-engine-icon';
+ document.head.appendChild(link);
+ }
+ link.href = url;
+ }, r.ptr(), len);
+ /* clang-format on */
+}
+
String OS_JavaScript::get_executable_path() const {
return OS::get_executable_path();
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index f40fb8fc7e..84075898ac 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -32,10 +32,10 @@
#define OS_JAVASCRIPT_H
#include "audio_driver_javascript.h"
+#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
-#include "unix/os_unix.h"
#include <emscripten/html5.h>
@@ -135,6 +135,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual void set_window_title(const String &p_title);
+ virtual void set_icon(const Ref<Image> &p_icon);
String get_executable_path() const;
virtual Error shell_open(String p_uri);
virtual String get_name();
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index 5c973c30c2..dc407eee9e 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-import os
Import('env')
+import os
from platform_methods import run_in_subprocess
import platform_osx_builders
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 1664c5ce8e..490155bb24 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>
@@ -68,8 +68,9 @@ static uint64_t load_address() {
}
static void handle_crash(int sig) {
- if (OS::get_singleton() == NULL)
- return;
+ if (OS::get_singleton() == NULL) {
+ abort();
+ }
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
@@ -151,6 +152,7 @@ CrashHandler::CrashHandler() {
}
CrashHandler::~CrashHandler() {
+ disable();
}
void CrashHandler::disable() {
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..27b4fdc228 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 {
@@ -461,7 +461,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
fi.internal_fa = info.internal_fa;
fi.external_fa = info.external_fa;
- int zerr = zipOpenNewFileInZip(dst_pkg_zip,
+ zipOpenNewFileInZip(dst_pkg_zip,
file.utf8().get_data(),
&fi,
NULL,
@@ -472,7 +472,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
- zerr = zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size());
+ zipWriteInFileInZip(dst_pkg_zip, data.ptr(), data.size());
zipCloseFileInZip(dst_pkg_zip);
}
}
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 79d7ec410a..886ff4b332 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>
@@ -1604,7 +1604,9 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
}
ERR_FAIL_COND(!texture.is_valid());
+ ERR_FAIL_COND(p_hotspot.x < 0 || p_hotspot.y < 0);
ERR_FAIL_COND(texture_size.width > 256 || texture_size.height > 256);
+ ERR_FAIL_COND(p_hotspot.x > texture_size.width || p_hotspot.y > texture_size.height);
image = texture->get_data();
@@ -1660,8 +1662,10 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
[cursors[p_shape] release];
cursors[p_shape] = cursor;
- if (p_shape == CURSOR_ARROW) {
- [cursor set];
+ if (p_shape == cursor_shape) {
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ [cursor set];
+ }
}
[imgrep release];
@@ -1669,8 +1673,10 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
} else {
// Reset to default system cursor
cursors[p_shape] = NULL;
+
+ CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
- set_cursor_shape(p_shape);
+ set_cursor_shape(c);
}
}
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index 3f72831d77..1d32d5b5b9 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -30,6 +30,6 @@
#include <alloca.h>
-#define GLES3_INCLUDE_H "glad/glad.h"
-#define GLES2_INCLUDE_H "glad/glad.h"
+#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
+#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"
#define PTHREAD_RENAME_SELF
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/SCsub b/platform/server/SCsub
index 0788ad75ae..c9082f9b3a 100644
--- a/platform/server/SCsub
+++ b/platform/server/SCsub
@@ -2,11 +2,9 @@
Import('env')
-
common_server = [\
"os_server.cpp",\
"#platform/x11/crash_handler_x11.cpp",
"#platform/x11/power_x11.cpp",
]
-
prog = env.add_program('#bin/godot_server', ['godot_server.cpp'] + common_server)
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 266b0c5cc9..597a2ff6a0 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -29,9 +29,7 @@ def get_opts():
def get_flags():
- return [
- ("module_mobile_vr_enabled", False),
- ]
+ return []
def configure(env):
@@ -56,7 +54,7 @@ def configure(env):
## Compiler configuration
if env['use_llvm']:
- if ('clang++' not in env['CXX']):
+ if ('clang++' not in os.path.basename(env['CXX'])):
env["CC"] = "clang"
env["CXX"] = "clang++"
env["LINK"] = "clang++"
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 b6c3dcf9e0..f489c0894f 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))
@@ -225,7 +223,7 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
RasterizerGLES3::make_current();
break;
} else {
- if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best" || editor) {
+ if (GLOBAL_GET("rendering/quality/driver/driver_fallback") == "Best") {
p_video_driver = VIDEO_DRIVER_GLES2;
opengl_api_type = ContextEGL::GLES_2_0;
continue;
@@ -408,6 +406,8 @@ void OSUWP::finalize() {
}
void OSUWP::finalize_core() {
+
+ NetSocketPosix::cleanup();
}
void OSUWP::alert(const String &p_alert, const String &p_title) {
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/SCsub b/platform/windows/SCsub
index 53ed3bf887..e07d373c4b 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -1,12 +1,13 @@
#!/usr/bin/env python
-import os
Import('env')
+import os
from platform_methods import run_in_subprocess
import platform_windows_builders
common_win = [
+ "godot_win.cpp",
"context_gl_win.cpp",
"crash_handler_win.cpp",
"os_windows.cpp",
@@ -17,17 +18,16 @@ common_win = [
"windows_terminal_logger.cpp"
]
-restarget = "godot_res" + env["OBJSUFFIX"]
-
-obj = env.RES(restarget, 'godot_res.rc')
-
-common_win.append(obj)
+res_file = 'godot_res.rc'
+res_target = "godot_res" + env["OBJSUFFIX"]
+res_obj = env.RES(res_target, res_file)
-prog = env.add_program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
+prog = env.add_program('#bin/godot', common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
if env['vsproj']:
- env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
+ env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file]
+ env.vs_srcs = env.vs_srcs + ["platform/windows/godot.natvis"]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
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/godot.natvis b/platform/windows/godot.natvis
new file mode 100644
index 0000000000..01963035a1
--- /dev/null
+++ b/platform/windows/godot.natvis
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+ <Type Name="Vector&lt;*&gt;">
+ <Expand>
+ <Item Name="size">(_cowdata &amp;&amp; _cowdata-&gt;_ptr) ? (((const unsigned int *)(_cowdata-&gt;_ptr))[-1]) : 0</Item>
+ <ArrayItems>
+ <Size>(_cowdata &amp;&amp; _cowdata-&gt;_ptr) ? (((const unsigned int *)(_cowdata-&gt;_ptr))[-1]) : 0</Size>
+ <ValuePointer>(_cowdata) ? (_cowdata-&gt;_ptr) : 0</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Type>
+
+ <Type Name="PoolVector&lt;*&gt;">
+ <Expand>
+ <Item Name="size">alloc ? (alloc-&gt;size / sizeof($T1)) : 0</Item>
+ <ArrayItems>
+ <Size>alloc ? (alloc-&gt;size / sizeof($T1)) : 0</Size>
+ <ValuePointer>alloc ? (($T1 *)alloc-&gt;mem) : 0</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Type>
+
+ <Type Name="Variant">
+ <DisplayString Condition="this-&gt;type == Variant::NIL">nil</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::BOOL">{_data._bool}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::INT">{_data._int}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::REAL">{_data._real}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::TRANSFORM2D">{_data._transform2d}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::AABB">{_data._aabb}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::BASIS">{_data._basis}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::TRANSFORM">{_data._transform}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::STRING &amp;&amp; ((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr == 0">""</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::STRING &amp;&amp; ((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr != 0">{((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr,su}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::VECTOR2">{*(Vector2 *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::RECT2">{*(Rect2 *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::VECTOR3">{*(Vector3 *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::PLANE">{*(Plane *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::_RID">{*(RID *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::OBJECT">{*(Object *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::DICTIONARY">{*(Dictionary *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_BYTE_ARRAY">{*(PoolByteArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_INT_ARRAY">{*(PoolIntArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_REAL_ARRAY">{*(PoolRealArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_STRING_ARRAY">{*(PoolStringArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_VECTOR2_ARRAY">{*(PoolVector2Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_VECTOR3_ARRAY">{*(PoolVector3Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_COLOR_ARRAY">{*(PoolColorArray *)_data._mem}</DisplayString>
+
+ <StringView Condition="this-&gt;type == Variant::STRING &amp;&amp; ((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr != 0">((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr,su</StringView>
+
+ <Expand>
+ <Item Name="value" Condition="this-&gt;type == Variant::BOOL">_data._bool</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::INT">_data._int</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::REAL">_data._real</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::TRANSFORM2D">_data._transform2d</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::AABB">_data._aabb</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::BASIS">_data._basis</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::TRANSFORM">_data._transform</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::ARRAY">*(Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::STRING">*(String *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::VECTOR2">*(Vector2 *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::RECT2">*(Rect2 *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::VECTOR3">*(Vector3 *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::PLANE">*(Plane *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::QUAT">*(Quat *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::COLOR">*(Color *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::_RID">*(RID *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::OBJECT">*(Object *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::DICTIONARY">*(Dictionary *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::ARRAY">*(Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_BYTE_ARRAY">*(PoolByteArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_INT_ARRAY">*(PoolIntArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_REAL_ARRAY">*(PoolRealArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_STRING_ARRAY">*(PoolStringArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_VECTOR2_ARRAY">*(PoolVector2Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_VECTOR3_ARRAY">*(PoolVector3Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_COLOR_ARRAY">*(PoolColorArray *)_data._mem</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="String">
+ <DisplayString Condition="this-&gt;_cowdata._ptr == 0">empty</DisplayString>
+ <DisplayString Condition="this-&gt;_cowdata._ptr != 0">{this->_cowdata._ptr,su}</DisplayString>
+ <StringView Condition="this-&gt;_cowdata._ptr != 0">this->_cowdata._ptr,su</StringView>
+ </Type>
+
+ <Type Name="Vector2">
+ <DisplayString>{{{x},{y}}}</DisplayString>
+ <Expand>
+ <Item Name="x">x</Item>
+ <Item Name="y">y</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="Vector3">
+ <DisplayString>{{{x},{y},{z}}}</DisplayString>
+ <Expand>
+ <Item Name="x">x</Item>
+ <Item Name="y">y</Item>
+ <Item Name="z">z</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="Quat">
+ <DisplayString>Quat {{{x},{y},{z},{w}}}</DisplayString>
+ <Expand>
+ <Item Name="x">x</Item>
+ <Item Name="y">y</Item>
+ <Item Name="z">z</Item>
+ <Item Name="w">w</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="Color">
+ <DisplayString>Color {{{r},{g},{b},{a}}}</DisplayString>
+ <Expand>
+ <Item Name="red">r</Item>
+ <Item Name="green">g</Item>
+ <Item Name="blue">b</Item>
+ <Item Name="alpha">a</Item>
+ </Expand>
+ </Type>
+</AutoVisualizer>
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 7009df8e57..e8c209c0fc 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))
@@ -249,7 +247,11 @@ bool OS_Windows::can_draw() const {
#define MI_WP_SIGNATURE 0xFF515700
#define SIGNATURE_MASK 0xFFFFFF00
+// Keeping the name suggested by Microsoft, but this macro really answers:
+// Is this mouse event emulated from touch or pen input?
#define IsPenEvent(dw) (((dw)&SIGNATURE_MASK) == MI_WP_SIGNATURE)
+// This one tells whether the event comes from touchscreen (and not from pen)
+#define IsTouchEvent(dw) (IsPenEvent(dw) && ((dw)&0x80))
void OS_Windows::_touch_event(bool p_pressed, float p_x, float p_y, int idx) {
@@ -456,7 +458,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
*/
}
- if (window_has_focus && main_loop)
+ if (window_has_focus && main_loop && mm->get_relative() != Vector2())
input->parse_input_event(mm);
}
delete[] lpb;
@@ -469,7 +471,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (input->is_emulating_mouse_from_touch()) {
// Universal translation enabled; ignore OS translation
LPARAM extra = GetMessageExtraInfo();
- if (IsPenEvent(extra)) {
+ if (IsTouchEvent(extra)) {
break;
}
}
@@ -560,7 +562,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (input->is_emulating_mouse_from_touch()) {
// Universal translation enabled; ignore OS translations for left button
LPARAM extra = GetMessageExtraInfo();
- if (IsPenEvent(extra)) {
+ if (IsTouchEvent(extra)) {
break;
}
}
@@ -695,7 +697,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
last_button_state = mb->get_button_mask();
mb->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
- if (mouse_mode == MOUSE_MODE_CAPTURED) {
+ if (mouse_mode == MOUSE_MODE_CAPTURED && !use_raw_input) {
mb->set_position(Vector2(old_x, old_y));
}
@@ -1510,9 +1512,7 @@ void OS_Windows::finalize_core() {
timeEndPeriod(1);
memdelete(process_map);
-
- TCPServerWinsock::cleanup();
- StreamPeerTCPWinsock::cleanup();
+ NetSocketPosix::cleanup();
}
void OS_Windows::alert(const String &p_alert, const String &p_title) {
@@ -1707,6 +1707,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 {
@@ -2248,7 +2257,9 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
}
ERR_FAIL_COND(!texture.is_valid());
+ ERR_FAIL_COND(p_hotspot.x < 0 || p_hotspot.y < 0);
ERR_FAIL_COND(texture_size.width > 256 || texture_size.height > 256);
+ ERR_FAIL_COND(p_hotspot.x > texture_size.width || p_hotspot.y > texture_size.height);
image = texture->get_data();
@@ -2300,8 +2311,10 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
cursors[p_shape] = CreateIconIndirect(&iconinfo);
- if (p_shape == CURSOR_ARROW) {
- SetCursor(cursors[p_shape]);
+ if (p_shape == cursor_shape) {
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ SetCursor(cursors[p_shape]);
+ }
}
if (hAndMask != NULL) {
@@ -2317,8 +2330,10 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
} else {
// Reset to default system cursor
cursors[p_shape] = NULL;
+
+ CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
- set_cursor_shape(p_shape);
+ set_cursor_shape(c);
}
}
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/platform_config.h b/platform/windows/platform_config.h
index d100385e80..aa020ed470 100644
--- a/platform/windows/platform_config.h
+++ b/platform/windows/platform_config.h
@@ -32,5 +32,5 @@
//#else
//#include <alloca.h>
//#endif
-#define GLES3_INCLUDE_H "glad/glad.h"
-#define GLES2_INCLUDE_H "glad/glad.h"
+#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
+#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"
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/SCsub b/platform/x11/SCsub
index d3901eb798..97d3d1b514 100644
--- a/platform/x11/SCsub
+++ b/platform/x11/SCsub
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-import os
Import('env')
+import os
from platform_methods import run_in_subprocess
import platform_x11_builders
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..79c3d9aece 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>
@@ -45,8 +45,9 @@
#include <stdlib.h>
static void handle_crash(int sig) {
- if (OS::get_singleton() == NULL)
- return;
+ if (OS::get_singleton() == NULL) {
+ abort();
+ }
void *bt_buffer[256];
size_t size = backtrace(bt_buffer, 256);
@@ -119,6 +120,7 @@ CrashHandler::CrashHandler() {
}
CrashHandler::~CrashHandler() {
+ disable();
}
void CrashHandler::disable() {
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 6a7a426804..ee59e9b5a1 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -86,7 +86,7 @@ def configure(env):
env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
else: #optimize for size
env.Prepend(CCFLAGS=['-Os'])
-
+
if (env["debug_symbols"] == "yes"):
env.Prepend(CCFLAGS=['-g1'])
if (env["debug_symbols"] == "full"):
@@ -115,12 +115,12 @@ def configure(env):
## Compiler configuration
- if 'CXX' in env and 'clang' in env['CXX']:
+ if 'CXX' in env and 'clang' in os.path.basename(env['CXX']):
# Convenience check to enforce the use_llvm overrides when CXX is clang(++)
env['use_llvm'] = True
if env['use_llvm']:
- if ('clang++' not in env['CXX']):
+ if ('clang++' not in os.path.basename(env['CXX'])):
env["CC"] = "clang"
env["CXX"] = "clang++"
env["LINK"] = "clang++"
@@ -250,7 +250,8 @@ def configure(env):
if (os.system("pkg-config --exists alsa") == 0): # 0 means found
print("Enabling ALSA")
env.Append(CPPFLAGS=["-DALSA_ENABLED", "-DALSAMIDI_ENABLED"])
- env.ParseConfig('pkg-config alsa --cflags --libs')
+ # Don't parse --cflags, we don't need to add /usr/include/alsa to include path
+ env.ParseConfig('pkg-config alsa --libs')
else:
print("ALSA libraries not found, disabling driver")
@@ -278,7 +279,7 @@ def configure(env):
env.ParseConfig('pkg-config zlib --cflags --libs')
env.Append(CPPPATH=['#platform/x11'])
- env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED', '-DGLES_OVER_GL'])
+ env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED'])
env.Append(LIBS=['GL', 'pthread'])
if (platform.system() == "Linux"):
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 a62bd714d2..5be0b9304a 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) {
@@ -1969,15 +1995,9 @@ void OS_X11::process_xevents() {
} break;
case MotionNotify: {
- // FUCK YOU X11 API YOU SERIOUSLY GROSS ME OUT
- // YOU ARE AS GROSS AS LOOKING AT A PUTRID PILE
- // OF POOP STICKING OUT OF A CLOGGED TOILET
- // HOW THE FUCK I AM SUPPOSED TO KNOW WHICH ONE
- // OF THE MOTION NOTIFY EVENTS IS THE ONE GENERATED
- // BY WARPING THE MOUSE POINTER?
- // YOU ARE FORCING ME TO FILTER ONE BY ONE TO FIND IT
- // PLEASE DO ME A FAVOR AND DIE DROWNED IN A FECAL
- // MOUNTAIN BECAUSE THAT'S WHERE YOU BELONG.
+ // The X11 API requires filtering one-by-one through the motion
+ // notify events, in order to figure out which event is the one
+ // generated by warping the mouse pointer.
while (true) {
if (mouse_mode == MOUSE_MODE_CAPTURED && event.xmotion.x == current_videomode.width / 2 && event.xmotion.y == current_videomode.height / 2) {
@@ -2044,6 +2064,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();
@@ -2494,13 +2518,16 @@ void OS_X11::set_cursor_shape(CursorShape p_shape) {
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
- if (p_shape == current_cursor)
+ if (p_shape == current_cursor) {
return;
- if (mouse_mode == MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {
- if (cursors[p_shape] != None)
+ }
+
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ if (cursors[p_shape] != None) {
XDefineCursor(x11_display, x11_window, cursors[p_shape]);
- else if (cursors[CURSOR_ARROW] != None)
+ } else if (cursors[CURSOR_ARROW] != None) {
XDefineCursor(x11_display, x11_window, cursors[CURSOR_ARROW]);
+ }
}
current_cursor = p_shape;
@@ -2534,7 +2561,9 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
}
ERR_FAIL_COND(!texture.is_valid());
+ ERR_FAIL_COND(p_hotspot.x < 0 || p_hotspot.y < 0);
ERR_FAIL_COND(texture_size.width > 256 || texture_size.height > 256);
+ ERR_FAIL_COND(p_hotspot.x > texture_size.width || p_hotspot.y > texture_size.height);
image = texture->get_data();
@@ -2574,8 +2603,10 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
// Save it for a further usage
cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_image);
- if (p_shape == CURSOR_ARROW) {
- XDefineCursor(x11_display, x11_window, cursors[p_shape]);
+ if (p_shape == current_cursor) {
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ XDefineCursor(x11_display, x11_window, cursors[p_shape]);
+ }
}
memfree(cursor_image->pixels);
@@ -2586,8 +2617,9 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
cursors[p_shape] = XcursorImageLoadCursor(x11_display, img[p_shape]);
}
+ CursorShape c = current_cursor;
current_cursor = CURSOR_MAX;
- set_cursor_shape(p_shape);
+ set_cursor_shape(c);
}
}
@@ -2970,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..bb8411e213 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -32,19 +32,19 @@
#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"
#include "drivers/alsamidi/alsa_midi.h"
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
+#include "drivers/unix/os_unix.h"
#include "joypad_linux.h"
#include "main/input_default.h"
#include "power_x11.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
+#include "servers/visual_server.h"
+//#include "servers/visual/visual_server_wrap_mt.h"
#include <X11/Xcursor/Xcursor.h>
#include <X11/Xlib.h>
@@ -145,7 +145,6 @@ class OS_X11 : public OS_Unix {
void handle_key_event(XKeyEvent *p_event, bool p_echo = false);
void process_xevents();
virtual void delete_main_loop();
- IP_Unix *ip_unix;
bool force_quit;
bool minimized;
@@ -177,8 +176,6 @@ class OS_X11 : public OS_Unix {
AudioDriverPulseAudio driver_pulseaudio;
#endif
- Atom net_wm_icon;
-
PowerX11 *power_manager;
bool layered_window;
@@ -186,8 +183,6 @@ class OS_X11 : public OS_Unix {
CrashHandler crash_handler;
int video_driver_index;
- int audio_driver_index;
- unsigned int capture_idle;
bool maximized;
//void set_wm_border(bool p_enabled);
void set_wm_fullscreen(bool p_enabled);
@@ -313,6 +308,7 @@ public:
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
+ void update_real_mouse_position();
OS_X11();
};
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index b757be49c3..f6d7f5a8cd 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -36,5 +36,5 @@
#define PTHREAD_BSD_SET_NAME
#endif
-#define GLES3_INCLUDE_H "glad/glad.h"
-#define GLES2_INCLUDE_H "glad/glad.h"
+#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
+#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"
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 {