The wl_fixes.ack_global_remove request signals the compositor that the
client will not bind the removed global. It can be used by the
compositor to decide when it is safe to actually destroy the
corresponding global. If a global is destroyed too soon, some clients may
get disconnected.
See also https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/533
Remove a superfluous null byte at the end of ps3_hid_report_descriptor,
as it might confuse some more stricter parser.
The data in ps3_hid_report_descriptor probably comes for a libinput
recording, and sometimes those can have superfluous null byte at the
end.
This is mentioned for example in the hidreport project:
64d4067403/tools/libinput-recording-extract-hid-descriptor.py (L25-L27)
As a proof that the original HID report descriptor of the actual device
is 148 bytes long, the following lsusb capture can be compared:
http://ps3.jim.sh/sixaxis/usb/lsusb.txt
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
Some window managers will mark minimized or offscreen windows as unmapped. When hiding a window, unconditionally call XWithdrawWindow, and don't wait for an UnmapNotify event if the window is already in the unmapped state, or it will block indefinitely waiting for an event that never arrives.
My old PR #15867 switched the fullscreen path to WindowInsetsController.hide() for API 30+, because the legacy setSystemUiVisibility() flags are ignored on API 30+.
The leaving fullscreen path was left untouched: it still calls setSystemUiVisibility(SYSTEM_UI_FLAG_VISIBLE), which is equally ignored on API 30+.
As a result, once fullscreen had hidden the status/navigation bars, they never came back when returning to windowed mode.
v2 removes v1's strict ordering requirement (decoration object must be created and configured before any buffer is attached), allowing xdg_toplevel_decoration to be created even after a buffer has already been attached/committed
The PS3 probing switches the HORI Horipad Mini into Nintendo Switch report mode, which we don't recognize since it's still using the Xbox 360 endpoint.
Generate activation tokens for new windows when necessary, and check the hint for activating windows when shown. This will allow new windows to correctly take focus in environments with elevated focus stealing prevention when possible, and it will try to prevent new windows from being activated if the hint is set to false.
It's possible that IOStreams might get created and thrown away a lot, perhaps
at any point in an app's lifetime, so it makes sense to avoid doing the work
of maintaining a properties group for each, if the app hasn't requested it,
since this requires a bunch of allocations and locks.
It's not necessarily worth doing this for other SDL objects, like SDL_Window,
since there are likely to only be a few of them, and likely created at startup
and living for the entire lifespan of the app.
Fixes#14436.
We don't care _what_ the `sizeof` results are, we just want it to vaporize
the condition's code out of the build. So we check it with a `? 1 : 0`, so it
always boils down to a `sizeof (int)`, no matter what data type the condition
actually is.
This works with bitfields, pointers, anything that can be "truthy." If it
isn't truthy, it would fail when assertions are enabled anyhow.
Fixes#15990.
* testevdev: Always use decimal for HID report descriptors size
The size of the HID report descriptors in the SDL_COMPILE_TIME_ASSERT
checks is specified sometimes in decimal and sometimes in octal.
Always used decimal for consistency.
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* SDL_report_descriptor: Add missing include guards in header file
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* SDL_report_descriptor: Fix some ignored return values
Fix some ignored return values resulting in incomplete error checking.
For instance:
- ParseMainItem() was always returning true because the return value of
AddInputFields() was not handled.
- ParseLocalItem() was always returning true because the return value of
AddUsage() was not handled.
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* test: Add new test program for SDL_report_descriptor code
Add support for testing the SDL_report_descriptor code by adding a new
executable to make it easier to experiment with HID report descriptor
parsing.
The main() function which originally was in
src/joystick/hidapi/SDL_report_descriptor.c is moved to a separate file
named test/testdescriptor.c in order to simplify dealing with multiple
build systems.
For instance if the main() was in
src/joystick/hidapi/SDL_report_descriptor.c the code would have to
account for the cases when the file is built as part of the library or
when it's built as part of a standalone executable, in which case the
dynamic API mechanism needs to be disabled.
This would pose a problem especially with MSVC which uses pre-compiled
headers (PCH) which do not sit well with the preprocessor logic that
would be needed, like the hacks added in test/testevdev.c
Using a completely separate source file for the standalone executable
avoids the issue, especially considering that the new file is not built
with MSVC at all.
The new test program can be built with:
cmake -DCMAKE_BUILD_TYPE=Debug -DSDL_TESTS=ON -S . -B build
make -C testdescriptor
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* testdescriptor: Fix compiler warning
Fix compiler warning:
-----------------------------------------------------------------------
.../test/testdescriptor.c: In function ‘main’:
.../test/testdescriptor.c:56:17: warning: unused variable ‘file’ [-Wunused-variable]
56 | const char *file = argv[1];
| ^~~~
-----------------------------------------------------------------------
Use the `file` variable when appropriate since it is already declared
and assigned.
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* testdescriptor: Clean up descriptor context before exiting
For correctness clean up the descriptor parsing context before exiting,
even though this is not a problem in practice for a standalone
executable.
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* testdescriptor: Exercise public API for parsing report descriptor
This gives some more coverage when running the SDL_report_descriptor
test program.
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* SDL_report_descriptor: use size_t for variables that represent buffer sizes
Using size_t type for variables that represent buffer sizes in
src/joystick/hidapi/SDL_report_descriptor.[hc] addresses possible errors
when using the functions in combination with SDL_LoadFile, like in
test/testdescriptor.c
When building with CMake on Windows x64 the compilation was failing with
the following error:
-----------------------------------------------------------------------
D:\a\SDL\SDL\test\testdescriptor.c(69): error C2220: the following warning is treated as an error
D:\a\SDL\SDL\test\testdescriptor.c(69): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
-----------------------------------------------------------------------
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
* SDL_hidapi_xboxone: protect against passing negative size to SDL_ReadReportData
Since SDL_ReadReportData() is now using size_t for the buffer size, also
change its user HIDAPI_DriverXboxOne_HandleDescriptorReport to pass
size_t, but protecting against possible cases of passing negative values
to SDL_ReadReportData().
To do that it is enough to check that the "size" argument is not zero,
so it will never be negative when decremented (size--) a few lines
below.
Note: this just addresses a theoretical issue with future callers of
HIDAPI_DriverXboxOne_HandleDescriptorReport, the current code would be
already safe as the current caller already checks that size > 0.
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
---------
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
Remove redundant state variables, remove trivial helper functions, and guard against the unlikely case where a compositor may set the repeat rate to zero while a repeat is active, which would result in a divide-by-zero error.
Key repeat is increasingly handled server-side with seat v10 and above, so consider that the most common path for the future.
Third party wireless controllers use the full Switch Pro protocol over Bluetooth and third party wired controllers use the input-only protocol.
The PDP Afterglow Wave Controller for Switch uses the same VID/PID for both wired and wireless variants, so we need to look at the connection type to determine what protocol to use.