dolphin/Source/Core/InputCommon
Jeffrey Bosboom c6f9e61d38 XInput2: Accept input from keyboards other than the first master
XInput2 was created to support multiple pointer/keyboard pairs (often
called MPX for multi-pointer X).  Dolphin's XInput2 implementation has
always supported MPX by creating a KeyboardMouse object per master
pointer.  Since commit bbb12a7, Dolphin's keyboard state is filtered by
the output of XQueryKeymap.  As a core X function, XQueryKeymap queries
"the" keyboard, which by default is the first master keyboard.  As a
result, Dolphin will ignore keys pressed on other master keyboards
unless the first master is simultaneously pressing the same keys.

XInput2 doesn't provide a function to query the keyboard state.  There
is no XIQueryKeymap and the current state is not a member of the
XIKeyClassInfo returned by XIQueryDevice.  Instead, XInput2 allows a
master pointer to be nominated as "the" pointer on a per-client basis,
with "the" keyboard automatically becoming the associated master
keyboard.  The "documentation" [1] says passing None for the window is
only for debugging purposes, but it is documented in the
XISetClientPointer man page and seems to be the only way to query
keyboards beyond the first.

With this commit, Dolphin correctly reads keys from keyboards other than
the first master keyboard.  To test, use the xinput command-line utility
to create a master pointer and reattach a keyboard to the associated
master keyboard.

[1]: https://who-t.blogspot.com/2009/07/xi2-recipes-part-6.html
     (the XInput2 developer's blog)
2023-04-13 20:10:00 -07:00
..
ControllerEmu Android: Change how the overlay controller setting works 2023-03-07 17:39:34 +01:00
ControllerInterface XInput2: Accept input from keyboards other than the first master 2023-04-13 20:10:00 -07:00
ControlReference InputCommon: Fix memory leak in ExpressionParser 2023-02-17 18:29:36 -08:00
DynamicInputTextures treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
CMakeLists.txt ControllerInterface/Android: Implement device population 2023-03-03 22:28:23 +01:00
DynamicInputTextureManager.cpp Split out everying remaining from Swap 2023-01-31 19:41:24 +13:00
DynamicInputTextureManager.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
GCAdapter.cpp Resolve various "no previous declaration" warnings 2023-02-09 16:23:01 -08:00
GCAdapter.h GCAdapter: Process pad state in read thread and other general cleanups. 2022-10-22 00:38:59 -05:00
GCPadStatus.h Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
ImageOperations.cpp Add option for setting the PNG zlib compression level 2021-11-18 13:10:22 -08:00
ImageOperations.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
InputConfig.cpp Android: Remove the in-emulation IR sensitivity options 2023-03-07 17:39:34 +01:00
InputConfig.h Pad: GBA config 2021-07-13 16:42:35 +02:00
InputProfile.cpp StripSpaces: only strip spaces 2022-07-25 18:40:12 -07:00
InputProfile.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
KeyboardStatus.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00