Commit Graph

5050 Commits

Author SHA1 Message Date
Frank Praznik
c1bf0e9de9 wayland: Fix some comments
Fix grammar, and remove a TODO that is no longer relevant with an event thread.
2026-04-16 10:14:46 -04:00
rewine
59ee54d136 wayland: bind cursor-shape-v1 at protocol version 2
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.
2026-04-14 10:22:48 -04:00
David Vanderson
5e0f721fd4 xinput2: correct horizontal touchpad scrolling direction
This fixes testmouse so when fingers move left the green line moves
left.
2026-04-13 19:43:59 -04:00
eafton
e4f75bac45 Remove SDL_gtk 2026-04-12 13:36:31 -07:00
Frank Praznik
dd6d49afbd wayland: Enable text input even when the text input protocol is not available.
Even without the text input protocol, basic text can still be obtained from individual keys and the composition system.
2026-04-12 13:02:50 -04:00
Cameron Gutman
463b6be133 kmsdrm: Fix order of GBM and EGL teardown
All locked front buffers must be released prior to destroying
the EGL surface to avoid causing a UAF in libnvidia-egl-gbm.so.
2026-04-10 10:38:30 -07:00
Frank Praznik
0fc9db9b82 x11: Ignore slave button presses on non-focused windows
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.
2026-04-10 12:49:30 -04:00
Cameron Gutman
c2d0b59f29 kmsdrm: Fix double-free of GBM surface buffer in atomic mode 2026-04-10 00:05:31 -05:00
Frank Praznik
682da4ee98 misc: Use the OpenURI D-Bus portal for opening URLs
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.
2026-04-05 16:31:50 -04:00
Sam Lantinga
fc2f4fcc22 Send SDL_EVENT_SCREEN_KEYBOARD_HIDDEN when the keyboard is hidden on Android 2026-04-04 10:07:58 -07:00
Sam Lantinga
5ae1308e5b Use the correct source rectangle when doing scaled blits
Fixes https://github.com/libsdl-org/SDL/issues/15309
2026-04-03 01:32:09 -07:00
nilFinx
f3a3b4b95a haiku: Always assume that the URL is encoded (required on nightly) (#15305) 2026-04-03 00:01:21 -07:00
Cameron Gutman
1674a04b01 kmsdrm: Add missing KMSDRM_FBFromBO() failure check 2026-04-02 22:02:18 -05:00
Cameron Gutman
3c11b43e59 kmsdrm: Initialize kms_in_fence_fd to -1
Prior to this fix, we closed stdin on the first call to drm_atomic_commit().
2026-04-02 20:46:53 -05:00
Ryan C. Gordon
f423a2ae34 kmsdrm: Disable atomic mouse code for now.
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.
2026-04-02 20:41:26 -04:00
Sam Lantinga
e21f7d77f3 Fixed unaligned 16-bit memory access
The previous code technically works on platforms with SSE2, but this fixes an ubsan warning.
2026-04-02 14:08:20 -07:00
Anonymous Maarten
48e80c8f26 memcpy with a NULL src/dst argument is UB
malloc of UBSAN returns NULL when allocating 0 bytes, causing a call to memcpy(NULL, xxx, 0);
2026-04-02 21:25:41 +02:00
Sam Lantinga
501ee05129 Don't strip the alpha channel when scaling surfaces if it will be needed
Fixes https://github.com/libsdl-org/SDL/issues/15297
2026-04-02 11:00:17 -07:00
Sam Lantinga
156187bf58 Added a hint "SDL_SURFACE_MALLOC" to disable aligned surface allocation
This is needed for sdl12-compat, where all surfaces were not aligned.
2026-04-02 10:30:32 -07:00
Sam Lantinga
b878ab1691 Fix msvc analyzer warnings
- 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'.
2026-03-30 10:38:55 -07:00
Frank Praznik
1df279a04f x11: Look for text/uri-list in the list of MIME types more thoroughly
A uri-list of files is the preferred format, so don't bail if a preferred text format is encountered first.
2026-03-27 12:21:40 -04:00
Strultz
6a9449c098 Fix window caption drawing on borderless windows (#15275) 2026-03-27 05:14:19 -07:00
c4veman
159bba9aa1 Check Windows version before setting window attributes 2026-03-26 10:43:52 -07:00
Petar Popovic
53c799a7a9 SDL_SetWindowShape(): Remove shape when argument is NULL 2026-03-26 10:42:12 -07:00
Green Sky
998159fa95 video: add more direct mjpeg to yuv conversions 2026-03-24 08:59:50 -07:00
Sam Lantinga
299ed51984 Added an internal hint to set OpenVR overlay flags 2026-03-23 15:23:38 -07:00
William Horvath
983e984afc windowsrawinput: Unregister/register raw input devices as necessary.
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.
2026-03-22 17:57:02 -07:00
William Horvath
706e7f9043 windowsrawinput: Fix incorrect INVALID_HANDLE_VALUE checks.
CreateEvent/CreateThread return NULL on failure.
2026-03-22 17:57:02 -07:00
William Horvath
00f9a25879 windowsrawinput: Add missing WIN_SetRawKeyboardFlag_Inputsink stub. 2026-03-22 17:57:02 -07:00
Edgar J San Martin
ad91384704 Base GCMouse raw input implementation
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
2026-03-22 08:25:22 -07:00
sunshineinabox
6b060435e3 egl: Handle error when binding EGL API in context creation 2026-03-18 13:47:27 -04:00
Andrei Alexeyev
ff543723c4 Fix SDL_HINT_OPENGL_ES_DRIVER interaction with SDL_HINT_OPENGL_LIBRARY for x11 and windows
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.
2026-03-18 12:44:48 -04:00
Frank Praznik
62af66f14a x11: More XInput2 #define cleanups
Fixes building on very old XInput2 versions (pre-2012) without smooth scrolling and multitouch.
2026-03-18 11:25:07 -04:00
Sam Lantinga
b9c227e07d Make changing raw input mode on Windows a very fast operation (take 2)
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.
2026-03-17 12:56:23 -07:00
Frank Praznik
d88f76caac x11: Fix building when XInput2 is not available 2026-03-17 15:31:48 -04:00
Sam Lantinga
c717a20ec8 Fixed initial window size and placement on visionOS 2026-03-17 12:25:13 -07:00
Frank Praznik
3d21b3bc68 wayland: Scale custom cursors with the pointer scale
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.
2026-03-17 13:24:32 -04:00
Sam Lantinga
43e90c7b1c Make changing raw input mode on Windows a very fast operation
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.
2026-03-16 17:19:47 -07:00
Sam Lantinga
1d081314a8 Fixed error when SDL_LoadSurface_IO() is passed a NULL src 2026-03-15 13:17:11 -07:00
Cameron Gutman
5f92aac095 windows: Fix Print Screen key capture during keyboard grab 2026-03-15 15:12:29 -05:00
Frank Praznik
8d55fbe4d2 wayland: Fix the state check when resizing a hidden window
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.
2026-03-15 16:03:52 -04:00
Frank Praznik
566448d95a wayland: Eliminate redundant keyboard and mouse removals
The SDL keyboard and mouse will be removed when destroying the seat, so there is no need to preemptively remove them.
2026-03-13 22:42:09 -04:00
Frank Praznik
41bce956f0 wayland: Send display moved events on display geometry changes
Updates are sent to outputs, however, dispatching the moved event was overlooked and never implemented.
2026-03-13 13:52:02 -04:00
Frank Praznik
98d23660bc wayland: Prevent overlapping outputs when using display scaling
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.
2026-03-13 13:52:02 -04:00
Frank Praznik
18219d5b53 wayland: Prevent the window from errantly growing when scale to display is used
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.
2026-03-12 10:19:22 -04:00
Mike Egger
ae3ae4ba44 windows: support flag RIDEV_INPUTSINK in raw input (#15182) 2026-03-08 16:11:33 -07:00
Ozkan Sezer
31aa18fc1d stb_image: Fix -Wdouble-promotion warning
Upstream PR 1902 by Björn Wahlstrand at https://github.com/nothings/stb
2026-03-09 00:39:50 +03:00
Frank Praznik
89393c5519 wayland: Use the built-in names of interfaces to enable protocols 2026-03-06 13:29:32 -05:00
Frank Praznik
7605f192d5 wayland: Remove Wayland interface definitions
These are relics from very long ago, before the Wayland protocols lived in-tree and the headers and sources were generated at configure time.
2026-03-06 13:29:32 -05:00
Frank Praznik
5880b8a283 Log failure reasons during early X11 and Wayland initialization
Log the reason for failure during initialization to the debug log to aid in troubleshooting.
2026-03-03 13:29:57 -05:00