diff options
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/detect.py | 2 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 40 | ||||
-rw-r--r-- | platform/linuxbsd/key_mapping_x11.cpp | 16 | ||||
-rw-r--r-- | platform/linuxbsd/key_mapping_x11.h | 4 | ||||
-rw-r--r-- | platform/linuxbsd/vulkan_context_x11.cpp | 8 |
5 files changed, 37 insertions, 33 deletions
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index eba672ddcb..3e3ed469ed 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -384,7 +384,7 @@ def configure(env): if env["vulkan"]: env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - if not env["builtin_vulkan"]: + if not env["use_volk"]: env.ParseConfig("pkg-config vulkan --cflags --libs") if not env["builtin_glslang"]: # No pkgconfig file for glslang so far diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 4a32dd9646..a39941339a 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -2207,7 +2207,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, if (status == XLookupChars) { bool keypress = xkeyevent->type == KeyPress; - unsigned int keycode = KeyMappingX11::get_keycode(keysym_keycode); + Key keycode = KeyMappingX11::get_keycode(keysym_keycode); unsigned int physical_keycode = KeyMappingX11::get_scancode(xkeyevent->keycode); if (keycode >= 'a' && keycode <= 'z') { @@ -2224,7 +2224,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, } if (keycode == 0) { - keycode = physical_keycode; + keycode = (Key)physical_keycode; } _get_key_modifier_state(xkeyevent->state, k); @@ -2236,7 +2236,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, k->set_keycode(keycode); - k->set_physical_keycode(physical_keycode); + k->set_physical_keycode((Key)physical_keycode); k->set_echo(false); @@ -2247,7 +2247,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, k->set_shift_pressed(true); } - Input::get_singleton()->accumulate_input_event(k); + Input::get_singleton()->parse_input_event(k); } memfree(utf8string); return; @@ -2271,7 +2271,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, // KeyMappingX11 just translated the X11 keysym to a PIGUI // keysym, so it works in all platforms the same. - unsigned int keycode = KeyMappingX11::get_keycode(keysym_keycode); + Key keycode = KeyMappingX11::get_keycode(keysym_keycode); unsigned int physical_keycode = KeyMappingX11::get_scancode(xkeyevent->keycode); /* Phase 3, obtain a unicode character from the keysym */ @@ -2292,12 +2292,12 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, bool keypress = xkeyevent->type == KeyPress; - if (physical_keycode == 0 && keycode == 0 && unicode == 0) { + if (physical_keycode == 0 && keycode == KEY_NONE && unicode == 0) { return; } - if (keycode == 0) { - keycode = physical_keycode; + if (keycode == KEY_NONE) { + keycode = (Key)physical_keycode; } /* Phase 5, determine modifier mask */ @@ -2360,11 +2360,11 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, k->set_pressed(keypress); if (keycode >= 'a' && keycode <= 'z') { - keycode -= 'a' - 'A'; + keycode -= int('a' - 'A'); } k->set_keycode(keycode); - k->set_physical_keycode(physical_keycode); + k->set_physical_keycode((Key)physical_keycode); k->set_unicode(unicode); k->set_echo(p_echo); @@ -2396,7 +2396,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, } } - Input::get_singleton()->accumulate_input_event(k); + Input::get_singleton()->parse_input_event(k); } Atom DisplayServerX11::_process_selection_request_target(Atom p_target, Window p_requestor, Atom p_property) const { @@ -2883,13 +2883,13 @@ void DisplayServerX11::process_events() { // in a spurious mouse motion event being sent to Godot; remember it to be able to filter it out xi.mouse_pos_to_filter = pos; } - Input::get_singleton()->accumulate_input_event(st); + Input::get_singleton()->parse_input_event(st); } else { if (!xi.state.has(index)) { // Defensive break; } xi.state.erase(index); - Input::get_singleton()->accumulate_input_event(st); + Input::get_singleton()->parse_input_event(st); } } break; @@ -2906,7 +2906,7 @@ void DisplayServerX11::process_events() { sd->set_index(index); sd->set_position(pos); sd->set_relative(pos - curr_pos_elem->value()); - Input::get_singleton()->accumulate_input_event(sd); + Input::get_singleton()->parse_input_event(sd); curr_pos_elem->value() = pos; } @@ -3058,7 +3058,7 @@ void DisplayServerX11::process_events() { st->set_index(E->key()); st->set_window_id(window_id); st->set_position(E->get()); - Input::get_singleton()->accumulate_input_event(st); + Input::get_singleton()->parse_input_event(st); } xi.state.clear(); #endif @@ -3156,7 +3156,7 @@ void DisplayServerX11::process_events() { mb->set_window_id(window_id_other); mb->set_position(Vector2(x, y)); mb->set_global_position(mb->get_position()); - Input::get_singleton()->accumulate_input_event(mb); + Input::get_singleton()->parse_input_event(mb); } break; } @@ -3164,7 +3164,7 @@ void DisplayServerX11::process_events() { } } - Input::get_singleton()->accumulate_input_event(mb); + Input::get_singleton()->parse_input_event(mb); } break; case MotionNotify: { @@ -3280,7 +3280,7 @@ void DisplayServerX11::process_events() { // this is so that the relative motion doesn't get messed up // after we regain focus. if (focused) { - Input::get_singleton()->accumulate_input_event(mm); + Input::get_singleton()->parse_input_event(mm); } else { // Propagate the event to the focused window, // because it's received only on the topmost window. @@ -3300,7 +3300,7 @@ void DisplayServerX11::process_events() { mm->set_position(pos_focused); mm->set_global_position(pos_focused); mm->set_speed(Input::get_singleton()->get_last_mouse_speed()); - Input::get_singleton()->accumulate_input_event(mm); + Input::get_singleton()->parse_input_event(mm); break; } @@ -3433,7 +3433,7 @@ void DisplayServerX11::process_events() { */ } - Input::get_singleton()->flush_accumulated_events(); + Input::get_singleton()->flush_buffered_events(); } void DisplayServerX11::release_rendering_thread() { diff --git a/platform/linuxbsd/key_mapping_x11.cpp b/platform/linuxbsd/key_mapping_x11.cpp index 74257a7e61..a1ef28234d 100644 --- a/platform/linuxbsd/key_mapping_x11.cpp +++ b/platform/linuxbsd/key_mapping_x11.cpp @@ -34,7 +34,7 @@ struct _XTranslatePair { KeySym keysym; - unsigned int keycode; + Key keycode; }; static _XTranslatePair _xkeysym_to_keycode[] = { @@ -176,7 +176,7 @@ static _XTranslatePair _xkeysym_to_keycode[] = { { XF86XK_LaunchC, KEY_LAUNCHE }, { XF86XK_LaunchD, KEY_LAUNCHF }, - { 0, 0 } + { 0, KEY_NONE } }; struct _TranslatePair { @@ -309,11 +309,11 @@ unsigned int KeyMappingX11::get_scancode(unsigned int p_code) { return keycode; } -unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) { +Key KeyMappingX11::get_keycode(KeySym p_keysym) { // kinda bruteforce.. could optimize. if (p_keysym < 0x100) { // Latin 1, maps 1-1 - return p_keysym; + return (Key)p_keysym; } // look for special key @@ -323,14 +323,14 @@ unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) { } } - return 0; + return KEY_NONE; } -KeySym KeyMappingX11::get_keysym(unsigned int p_code) { +KeySym KeyMappingX11::get_keysym(Key p_code) { // kinda bruteforce.. could optimize. if (p_code < 0x100) { // Latin 1, maps 1-1 - return p_code; + return (KeySym)p_code; } // look for special key @@ -340,7 +340,7 @@ KeySym KeyMappingX11::get_keysym(unsigned int p_code) { } } - return 0; + return (KeySym)KEY_NONE; } /***** UNICODE CONVERSION ******/ diff --git a/platform/linuxbsd/key_mapping_x11.h b/platform/linuxbsd/key_mapping_x11.h index 163a8e21db..598db1c45a 100644 --- a/platform/linuxbsd/key_mapping_x11.h +++ b/platform/linuxbsd/key_mapping_x11.h @@ -44,9 +44,9 @@ class KeyMappingX11 { KeyMappingX11() {} public: - static unsigned int get_keycode(KeySym p_keysym); + static Key get_keycode(KeySym p_keysym); static unsigned int get_scancode(unsigned int p_code); - static KeySym get_keysym(unsigned int p_code); + static KeySym get_keysym(Key p_code); static unsigned int get_unicode_from_keysym(KeySym p_keysym); static KeySym get_keysym_from_unicode(unsigned int p_unicode); }; diff --git a/platform/linuxbsd/vulkan_context_x11.cpp b/platform/linuxbsd/vulkan_context_x11.cpp index 88cb00a8a1..4d58e4999b 100644 --- a/platform/linuxbsd/vulkan_context_x11.cpp +++ b/platform/linuxbsd/vulkan_context_x11.cpp @@ -29,7 +29,11 @@ /*************************************************************************/ #include "vulkan_context_x11.h" -#include <vulkan/vulkan_xlib.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif const char *VulkanContextX11::_get_platform_surface_extension() const { return VK_KHR_XLIB_SURFACE_EXTENSION_NAME; @@ -44,7 +48,7 @@ Error VulkanContextX11::window_create(DisplayServer::WindowID p_window_id, Displ createInfo.window = p_window; VkSurfaceKHR surface; - VkResult err = vkCreateXlibSurfaceKHR(_get_instance(), &createInfo, nullptr, &surface); + VkResult err = vkCreateXlibSurfaceKHR(get_instance(), &createInfo, nullptr, &surface); ERR_FAIL_COND_V(err, ERR_CANT_CREATE); return _window_create(p_window_id, p_vsync_mode, surface, p_width, p_height); } |