cursor-shape-v1 version 2 adds dnd_ask and all_resize, but SDL_SystemCursor does not expose matching cursor types yet. Bind the protocol at version 2 now so SDL negotiates the updated interface correctly while keeping the current cursor mapping unchanged.
When a window has the pointer grabbed, the X server will grab all master device events, and XInput2 will continue to deliver slave events to the window immediately under the pointer, regardless of grab status. Only send slave pointer events to the focused window, and fall back to the core X events to catch button presses missed when the pointer is over another window.
This works inside of containers, and supports passing an activation token with the request, which is needed on Wayland to transfer focus to the browser.
The rest of the atomic codepath is still enabled and usable.
This fixes missing and weird mouse cursors. We'll debug this code later on.
Reference Issue #15242.
- Initialize some out variables that are annotated inout in the function setting them.
- Fix 'dwVerHandle' might not be '0' warning from msvc analyzer calling GetFileVersionInfoA. MSDN says that
the lpdwHandle param to GetFileVersionInfoSize is optional (set to zero) and the dwHandle param to
GetFileVersionInfoA is ignored. msvc goes a step further and explicitly warns if dwHandle is not provably 0.
Fixes the following:
SDL3\src\stdlib\SDL_string.c(2359): warning C6054: String 'text' might not be zero-terminated.
SDL3\src\video\windows\SDL_windowsevents.c(897): warning C6001: Using uninitialized memory 'devName'.
SDL3\src\video\windows\SDL_windowskeyboard.c(644): warning C6388: 'dwVerHandle' might not be '0': this does not adhere to the specification for the function 'GetFileVersionInfoA'.
The thread is still created once and only shut down on WIN_VideoQuit,
but the thread will unregister the devices when they're disabled to avoid
wasting time processing raw input that won't be appreciated by anyone.
This also allows RIDEV_NOLEGACY to be set on the devices, otherwise they
swallow up the WM_MOUSE* events that would be going to the main thread
when relative mode is disabled. That's out of scope for this change, though.
Fix duplicate button/scroll events when GCMouse active
Fix duplicate events and add thread-safe atomic for GCMouse
Fix GCMouse relative mode sync when connected after mode enabled
Respect SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE in GCMouse handler
Fix variable shadowing in GCMouse motion handler
If SDL_HINT_OPENGL_ES_DRIVER is enabled and a GLES context is requested,
don't try to load the WGL/GLX library. Doing so may fail, because
SDL_HINT_OPENGL_LIBRARY may have been set to a custom libGLESv2 (e.g.
ANGLE). This effectively restores the SDL2 behavior.
Other video drivers shouldn't be affected, because they always use EGL
for GLES.
Incidentally, this patch also fixes a missing GL_GetEGLSurface callback
in the X11 fallback path.
The first approach had the drawback that it accumulated handles while raw input was paused, eventually crashing the application.
Now we'll keep reading raw events from the queue, we just won't deliver them to the application.
When emulating display modes or using display scaling, custom cursors need to be scaled, or they can appear too large or small relative to the window size.
Previously we would spin up and shut down a thread every time we changed raw input mode, which can take several ms. Now we'll just put the raw input thread to sleep when disabling raw input and wake it up when enabling raw input.
The floating state is only set after the first configuration event arrives, so size changes before the window was initially shown could be dropped. Use the flags instead.
When using the display scaling mode, scaled outputs would overlap, as the origins are in scaled points, while the width and height are in pixels. Use a simple algorithm to push the overlapping rectangles apart, so they do not overlap. This may end up leaving gaps in complex layouts (which are already somewhat mangled from mixing coordinate systems), but it works well enough in most cases.
Some compositors will send a configure event immediately after a scale event, however, this event can contain the old logical size, and should be ignored, or the window will incorrectly change size when moved between displays with differing scale factors.
Store the last requested logical size as the last configure size when resizing a floating window due to a scale change, so a configure event immediately following with the old size will be ignored.