From b32a2d36d43ba67eb47a034c71db185ecaf1e300 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Fri, 21 Nov 2025 16:06:30 -0500 Subject: [PATCH] build: Require xkbcommon 1.10+ --- cmake/Libraries.cmake | 2 +- src/lib/platform/CMakeLists.txt | 3 --- src/lib/platform/EiKeyState.cpp | 20 -------------------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index ab437e4eb9..44e4fd75a0 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -149,7 +149,7 @@ macro(configure_unix_libs) include(FindPkgConfig) find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon) + pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon>=1.10) pkg_check_modules(GLIB2 REQUIRED glib-2.0) find_library(LIBM m) include_directories(${LIBXKBCOMMON_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt index ea217ee278..ba89e16a7c 100644 --- a/src/lib/platform/CMakeLists.txt +++ b/src/lib/platform/CMakeLists.txt @@ -174,9 +174,6 @@ if(UNIX) find_library(COCOA_LIBRARY Cocoa) target_link_libraries(platform ${COCOA_LIBRARY}) else() - if(${LIBXKBCOMMON_VERSION} VERSION_GREATER_EQUAL "1.10") - target_compile_definitions(platform PRIVATE HAVE_XKB_KEYMAP_MOD_GET_MASK=1) - endif() target_compile_definitions(platform PUBLIC WINAPI_LIBEI WINAPI_LIBPORTAL) target_include_directories(platform PUBLIC ${LIBEI_INCLUDE_DIRS} ${LIBPORTAL_INCLUDE_DIRS}) target_link_libraries( diff --git a/src/lib/platform/EiKeyState.cpp b/src/lib/platform/EiKeyState.cpp index 473ae6659d..d643e3c945 100644 --- a/src/lib/platform/EiKeyState.cpp +++ b/src/lib/platform/EiKeyState.cpp @@ -120,14 +120,9 @@ std::uint32_t EiKeyState::convertModMask(xkb_mod_mask_t xkbModMaskIn) const for (xkb_mod_index_t xkbModIdx = 0; xkbModIdx < xkb_keymap_num_mods(m_xkbKeymap); xkbModIdx++) { const char *name = xkb_keymap_mod_get_name(m_xkbKeymap, xkbModIdx); -#ifdef HAVE_XKB_KEYMAP_MOD_GET_MASK // Available since xkbcommon v1.10 // Note: xkb_keymap_mod_get_mask2 was added in v1.11 which accepts xkb_mod_index_t. const auto xkbModMask = xkb_keymap_mod_get_mask(m_xkbKeymap, name); -#else - // HACK: in older xkbcommon we need to create the mask manually from the index. - const xkb_mod_mask_t xkbModMask = (1 << xkbModIdx); -#endif // Skip modifiers that have no XKB mask (not mapped to any real modifier) // or are inactive. Without the xkbModMask == 0 check, modifiers with mask 0 @@ -135,21 +130,6 @@ std::uint32_t EiKeyState::convertModMask(xkb_mod_mask_t xkbModMaskIn) const if (xkbModMask == 0 || (xkbModMaskIn & xkbModMask) != xkbModMask) continue; - /* added in libxkbcommon 1.8.0 in the same commit so we have all or none */ -#ifndef XKB_VMOD_NAME_ALT - static const auto XKB_VMOD_NAME_ALT = "Alt"; - static const auto XKB_VMOD_NAME_LEVEL3 = "LevelThree"; - static const auto XKB_VMOD_NAME_LEVEL5 = "LevelFive"; - static const auto XKB_VMOD_NAME_META = "Meta"; - static const auto XKB_VMOD_NAME_NUM = "NumLock"; - static const auto XKB_VMOD_NAME_SCROLL = "ScrollLock"; - static const auto XKB_VMOD_NAME_SUPER = "Super"; - static const auto XKB_VMOD_NAME_HYPER = "Hyper"; - static const auto XKB_MOD_NAME_MOD2 = "Mod2"; - static const auto XKB_MOD_NAME_MOD3 = "Mod3"; - static const auto XKB_MOD_NAME_MOD5 = "Mod5"; -#endif - // From wismill (xkbcommon maintainer): // Meta is usually encoded like Alt, i.e. to Mod1. In that case, both share the same state. // Added to that, if KDE interprets Meta as Super (the logo key), then it might explain the mess.