mirror of
https://github.com/glfw/glfw.git
synced 2025-12-19 13:41:54 +00:00
Compare commits
No commits in common. "d35fdc21ebce4a863d3fe00b6bd230484b587b13" and "e2f9340a8cac6b20bff0bad3f9e447b9a41cf076" have entirely different histories.
d35fdc21eb
...
e2f9340a8c
@ -1,8 +1,6 @@
|
|||||||
# Usage:
|
# Usage:
|
||||||
# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
|
# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
|
||||||
|
|
||||||
cmake_policy(VERSION 3.16)
|
|
||||||
|
|
||||||
set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
|
set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
|
||||||
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
|
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
|
||||||
set(template_path "${CMAKE_ARGV3}")
|
set(template_path "${CMAKE_ARGV3}")
|
||||||
@ -24,9 +22,8 @@ if (status_code)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(STRINGS "${source_path}" lines)
|
file(STRINGS "${source_path}" lines)
|
||||||
list(FILTER lines INCLUDE REGEX "^[0-9a-fA-F]")
|
foreach(line ${lines})
|
||||||
|
if (line MATCHES "^[0-9a-fA-F]")
|
||||||
foreach(line IN LISTS lines)
|
|
||||||
if (line MATCHES "platform:Windows")
|
if (line MATCHES "platform:Windows")
|
||||||
if (GLFW_WIN32_MAPPINGS)
|
if (GLFW_WIN32_MAPPINGS)
|
||||||
string(APPEND GLFW_WIN32_MAPPINGS "\n")
|
string(APPEND GLFW_WIN32_MAPPINGS "\n")
|
||||||
@ -43,6 +40,7 @@ foreach(line IN LISTS lines)
|
|||||||
endif()
|
endif()
|
||||||
string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
|
string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX)
|
configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX)
|
||||||
|
|||||||
18
CMake/modules/FindOSMesa.cmake
Normal file
18
CMake/modules/FindOSMesa.cmake
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Try to find OSMesa on a Unix system
|
||||||
|
#
|
||||||
|
# This will define:
|
||||||
|
#
|
||||||
|
# OSMESA_LIBRARIES - Link these to use OSMesa
|
||||||
|
# OSMESA_INCLUDE_DIR - Include directory for OSMesa
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
|
||||||
|
find_package (PkgConfig)
|
||||||
|
pkg_check_modules (PKG_OSMESA QUIET osmesa)
|
||||||
|
|
||||||
|
set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS})
|
||||||
|
set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES})
|
||||||
|
|
||||||
|
endif ()
|
||||||
@ -1,6 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 3.16...3.28 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR)
|
||||||
|
|
||||||
project(GLFW VERSION 3.5.0 LANGUAGES C HOMEPAGE_URL "https://www.glfw.org/")
|
project(GLFW VERSION 3.5.0 LANGUAGES C)
|
||||||
|
|
||||||
|
if (POLICY CMP0069)
|
||||||
|
cmake_policy(SET CMP0069 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (POLICY CMP0077)
|
||||||
|
cmake_policy(SET CMP0077 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
@ -72,8 +80,25 @@ endif()
|
|||||||
# This is here because it also applies to tests and examples
|
# This is here because it also applies to tests and examples
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.15)
|
||||||
|
foreach (flag CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS_MINSIZEREL
|
||||||
|
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
|
||||||
|
if (flag MATCHES "/MD")
|
||||||
|
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
if (flag MATCHES "/MDd")
|
||||||
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Create generated files
|
# Create generated files
|
||||||
|
|||||||
@ -67,7 +67,6 @@ video tutorials.
|
|||||||
- Robin Eklind
|
- Robin Eklind
|
||||||
- Jan Ekström
|
- Jan Ekström
|
||||||
- Siavash Eliasi
|
- Siavash Eliasi
|
||||||
- er-azh
|
|
||||||
- Ahmad Fatoum
|
- Ahmad Fatoum
|
||||||
- Nikita Fediuchin
|
- Nikita Fediuchin
|
||||||
- Felipe Ferreira
|
- Felipe Ferreira
|
||||||
@ -229,7 +228,7 @@ video tutorials.
|
|||||||
- Brandon Schaefer
|
- Brandon Schaefer
|
||||||
- Sebastian Schuberth
|
- Sebastian Schuberth
|
||||||
- Scr3amer
|
- Scr3amer
|
||||||
- Jan Schürkamp
|
- Jan Schuerkamp
|
||||||
- Christian Sdunek
|
- Christian Sdunek
|
||||||
- Matt Sealey
|
- Matt Sealey
|
||||||
- Steve Sexton
|
- Steve Sexton
|
||||||
|
|||||||
@ -90,7 +90,7 @@ in the documentation for more information.
|
|||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
GLFW itself needs only CMake 3.16 or later and the headers and libraries for your
|
GLFW itself needs only CMake 3.4 or later and the headers and libraries for your
|
||||||
OS and window system.
|
OS and window system.
|
||||||
|
|
||||||
The examples and test programs depend on a number of tiny libraries. These are
|
The examples and test programs depend on a number of tiny libraries. These are
|
||||||
@ -126,14 +126,11 @@ information on what to include when reporting a bug.
|
|||||||
`glfwMakeUserContextCurrent`, `glfwGetCurrentUserContext` (#1687,#1870)
|
`glfwMakeUserContextCurrent`, `glfwGetCurrentUserContext` (#1687,#1870)
|
||||||
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
|
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
|
||||||
the limit of the mouse button tokens to be reported (#2423)
|
the limit of the mouse button tokens to be reported (#2423)
|
||||||
- Updated minimum CMake version to 3.16 (#2541)
|
|
||||||
- [Cocoa] Added `QuartzCore` framework as link-time dependency
|
- [Cocoa] Added `QuartzCore` framework as link-time dependency
|
||||||
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
|
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
|
||||||
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
|
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
|
||||||
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
|
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
|
||||||
- [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault
|
- [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault
|
||||||
- [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727)
|
|
||||||
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
|
|
||||||
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
|
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
|
||||||
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
||||||
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
||||||
|
|||||||
5
deps/nuklear.h
vendored
5
deps/nuklear.h
vendored
@ -423,11 +423,6 @@ NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
|
|||||||
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
|
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
|
||||||
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
|
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
/* disable `operands are different enum types` warning on MSVC */
|
|
||||||
#pragma warning( disable: 5287 )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ============================================================================
|
/* ============================================================================
|
||||||
*
|
*
|
||||||
* API
|
* API
|
||||||
|
|||||||
@ -264,8 +264,8 @@ __USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or th
|
|||||||
static library version of the Visual C++ runtime library. When enabled, the
|
static library version of the Visual C++ runtime library. When enabled, the
|
||||||
DLL version of the Visual C++ library is used. This is enabled by default.
|
DLL version of the Visual C++ library is used. This is enabled by default.
|
||||||
|
|
||||||
It is recommended to set the standard CMake variable [CMAKE_MSVC_RUNTIME_LIBRARY][]
|
On CMake 3.15 and later you can set the standard CMake [CMAKE_MSVC_RUNTIME_LIBRARY][]
|
||||||
instead of this GLFW-specific option.
|
variable instead of this GLFW-specific option.
|
||||||
|
|
||||||
[CMAKE_MSVC_RUNTIME_LIBRARY]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
|
[CMAKE_MSVC_RUNTIME_LIBRARY]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,6 @@ add_custom_target(update_mappings
|
|||||||
set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3")
|
set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3")
|
||||||
|
|
||||||
if (GLFW_BUILD_COCOA)
|
if (GLFW_BUILD_COCOA)
|
||||||
enable_language(OBJC)
|
|
||||||
target_compile_definitions(glfw PRIVATE _GLFW_COCOA)
|
target_compile_definitions(glfw PRIVATE _GLFW_COCOA)
|
||||||
target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h cocoa_init.m
|
target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h cocoa_init.m
|
||||||
cocoa_joystick.m cocoa_monitor.m cocoa_window.m
|
cocoa_joystick.m cocoa_monitor.m cocoa_window.m
|
||||||
@ -53,8 +52,8 @@ endif()
|
|||||||
|
|
||||||
if (GLFW_BUILD_WAYLAND)
|
if (GLFW_BUILD_WAYLAND)
|
||||||
target_compile_definitions(glfw PRIVATE _GLFW_WAYLAND)
|
target_compile_definitions(glfw PRIVATE _GLFW_WAYLAND)
|
||||||
target_sources(glfw PRIVATE wl_platform.h wl_init.c
|
target_sources(glfw PRIVATE wl_platform.h xkb_unicode.h wl_init.c
|
||||||
wl_monitor.c wl_window.c)
|
wl_monitor.c wl_window.c xkb_unicode.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
|
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
|
||||||
@ -138,6 +137,13 @@ target_include_directories(glfw PRIVATE
|
|||||||
"${GLFW_BINARY_DIR}/src")
|
"${GLFW_BINARY_DIR}/src")
|
||||||
target_link_libraries(glfw PRIVATE Threads::Threads)
|
target_link_libraries(glfw PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
# Workaround for CMake not knowing about .m files before version 3.16
|
||||||
|
if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE)
|
||||||
|
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
|
||||||
|
cocoa_window.m nsgl_context.m PROPERTIES
|
||||||
|
LANGUAGE C)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (GLFW_BUILD_WIN32)
|
if (GLFW_BUILD_WIN32)
|
||||||
list(APPEND glfw_PKG_LIBS "-lgdi32")
|
list(APPEND glfw_PKG_LIBS "-lgdi32")
|
||||||
endif()
|
endif()
|
||||||
@ -307,34 +313,30 @@ if (GLFW_BUILD_SHARED_LIBRARY)
|
|||||||
if (MINGW)
|
if (MINGW)
|
||||||
# Enable link-time exploit mitigation features enabled by default on MSVC
|
# Enable link-time exploit mitigation features enabled by default on MSVC
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(CMakePushCheckState)
|
|
||||||
|
|
||||||
# Compatibility with data execution prevention (DEP)
|
# Compatibility with data execution prevention (DEP)
|
||||||
cmake_push_check_state()
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
|
||||||
check_c_compiler_flag("" _GLFW_HAS_DEP)
|
check_c_compiler_flag("" _GLFW_HAS_DEP)
|
||||||
if (_GLFW_HAS_DEP)
|
if (_GLFW_HAS_DEP)
|
||||||
target_link_libraries(glfw PRIVATE "-Wl,--nxcompat")
|
target_link_libraries(glfw PRIVATE "-Wl,--nxcompat")
|
||||||
endif()
|
endif()
|
||||||
cmake_pop_check_state()
|
|
||||||
|
|
||||||
# Compatibility with address space layout randomization (ASLR)
|
# Compatibility with address space layout randomization (ASLR)
|
||||||
cmake_push_check_state()
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
|
||||||
check_c_compiler_flag("" _GLFW_HAS_ASLR)
|
check_c_compiler_flag("" _GLFW_HAS_ASLR)
|
||||||
if (_GLFW_HAS_ASLR)
|
if (_GLFW_HAS_ASLR)
|
||||||
target_link_libraries(glfw PRIVATE "-Wl,--dynamicbase")
|
target_link_libraries(glfw PRIVATE "-Wl,--dynamicbase")
|
||||||
endif()
|
endif()
|
||||||
cmake_pop_check_state()
|
|
||||||
|
|
||||||
# Compatibility with 64-bit address space layout randomization (ASLR)
|
# Compatibility with 64-bit address space layout randomization (ASLR)
|
||||||
cmake_push_check_state()
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
|
||||||
check_c_compiler_flag("" _GLFW_HAS_64ASLR)
|
check_c_compiler_flag("" _GLFW_HAS_64ASLR)
|
||||||
if (_GLFW_HAS_64ASLR)
|
if (_GLFW_HAS_64ASLR)
|
||||||
target_link_libraries(glfw PRIVATE "-Wl,--high-entropy-va")
|
target_link_libraries(glfw PRIVATE "-Wl,--high-entropy-va")
|
||||||
endif()
|
endif()
|
||||||
cmake_pop_check_state()
|
|
||||||
|
# Clear flags again to avoid breaking later tests
|
||||||
|
set(CMAKE_REQUIRED_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
@ -343,8 +345,12 @@ if (GLFW_BUILD_SHARED_LIBRARY)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(JOIN glfw_PKG_DEPS " " deps)
|
foreach(arg ${glfw_PKG_DEPS})
|
||||||
list(JOIN glfw_PKG_LIBS " " libs)
|
string(APPEND deps " ${arg}")
|
||||||
|
endforeach()
|
||||||
|
foreach(arg ${glfw_PKG_LIBS})
|
||||||
|
string(APPEND libs " ${arg}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
set(GLFW_PKG_CONFIG_REQUIRES_PRIVATE "${deps}" CACHE INTERNAL
|
set(GLFW_PKG_CONFIG_REQUIRES_PRIVATE "${deps}" CACHE INTERNAL
|
||||||
"GLFW pkg-config Requires.private")
|
"GLFW pkg-config Requires.private")
|
||||||
|
|||||||
@ -712,10 +712,6 @@ int _glfwInitWayland(void)
|
|||||||
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
|
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
|
||||||
_glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym)
|
_glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym)
|
||||||
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
|
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
|
||||||
_glfw.wl.xkb.keysym_to_utf32 = (PFN_xkb_keysym_to_utf32)
|
|
||||||
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keysym_to_utf32");
|
|
||||||
_glfw.wl.xkb.keysym_to_utf8 = (PFN_xkb_keysym_to_utf8)
|
|
||||||
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keysym_to_utf8");
|
|
||||||
|
|
||||||
if (!_glfw.wl.xkb.context_new ||
|
if (!_glfw.wl.xkb.context_new ||
|
||||||
!_glfw.wl.xkb.context_unref ||
|
!_glfw.wl.xkb.context_unref ||
|
||||||
|
|||||||
@ -42,6 +42,7 @@ typedef struct VkWaylandSurfaceCreateInfoKHR
|
|||||||
typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||||
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*);
|
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*);
|
||||||
|
|
||||||
|
#include "xkb_unicode.h"
|
||||||
#include "posix_poll.h"
|
#include "posix_poll.h"
|
||||||
|
|
||||||
typedef int (* PFN_wl_display_flush)(struct wl_display* display);
|
typedef int (* PFN_wl_display_flush)(struct wl_display* display);
|
||||||
@ -177,8 +178,6 @@ typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, con
|
|||||||
typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
|
typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
|
||||||
typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t);
|
typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t);
|
||||||
typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component);
|
typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component);
|
||||||
typedef uint32_t (* PFN_xkb_keysym_to_utf32)(xkb_keysym_t);
|
|
||||||
typedef int (* PFN_xkb_keysym_to_utf8)(xkb_keysym_t, char*, size_t);
|
|
||||||
#define xkb_context_new _glfw.wl.xkb.context_new
|
#define xkb_context_new _glfw.wl.xkb.context_new
|
||||||
#define xkb_context_unref _glfw.wl.xkb.context_unref
|
#define xkb_context_unref _glfw.wl.xkb.context_unref
|
||||||
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
|
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
|
||||||
@ -192,8 +191,6 @@ typedef int (* PFN_xkb_keysym_to_utf8)(xkb_keysym_t, char*, size_t);
|
|||||||
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
|
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
|
||||||
#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout
|
#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout
|
||||||
#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active
|
#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active
|
||||||
#define xkb_keysym_to_utf32 _glfw.wl.xkb.keysym_to_utf32
|
|
||||||
#define xkb_keysym_to_utf8 _glfw.wl.xkb.keysym_to_utf8
|
|
||||||
|
|
||||||
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
|
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
|
||||||
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
|
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
|
||||||
@ -498,8 +495,6 @@ typedef struct _GLFWlibraryWayland
|
|||||||
PFN_xkb_state_update_mask state_update_mask;
|
PFN_xkb_state_update_mask state_update_mask;
|
||||||
PFN_xkb_state_key_get_layout state_key_get_layout;
|
PFN_xkb_state_key_get_layout state_key_get_layout;
|
||||||
PFN_xkb_state_mod_index_is_active state_mod_index_is_active;
|
PFN_xkb_state_mod_index_is_active state_mod_index_is_active;
|
||||||
PFN_xkb_keysym_to_utf32 keysym_to_utf32;
|
|
||||||
PFN_xkb_keysym_to_utf8 keysym_to_utf8;
|
|
||||||
|
|
||||||
PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale;
|
PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale;
|
||||||
PFN_xkb_compose_table_unref compose_table_unref;
|
PFN_xkb_compose_table_unref compose_table_unref;
|
||||||
|
|||||||
@ -1192,8 +1192,8 @@ static void inputText(_GLFWwindow* window, uint32_t scancode)
|
|||||||
if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1)
|
if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1)
|
||||||
{
|
{
|
||||||
const xkb_keysym_t keysym = composeSymbol(keysyms[0]);
|
const xkb_keysym_t keysym = composeSymbol(keysyms[0]);
|
||||||
const uint32_t codepoint = xkb_keysym_to_utf32(keysym);
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysym);
|
||||||
if (codepoint != 0)
|
if (codepoint != GLFW_INVALID_CODEPOINT)
|
||||||
{
|
{
|
||||||
const int mods = _glfw.wl.xkb.modifiers;
|
const int mods = _glfw.wl.xkb.modifiers;
|
||||||
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
|
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
|
||||||
@ -1266,8 +1266,6 @@ static void handleEvents(double* timeout)
|
|||||||
uint64_t repeats;
|
uint64_t repeats;
|
||||||
|
|
||||||
if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8)
|
if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8)
|
||||||
{
|
|
||||||
if(_glfw.wl.keyboardFocus)
|
|
||||||
{
|
{
|
||||||
for (uint64_t i = 0; i < repeats; i++)
|
for (uint64_t i = 0; i < repeats; i++)
|
||||||
{
|
{
|
||||||
@ -1281,8 +1279,6 @@ static void handleEvents(double* timeout)
|
|||||||
|
|
||||||
event = GLFW_TRUE;
|
event = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fds[CURSOR_FD].revents & POLLIN)
|
if (fds[CURSOR_FD].revents & POLLIN)
|
||||||
@ -2725,23 +2721,23 @@ const char* _glfwGetScancodeNameWayland(int scancode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WORKAROUND: xkb_keysym_to_utf8() requires the third parameter (size of the output buffer)
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysyms[0]);
|
||||||
// to be at least 7 (6 bytes + a null terminator), because it was written when UTF-8
|
if (codepoint == GLFW_INVALID_CODEPOINT)
|
||||||
// sequences could be up to 6 bytes long. The _glfw.wl.keynames buffers are only 5 bytes
|
|
||||||
// long, because UTF-8 sequences are now limited to 4 bytes and no codepoints were ever assigned
|
|
||||||
// that needed more than that. To work around this, we first copy to a temporary buffer.
|
|
||||||
//
|
|
||||||
// See: https://github.com/xkbcommon/libxkbcommon/issues/418
|
|
||||||
char temp_buffer[7];
|
|
||||||
const int bytes_written = xkb_keysym_to_utf8(keysyms[0], temp_buffer, sizeof(temp_buffer));
|
|
||||||
if (bytes_written <= 0 || bytes_written > 5)
|
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Wayland: Failed to encode keysym as UTF-8");
|
"Wayland: Failed to retrieve codepoint for key name");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy(_glfw.wl.keynames[key], temp_buffer, bytes_written);
|
|
||||||
|
|
||||||
|
const size_t count = _glfwEncodeUTF8(_glfw.wl.keynames[key], codepoint);
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to encode codepoint for key name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.wl.keynames[key][count] = '\0';
|
||||||
return _glfw.wl.keynames[key];
|
return _glfw.wl.keynames[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -535,7 +535,6 @@ static void detectEWMH(void)
|
|||||||
XA_WINDOW,
|
XA_WINDOW,
|
||||||
(unsigned char**) &windowFromChild))
|
(unsigned char**) &windowFromChild))
|
||||||
{
|
{
|
||||||
_glfwReleaseErrorHandlerX11();
|
|
||||||
XFree(windowFromRoot);
|
XFree(windowFromRoot);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user