From 323c3f80c5885b7476a0aac9dd5fac39b3b0c290 Mon Sep 17 00:00:00 2001 From: Rindbee Date: Tue, 7 Mar 2023 16:05:11 +0800 Subject: Fix broken shortcut key input (cherry picked from commit 91e460d500c52505557ed79af4547f188b635589) --- platform/linuxbsd/x11/display_server_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform') diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index d1f1115aad..7a59a1a398 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -2917,7 +2917,7 @@ BitField DisplayServerX11::_get_mouse_button_state(MouseButton } void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, LocalVector &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; -- cgit v1.2.3 From 08845dc3f000cd4de4ce1d6faabda398a5aed8b9 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 7 Mar 2023 09:24:05 -0800 Subject: Propogate errors when creating an OpenGL context fails in X11 (cherry picked from commit e7ea3ef53189d4bc94c784e4805a5311701ba9aa) --- platform/linuxbsd/x11/display_server_x11.cpp | 4 +++- platform/linuxbsd/x11/gl_manager_x11.cpp | 23 +++++++++++++++++++---- platform/linuxbsd/x11/gl_manager_x11.h | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) (limited to 'platform') diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 7a59a1a398..aa31ec83b2 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -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); -- cgit v1.2.3 From 0c1abbd79efea87b358be8a00fa2d903ccae4a3b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 8 Mar 2023 12:13:41 +0200 Subject: [Linux/X11] Add some missing keycodes/scancodes. (cherry picked from commit 5d35c600d5e4d6fc553246407e766d600f5b774e) --- platform/linuxbsd/x11/key_mapping_x11.cpp | 44 ++++++++++++++++++++++++------- platform/windows/key_mapping_windows.cpp | 2 +- 2 files changed, 35 insertions(+), 11 deletions(-) (limited to 'platform') 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/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; -- cgit v1.2.3 From 006410ae46b59bb2699d0885a12d93f53e99a59e Mon Sep 17 00:00:00 2001 From: Chris Weber Date: Sat, 4 Mar 2023 17:24:00 +0100 Subject: increased max touches to 32 for ios (cherry picked from commit 54bd204377fb73a5871946005bd7cbbad4b91df9) --- platform/ios/godot_view.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform') 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 -static const int max_touches = 8; +static const int max_touches = 32; static const float earth_gravity = 9.80665; @interface GodotView () { -- cgit v1.2.3 From 10424abb29709a9ef6c6761fc3c704ace0f642e8 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 8 Mar 2023 22:27:42 +0100 Subject: Tweak command syntax in Vulkan renderer failure message This quotes the executable name so that copying it always works (even if the path contains spaces). The command is also indented from the rest of the text and is no longer single-quoted, as that can prevent the command from running if the line is copied in its entirety (with the quotes). (cherry picked from commit ddc9cc3e492861dff43617cecb24ae919e122455) --- platform/linuxbsd/x11/display_server_x11.cpp | 2 +- platform/macos/display_server_macos.mm | 6 +++--- platform/windows/display_server_windows.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'platform') diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index aa31ec83b2..5be1bd236b 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -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"); 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"); -- cgit v1.2.3