diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f695a92..58bb473f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,7 +48,7 @@ endif() if (GLFW_BUILD_X11) target_compile_definitions(glfw PRIVATE _GLFW_X11) - target_sources(glfw PRIVATE x11_platform.h xkb_unicode.h x11_init.c + target_sources(glfw PRIVATE x11_platform.h x11_init.c x11_monitor.c x11_window.c xkb_unicode.c glx_context.c) endif() diff --git a/src/x11_platform.h b/src/x11_platform.h index 36dfcce1..f3a037f1 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -452,8 +452,6 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(V typedef VkResult (APIENTRY *PFN_vkCreateXcbSurfaceKHR)(VkInstance,const VkXcbSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice,uint32_t,xcb_connection_t*,xcb_visualid_t); -#include "xkb_unicode.h" - #define GLFW_X11_WINDOW_STATE _GLFWwindowX11 x11; #define GLFW_X11_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11; #define GLFW_X11_MONITOR_STATE _GLFWmonitorX11 x11; @@ -462,6 +460,7 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(Vk #define GLFW_GLX_CONTEXT_STATE _GLFWcontextGLX glx; #define GLFW_GLX_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx; +#define GLFW_INVALID_CODEPOINT 0xffffffffu // GLX-specific per-context data // @@ -984,6 +983,8 @@ unsigned long _glfwGetWindowPropertyX11(Window window, unsigned char** value); GLFWbool _glfwIsVisualTransparentX11(Visual* visual); +uint32_t _glfwKeySym2UnicodeX11(unsigned int keysym); + void _glfwGrabErrorHandlerX11(void); void _glfwReleaseErrorHandlerX11(void); void _glfwInputErrorX11(int error, const char* message); diff --git a/src/x11_window.c b/src/x11_window.c index 47b9ad1e..f46a7e6c 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1308,7 +1308,7 @@ static void processEvent(XEvent *event) _glfwInputKey(window, key, keycode, GLFW_PRESS, mods); - const uint32_t codepoint = _glfwKeySym2Unicode(keysym); + const uint32_t codepoint = _glfwKeySym2UnicodeX11(keysym); if (codepoint != GLFW_INVALID_CODEPOINT) _glfwInputChar(window, codepoint, mods, plain); } @@ -2944,7 +2944,7 @@ const char* _glfwGetScancodeNameX11(int scancode) if (keysym == NoSymbol) return NULL; - const uint32_t codepoint = _glfwKeySym2Unicode(keysym); + const uint32_t codepoint = _glfwKeySym2UnicodeX11(keysym); if (codepoint == GLFW_INVALID_CODEPOINT) return NULL; diff --git a/src/xkb_unicode.c b/src/xkb_unicode.c index 68767cc3..7a4ee10a 100644 --- a/src/xkb_unicode.c +++ b/src/xkb_unicode.c @@ -27,7 +27,7 @@ #include "internal.h" -#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) +#if defined(_GLFW_X11) /* * Marcus: This code was originally written by Markus G. Kuhn. @@ -906,7 +906,7 @@ static const struct codepair { // Convert XKB KeySym to Unicode // -uint32_t _glfwKeySym2Unicode(unsigned int keysym) +uint32_t _glfwKeySym2UnicodeX11(unsigned int keysym) { int min = 0; int max = sizeof(keysymtab) / sizeof(struct codepair) - 1; @@ -939,5 +939,5 @@ uint32_t _glfwKeySym2Unicode(unsigned int keysym) return GLFW_INVALID_CODEPOINT; } -#endif // _GLFW_WAYLAND or _GLFW_X11 +#endif // _GLFW_X11 diff --git a/src/xkb_unicode.h b/src/xkb_unicode.h deleted file mode 100644 index d52748ac..00000000 --- a/src/xkb_unicode.h +++ /dev/null @@ -1,30 +0,0 @@ -//======================================================================== -// GLFW 3.5 Linux - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2014 Jonas Ã…dahl -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#define GLFW_INVALID_CODEPOINT 0xffffffffu - -uint32_t _glfwKeySym2Unicode(unsigned int keysym); -