This is a USB adapter for controllers shipped with Nintendo's NES-mini and
SNES-mini consoles.
Tested with both NES and SNES controllers, buttons map as expected on both.
Most of this code is disabled out for now.
- For mouse cursors we have a wl_surface for both system and custom
cursors which needs recreating.
- The other patch is about nullification after deletions
This works around udev event nodes arriving before hidraw nodes and the controller being opened twice - once using the Linux driver and once by the HIDAPI driver.
This also fixes a kernel panic on Steam Link hardware due to trying to open the hidraw device node too early.
A delay of 10 ms seems to be a good value, tested on Steam Link hardware.
When SDL is included as a subproject, the following error might appear:
```
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_OBJC_COMPILE_OBJECT
```
This is probably because the master project does not see certain OBJC related variables
If relative mouse mode is explicitly enabled, don't modify the capture flag on button events or the window might report having lost mouse focus if a button is pressed while moving the cursor.
AM_PATH_SDL2 doesn't add much beyond PKG_CHECK_MODULES, and having a
special m4 macro for every library that you might depend on scales
poorly.
The macro does add special support for macOS frameworks, but that feature
was broken for around 6 years without anyone noticing (#6141), and is
likely to be only rarely useful according to comments on #6141.
Resolves: #6140
Signed-off-by: Simon McVittie <smcv@collabora.com>
Library-specific foo-config scripts duplicate very similar logic across
various different projects, and tend to break cross-compiling, multilib
(gcc -m32), Debian/Ubuntu multiarch and so on by only being able to have
one sdl2-config at a time as the first one in the PATH.
The direct replacement is pkg-config(1) or a compatible reimplementation
like pkgconf(1), which relies on each library installing declarative
metadata, like SDL's sdl2.pc (available since at least 2.0.0) and
centralizes the logic into the pkg-config/pkgconf tool.
Most uses of `sdl2-config --foo` can be replaced by something similar
to `${PKG_CONFIG:-pkg-config} --foo sdl2`. Instead of adding a custom
sdl2-config to the PATH or using its --prefix or --exec-prefix options,
users of a custom installation prefix can use any of pkg-config's
non-SDL-specific ways to influence the result, for example setting
PKG_CONFIG_PATH, PKG_CONFIG_SYSROOT_DIR or PKG_CONFIG_LIBDIR environment
variables, or setting the PKG_CONFIG environment variable to point to
a wrapper script.
For Autotools specifically, the replacement for AM_PATH_SDL2 (which
will be officially deprecated in a subsequent commit) is
PKG_CHECK_MODULES.
CMake has its own semi-declarative mechanism for dependency discovery,
"config packages", and the SDL build already installs a config
package. There's a good example of using a config package to discover
SDL in `cmake/test/`.
Meson natively supports pkg-config, and already uses it in preference
to sdl2-config.
Other build systems can run pkg-config instead of sdl2-config,
preferably checking the PKG_CONFIG environment variable first.
https://github.com/ioquake/ioq3 is a good example of a project doing
this correctly.
Helps: #6140, #3516
Signed-off-by: Simon McVittie <smcv@collabora.com>
This is a functional state for some window managers (tested using stock Ubuntu 22.04.1), and removing that state, e.g. using SDL_RestoreWindow(), results in a window centered and floating, and not visually covering the rest of the desktop.
This uses a newer browser API to get physical scancodes, but still
uses the (deprecated) event field that we were already using for
scancodes, but for keycodes instead now, which appears to be more
accurate.
Since keyboard layout isn't (generally) available to web apps, this
adds an internal interface to send key events with both scancode
and keycode to SDL's internals, instead of sending just scancodes and
expecting SDL to use its own keymap to generate keycodes.
Future work in this area would be to use the keyboard layout APIs
on browsers that support them, which would allow us to use SDL's
usual keymap code and not rely on a deprecated browser API, but
until we get there, this patch gives significantly more correct
results than we would have before.
Fixes#2098.
Exit the fullscreen sequence sooner if it is requested that a popup window be fullscreen.
The surface commit formerly in this path is irrelevant and can be removed as previous changes made it so that SetFullscreen() is no longer called from anywhere except Wayland_SetWindowFullscreen().
The controller can use either hat or buttons for the D-Pad, depending on what Linux driver is in use. The automatic mapping in LINUX_JoystickGetGamepadMapping() will do the right thing based on the exposed capability bits.
I'm sure this is the case for other controllers as well, so we might be removing more mappings over time.