summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2023-03-14 16:00:02 +0100
committerGitHub <noreply@github.com>2023-03-14 16:00:02 +0100
commitfc7adaab7b3856a7831d402ea2bbb27efe7b7d8a (patch)
tree23902b836784f4c823d69f200b6aa2c1cffbc9f6 /platform
parent258ea41ffa00a71bbb6ba9844840f18ba5802816 (diff)
parent38c0ad7c6c6b70f1ecac0a7962a60c3105b3d8e8 (diff)
Merge pull request #74907 from YuriSizov/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.1) - 3rd batch
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/godot_view.mm2
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp8
-rw-r--r--platform/linuxbsd/x11/gl_manager_x11.cpp23
-rw-r--r--platform/linuxbsd/x11/gl_manager_x11.h2
-rw-r--r--platform/linuxbsd/x11/key_mapping_x11.cpp44
-rw-r--r--platform/macos/display_server_macos.mm6
-rw-r--r--platform/windows/display_server_windows.cpp2
-rw-r--r--platform/windows/key_mapping_windows.cpp2
8 files changed, 65 insertions, 24 deletions
diff --git a/platform/ios/godot_view.mm b/platform/ios/godot_view.mm
index fafec79bf6..67e47092d8 100644
--- a/platform/ios/godot_view.mm
+++ b/platform/ios/godot_view.mm
@@ -39,7 +39,7 @@
#import <CoreMotion/CoreMotion.h>
-static const int max_touches = 8;
+static const int max_touches = 32;
static const float earth_gravity = 9.80665;
@interface GodotView () {
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index d1f1115aad..5be1bd236b 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -2917,7 +2917,7 @@ BitField<MouseButtonMask> DisplayServerX11::_get_mouse_button_state(MouseButton
}
void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, LocalVector<XEvent> &p_events, uint32_t &p_event_index, bool p_echo) {
- WindowData wd = windows[p_window];
+ WindowData &wd = windows[p_window];
// X11 functions don't know what const is
XKeyEvent *xkeyevent = p_event;
@@ -4850,7 +4850,7 @@ DisplayServer *DisplayServerX11::create_func(const String &p_rendering_driver, W
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
"You can enable the OpenGL 3 driver by starting the engine from the\n"
- "command line with the command:\n'%s --rendering-driver opengl3'\n\n"
+ "command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
"If you recently updated your video card drivers, try rebooting.",
executable_name),
"Unable to initialize Vulkan video driver");
@@ -4873,7 +4873,9 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
#ifdef GLES3_ENABLED
if (gl_manager) {
- visualInfo = gl_manager->get_vi(x11_display);
+ Error err;
+ visualInfo = gl_manager->get_vi(x11_display, err);
+ ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't acquire visual info from display.");
vi_selected = true;
}
#endif
diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp
index 03ba95f475..ee767dfa80 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.cpp
+++ b/platform/linuxbsd/x11/gl_manager_x11.cpp
@@ -83,8 +83,13 @@ int GLManager_X11::_find_or_create_display(Display *p_x11_display) {
d.context = memnew(GLManager_X11_Private);
d.context->glx_context = nullptr;
- //Error err = _create_context(d);
- _create_context(d);
+ Error err = _create_context(d);
+
+ if (err != OK) {
+ _displays.remove_at(new_display_id);
+ return -1;
+ }
+
return new_display_id;
}
@@ -191,8 +196,14 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
return OK;
}
-XVisualInfo GLManager_X11::get_vi(Display *p_display) {
- return _displays[_find_or_create_display(p_display)].x_vi;
+XVisualInfo GLManager_X11::get_vi(Display *p_display, Error &r_error) {
+ int display_id = _find_or_create_display(p_display);
+ if (display_id < 0) {
+ r_error = FAILED;
+ return XVisualInfo();
+ }
+ r_error = OK;
+ return _displays[display_id].x_vi;
}
Error GLManager_X11::window_create(DisplayServer::WindowID p_window_id, ::Window p_window, Display *p_display, int p_width, int p_height) {
@@ -211,6 +222,10 @@ Error GLManager_X11::window_create(DisplayServer::WindowID p_window_id, ::Window
win.x11_window = p_window;
win.gldisplay_id = _find_or_create_display(p_display);
+ if (win.gldisplay_id == -1) {
+ return FAILED;
+ }
+
// the display could be invalid .. check NYI
GLDisplay &gl_display = _displays[win.gldisplay_id];
::Display *x11_display = gl_display.x11_display;
diff --git a/platform/linuxbsd/x11/gl_manager_x11.h b/platform/linuxbsd/x11/gl_manager_x11.h
index 0eb8ab64f4..0203dff679 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.h
+++ b/platform/linuxbsd/x11/gl_manager_x11.h
@@ -114,7 +114,7 @@ private:
Error _create_context(GLDisplay &gl_display);
public:
- XVisualInfo get_vi(Display *p_display);
+ XVisualInfo get_vi(Display *p_display, Error &r_error);
Error window_create(DisplayServer::WindowID p_window_id, ::Window p_window, Display *p_display, int p_width, int p_height);
void window_destroy(DisplayServer::WindowID p_window_id);
void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height);
diff --git a/platform/linuxbsd/x11/key_mapping_x11.cpp b/platform/linuxbsd/x11/key_mapping_x11.cpp
index fe73162280..0f709872cb 100644
--- a/platform/linuxbsd/x11/key_mapping_x11.cpp
+++ b/platform/linuxbsd/x11/key_mapping_x11.cpp
@@ -85,8 +85,8 @@ void KeyMappingX11::initialize() {
xkeysym_map[XK_Begin] = Key::CLEAR;
xkeysym_map[XK_Insert] = Key::INSERT;
xkeysym_map[XK_Delete] = Key::KEY_DELETE;
- //xkeysym_map[XK_KP_Equal]
- //xkeysym_map[XK_KP_Separator]
+ xkeysym_map[XK_KP_Equal] = Key::EQUAL;
+ xkeysym_map[XK_KP_Separator] = Key::COMMA;
xkeysym_map[XK_KP_Decimal] = Key::KP_PERIOD;
xkeysym_map[XK_KP_Delete] = Key::KP_PERIOD;
xkeysym_map[XK_KP_Multiply] = Key::KP_MULTIPLY;
@@ -220,7 +220,7 @@ void KeyMappingX11::initialize() {
scancode_map[0x22] = Key::BRACKETLEFT;
scancode_map[0x23] = Key::BRACKETRIGHT;
scancode_map[0x24] = Key::ENTER;
- scancode_map[0x25] = Key::CTRL;
+ scancode_map[0x25] = Key::CTRL; // Left
scancode_map[0x26] = Key::A;
scancode_map[0x27] = Key::S;
scancode_map[0x28] = Key::D;
@@ -233,7 +233,7 @@ void KeyMappingX11::initialize() {
scancode_map[0x2F] = Key::SEMICOLON;
scancode_map[0x30] = Key::APOSTROPHE;
scancode_map[0x31] = Key::QUOTELEFT;
- scancode_map[0x32] = Key::SHIFT;
+ scancode_map[0x32] = Key::SHIFT; // Left
scancode_map[0x33] = Key::BACKSLASH;
scancode_map[0x34] = Key::Z;
scancode_map[0x35] = Key::X;
@@ -245,9 +245,9 @@ void KeyMappingX11::initialize() {
scancode_map[0x3B] = Key::COMMA;
scancode_map[0x3C] = Key::PERIOD;
scancode_map[0x3D] = Key::SLASH;
- scancode_map[0x3E] = Key::SHIFT;
+ scancode_map[0x3E] = Key::SHIFT; // Right
scancode_map[0x3F] = Key::KP_MULTIPLY;
- scancode_map[0x40] = Key::ALT;
+ scancode_map[0x40] = Key::ALT; // Left
scancode_map[0x41] = Key::SPACE;
scancode_map[0x42] = Key::CAPSLOCK;
scancode_map[0x43] = Key::F1;
@@ -275,14 +275,23 @@ void KeyMappingX11::initialize() {
scancode_map[0x59] = Key::KP_3;
scancode_map[0x5A] = Key::KP_0;
scancode_map[0x5B] = Key::KP_PERIOD;
+ //scancode_map[0x5C]
+ //scancode_map[0x5D] // Zenkaku Hankaku
scancode_map[0x5E] = Key::SECTION;
scancode_map[0x5F] = Key::F11;
scancode_map[0x60] = Key::F12;
+ //scancode_map[0x61] // Romaji
+ //scancode_map[0x62] // Katakana
+ //scancode_map[0x63] // Hiragana
+ //scancode_map[0x64] // Henkan
+ //scancode_map[0x65] // Hiragana Katakana
+ //scancode_map[0x66] // Muhenkan
+ scancode_map[0x67] = Key::COMMA; // KP_Separator
scancode_map[0x68] = Key::KP_ENTER;
- scancode_map[0x69] = Key::CTRL;
+ scancode_map[0x69] = Key::CTRL; // Right
scancode_map[0x6A] = Key::KP_DIVIDE;
scancode_map[0x6B] = Key::PRINT;
- scancode_map[0x6C] = Key::ALT;
+ scancode_map[0x6C] = Key::ALT; // Right
scancode_map[0x6D] = Key::ENTER;
scancode_map[0x6E] = Key::HOME;
scancode_map[0x6F] = Key::UP;
@@ -294,13 +303,28 @@ void KeyMappingX11::initialize() {
scancode_map[0x75] = Key::PAGEDOWN;
scancode_map[0x76] = Key::INSERT;
scancode_map[0x77] = Key::KEY_DELETE;
+ //scancode_map[0x78] // Macro
scancode_map[0x79] = Key::VOLUMEMUTE;
scancode_map[0x7A] = Key::VOLUMEDOWN;
scancode_map[0x7B] = Key::VOLUMEUP;
+ //scancode_map[0x7C] // Power
+ scancode_map[0x7D] = Key::EQUAL; // KP_Equal
+ //scancode_map[0x7E] // KP_PlusMinus
scancode_map[0x7F] = Key::PAUSE;
- scancode_map[0x85] = Key::META;
- scancode_map[0x86] = Key::META;
+ scancode_map[0x80] = Key::LAUNCH0;
+ scancode_map[0x81] = Key::COMMA; // KP_Comma
+ //scancode_map[0x82] // Hangul
+ //scancode_map[0x83] // Hangul_Hanja
+ scancode_map[0x84] = Key::YEN;
+ scancode_map[0x85] = Key::META; // Left
+ scancode_map[0x86] = Key::META; // Right
scancode_map[0x87] = Key::MENU;
+
+ scancode_map[0xA6] = Key::BACK; // On Chromebooks
+ scancode_map[0xA7] = Key::FORWARD; // On Chromebooks
+
+ scancode_map[0xB5] = Key::REFRESH; // On Chromebooks
+
scancode_map[0xBF] = Key::F13;
scancode_map[0xC0] = Key::F14;
scancode_map[0xC1] = Key::F15;
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index e8eb5b419b..af80c1c590 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -3617,15 +3617,15 @@ DisplayServer *DisplayServerMacOS::create_func(const String &p_rendering_driver,
if (p_rendering_driver == "vulkan") {
String executable_command;
if (OS::get_singleton()->get_bundle_resource_dir() == OS::get_singleton()->get_executable_path().get_base_dir()) {
- executable_command = vformat("%s --rendering-driver opengl3", OS::get_singleton()->get_executable_path());
+ executable_command = vformat("\"%s\" --rendering-driver opengl3", OS::get_singleton()->get_executable_path());
} else {
- executable_command = vformat("open %s --args --rendering-driver opengl3", OS::get_singleton()->get_bundle_resource_dir().path_join("../..").simplify_path());
+ executable_command = vformat("open \"%s\" --args --rendering-driver opengl3", OS::get_singleton()->get_bundle_resource_dir().path_join("../..").simplify_path());
}
OS::get_singleton()->alert(
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
"If possible, consider updating your macOS version or using the OpenGL 3 driver.\n\n"
"You can enable the OpenGL 3 driver by starting the engine from the\n"
- "command line with the command:\n'%s'",
+ "command line with the command:\n\n %s",
executable_command),
"Unable to initialize Vulkan video driver");
} else {
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 360e446de7..66dc9a2a5a 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -4312,7 +4312,7 @@ DisplayServer *DisplayServerWindows::create_func(const String &p_rendering_drive
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
"You can enable the OpenGL 3 driver by starting the engine from the\n"
- "command line with the command:\n'%s --rendering-driver opengl3'\n\n"
+ "command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
"If you have recently updated your video card drivers, try rebooting.",
executable_name),
"Unable to initialize Vulkan video driver");
diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp
index aa393464b6..b376854c0c 100644
--- a/platform/windows/key_mapping_windows.cpp
+++ b/platform/windows/key_mapping_windows.cpp
@@ -315,7 +315,7 @@ void KeyMappingWindows::initialize() {
scansym_map[0x51] = Key::KP_3;
scansym_map[0x52] = Key::KP_0;
scansym_map[0x53] = Key::KP_PERIOD;
- scansym_map[0x57] = Key::SECTION;
+ scansym_map[0x56] = Key::SECTION;
scansym_map[0x57] = Key::F11;
scansym_map[0x58] = Key::F12;
scansym_map[0x5B] = Key::META;