From 9defe345cadb979e60f06b38838ffb92d46c7fef Mon Sep 17 00:00:00 2001 From: Matthew Schwartz Date: Sat, 14 Dec 2024 20:54:57 -0800 Subject: [PATCH] WaylandBackend: Fix hotkeys failing to bind properly with Wayland backend Per Wayland protocol specsheet regarding keymapping: "From version 7 onwards, the fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may fail." This matches up exactly with what we're seeing with this error: [gamescope] [Error] xdg_backend: Failed to map keymap fd. Changing MAP_SHARED to MAP_PRIVATE per the spec addresses this error. Fixes: #1658 (hopefully) fixes: #1637 --- src/Backends/WaylandBackend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp index f90c09608..08af8bca1 100644 --- a/src/Backends/WaylandBackend.cpp +++ b/src/Backends/WaylandBackend.cpp @@ -2730,7 +2730,7 @@ namespace gamescope defer( close( nFd ) ); assert( uFormat == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 ); - char *pMap = (char *)mmap( nullptr, uSize, PROT_READ, MAP_SHARED, nFd, 0 ); + char *pMap = (char *)mmap( nullptr, uSize, PROT_READ, MAP_PRIVATE, nFd, 0 ); if ( !pMap || pMap == MAP_FAILED ) { xdg_log.errorf( "Failed to map keymap fd." );