Skip to content

Commit

Permalink
WaylandBackend: Fix hotkeys failing to bind properly with Wayland bac…
Browse files Browse the repository at this point in the history
…kend

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: ValveSoftware#1658
(hopefully) fixes: ValveSoftware#1637
  • Loading branch information
matte-schwartz committed Dec 15, 2024
1 parent 3821e4b commit 9defe34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Backends/WaylandBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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." );
Expand Down

0 comments on commit 9defe34

Please sign in to comment.