An interesting merge this weekend to the Simple DirectMedia Library (SDL) that is widely-used by cross-platform games and other applications for software/hardware abstractions is Wayland multi-seat support. This addition also comes with a developer working on Valve’s Linux graphics efforts.
Merged on Saturday to mainline SDL3 Git is multi-seat support for allowing multiple keyboard/pointer inputs simultaneously for different concurrent users. Frank Praznik, who is involved with Valve’s Linux graphics efforts, authored this multi-seat support. He summed up in the commit:
“Wayland environments can expose more than one seat for multiple collections of input devices, which can include multiple, simultaneously active, desktop pointers and keyboards with independent layouts. The Wayland input backend previously presumed that only one seat could exist, which caused broken behavior if the compositor exposed more than one, which is possible on wlroots based compositors such as Sway. This introduces support for handling multiple seats, including proper handling of dynamically added and removed seats and capabilities at run time.
The SDL Wayland input system was accreted over time, and the assumption that only one seat will ever exist resulted in state and related objects not always being tied to their most appropriate owner in a multi-seat scenario, so refactoring was required to manage several bits of state per-seat, instead of per-window or globally.
As Wayland keyboards can have per-seat layouts, fast keymap switching is required when multiplexing input from multiple seats to the global SDL keyboard device. A parameter was added to the keymap creation function to specify if the keymap lifetime should be externally managed to facilitate keymap reuse, and some layout info was moved from the global keyboard state to the keymap state to avoid unnecessarily redetermining it whenever a reused keymap is bound. This reduces the overhead of switching keymaps to setting a single pointer.
Multiple seats also means that multiple windows can have keyboard and/or mouse focus at the same time on some compositors, but this is not currently a well-handled case in SDL, and will require more work to support, if necessary.”
In the pull request it’s noted this Wayland multi-seat support was tested with the Sway compositor while using two sets of keyboards and mice.
This Wayland multi-seat support for SDL could be useful for split-screen multi-player games and similar purposes.