Commit Graph

4846 Commits (b15e880e73cc6a8e3f7c73ea8e61346d39096ccf)

Author SHA1 Message Date
Sam Lantinga db18764e41 Use correct relative include path 2021-10-01 16:27:59 -07:00
Sam Lantinga 632aca2945 Window input focus is based on WM_SETFOCUS and WM_KILLFOCUS as WM_ACTIVATE doesn't necessarily imply focus.
Hopefully resolves https://github.com/libsdl-org/SDL/issues/4450 and https://github.com/libsdl-org/SDL/pull/4293
2021-10-01 16:17:38 -07:00
Sam Lantinga 9706feacae Update length after shortening string (thanks mayraud705!)
Closes https://github.com/libsdl-org/SDL/pull/4698
2021-10-01 15:11:25 -07:00
Sylvain 77acd44f28
DirectFB: fixed creation of palette textures 2021-10-01 22:30:51 +02:00
Sylvain 83d600904b
DirectFB: add partial support for RenderGeometry
allow to fill triangles with color or texture
but only uniform vertex color is handled (not per vertex color)
2021-09-30 23:47:37 +02:00
Cameron Cawley c270949b5e Add a fast path for ARGB888->(A)BGR888 blending with pixel alpha 2021-09-28 11:27:56 -07:00
Ryan C. Gordon 114d1d46ac
direct3d: Remove unnecessary render target support check.
Direct3D 9 dictates that caps.NumSimultaneousRTs must always be at least 1,
which is to say that Direct3D 9 level hardware must always support render
targets.

(caps.NumSimultaneousRTs is meant to show if you can draw to multiple render
targets in a single draw call.)

We had already hardcoded SDL_RENDERER_TARGETTEXTURE as available earlier in
the function anyhow.

Fixes #4781.
2021-09-27 23:18:25 -04:00
Ethan Lee 0fc43504a0 wayland: Add support for XCURSOR_THEME/SIZE 2021-09-27 16:41:43 -04:00
Martin Mauersics 7c050aa60a egl: Don't fail to create a context if KHR_create_context_no_error is unsupported 2021-09-27 13:53:16 -04:00
David Gow 35d045584d video: wayland: Support displays with a 0 refresh rate
Some wayland compositors report the refresh rate as 0. Since we want to
force a minimum refresh rate of 10 frames worth, we were dividing by the
reported refresh rate, causing a divide-by-zero.

If the refresh rate is 0, instead force a frame every second if no frame
callbacks are received.

This fixes bug #4785
2021-09-27 09:26:40 -04:00
Sam Lantinga 9672d58119 Need to check structure version before setting xdg_toplevel to NULL 2021-09-26 14:22:11 -07:00
Northfear 14f225198d Use SDL_calloc for allocation of gxm_texture 2021-09-26 14:16:35 -07:00
Cacodemon345 b592e78f93 wayland: Expose xdg_toplevel to SysWM 2021-09-26 05:53:21 -04:00
Sam Lantinga 477fcf52e9 Fixed whitespace 2021-09-24 10:49:46 -07:00
Sam Lantinga db68af8032 Reduce the likelyhood that the mouse will hover over the taskbar or toast notification while in relative mode, which causes a mouse leave event.
This will still happen occasionally as the mouse is whipped around, if there is a window overlapping the game window, but it should happen less often now. This could even happen with the original code that warped the mouse every frame, so this should be a good compromise where we don't warp the mouse continously and we still keep the mouse in the safe area of the game window.

Note that notifications can be any size, so the safe area may need to be adjusted or even dynamically defined via a hint.
2021-09-24 10:49:44 -07:00
Ethan Lee 7ed415d2ed wayland: Reuse KeySymToUcs4 to replicate X11 keymap behavior 2021-09-23 11:50:47 -07:00
Ethan Lee 1a4e2e5ef7 wayland: For text, ignore key events when Ctrl is held
Fixes #4695
2021-09-23 14:34:39 -04:00
Ryan C. Gordon 0aff42a159
egl: Group data fields before function pointers in SDL_EGL_VideoData. 2021-09-23 00:03:26 -04:00
Ryan C. Gordon 0ad4956c06
egl: explicitly call eglBindAPI during SDL_GL_MakeCurrent.
The EGL API binding must be specified per-thread, per the docs.

Fixes #1820.
2021-09-23 00:03:25 -04:00
Ryan C. Gordon 3147716022
egl: make an int into an SDL_bool. 2021-09-23 00:03:25 -04:00
Sam Lantinga 4ec259a784 Fixed building on Visual Studio 2013 and older 2021-09-22 19:06:11 -07:00
Sam Lantinga 287571fb46 Limit effect of in_title_click and focus_click_pending to only blocking cursor warping; without this all relative mouse motion was getting ignored when a window was activated via a mouse button 2021-09-22 17:40:57 -07:00
Northfear 5292156398 End Scene on RunCommandQueue on Vita 2021-09-22 11:54:26 -07:00
Cameron Cawley 08ae790497 Replace calls to asprintf with SDL_asprintf 2021-09-22 11:53:46 -07:00
Cameron Cawley 25a614bc3e Add SDL_asprintf and SDL_vasprintf 2021-09-22 11:53:46 -07:00
Sam Lantinga 79b0aae86c The return value of SDL_snprintf is the number of characters that would have been written.
Fixes https://github.com/libsdl-org/SDL/issues/4762
2021-09-22 11:46:24 -07:00
Ethan Lee 9b74623be9 wayland: Woops, forgot to assign cursor theme size... 2021-09-22 13:52:36 -04:00
Ethan Lee 8e54698aa6 wayland: Add support for high-DPI cursors 2021-09-22 10:37:42 -07:00
Sam Lantinga 432ee7d8ad Fixed building SDL_dynapi.c without stdio support 2021-09-22 09:29:21 -07:00
Sam Lantinga 345c161feb Fixed some accidental uses of external C runtime functions 2021-09-22 09:06:45 -07:00
Sam Lantinga 5d455cabf9 Don't process raw input when the window is being dragged or clicked on. 2021-09-21 18:15:11 -07:00
Sam Lantinga 0fd54f91f4 Fixed using a tablet with raw input relative motion
Tested with a Wacom Cintiq Pro 16"
2021-09-21 18:15:11 -07:00
Sam Lantinga 8fee82d1fd Improve relative motion handling over RDP
CR and research: @danielj
2021-09-21 18:15:09 -07:00
Sam Lantinga eb3bf80f9c Fixed compiler warnings using Visual Studio 2019 2021-09-21 18:15:09 -07:00
Ryan C. Gordon ce11caa80f
alsa: Map 7.1 audio channels to match what Windows and macOS expect.
This matches what we did a long time ago for 5.1 audio.

Fixes #55.

(FIFTY FIVE. Bug reported 15 years, 3 months, and 11 days ago! lol)
2021-09-21 16:49:44 -04:00
pkubaj 9886d897e2 Fix AltiVec detection on FreeBSD
The previous code was not correct, because there's no PPC_FEATURE_HAS_ALTIVEC MIB.
Instead, elf vector check should be done.
2021-09-21 09:57:10 -07:00
Ryan C. Gordon c45facf2ca
alsa: clean up macro salsa a little. 2021-09-21 11:13:46 -04:00
Northfear 3b2fbb1cb7 End current scene before destroying the texture on Vita 2021-09-20 15:55:36 -07:00
Northfear fc4296c114 Use aligned stride in sceGxmColorSurfaceInit 2021-09-20 13:23:42 -07:00
Northfear 7080bc2a91 Fallback to SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE if CDRAM texture allocation fails 2021-09-20 13:23:42 -07:00
Ivan Epifanov 512355d7aa Vita: fix thread detach. Remove leftover KillThread 2021-09-20 11:03:02 -07:00
Ivan Epifanov ddcd847c8e Vita: fix thread priority Add support for thread name and stack size 2021-09-20 08:59:25 -07:00
Ryan C. Gordon 478f9eed28
x11: Don't include X11/extensions/extutil.h
We don't use it, it was a leftover from 1.2, I think, and it doesn't exist
on Solaris, so this should hopefully fix the build there.

This also means we don't need the configure/cmake checks for
SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY, so that was removed also.

Fixes #1666.
2021-09-20 10:22:50 -04:00
Ryan C. Gordon ca9a321715
render: GL/GLES now draw lines almost perfectly matching software renderer.
One place known to differ in a significant way is a single line segment that
starts and ends on the same point; the GL renderers will light up a single
pixel here, whereas the software renderer will not. My current belief is this
is a bug in the software renderer, based on the wording of the docs:

"SDL_RenderDrawLine() draws the line to include both end points."

You can see an example program that triggers that difference in Bug #2006.

As it stands, the GL renderers might _also_ render diagonal lines differently,
as the the Bresenham step might vary between implementations (one does three
pixels and then two, the other does two and then three, etc). But this patch
causes those lines to start and end on the correct pixel, and that's the best
we can do, and all anyone really needs here.

Not closing any bugs with this patch (yet!), but here are several that it
appears to fix. If no other corner cases pop up, we'll call this done.

Reference Bug #2006.
Reference Bug #1626.
Reference Bug #4001.
...and probably others...
2021-09-19 15:47:24 -04:00
Ryan C. Gordon 857cc7c0c9
render: constified some local variables in SDL_AllocateRenderVertices. 2021-09-19 00:38:06 -04:00
Ryan C. Gordon 5faea84c63
render: Mark viewport/cliprect dirty when window is resized.
Fixes #4751.
2021-09-18 11:54:25 -04:00
Cameron Gutman 5dccffd7e4 Allow usage of the new Condition Variable code with Critical Sections
Vista and later provide the SleepConditionVariableCS() function for this.

Since SDL_syscond_srw.c doesn't require SRW locks anymore, rename it to
SDL_syscond_cv.c which better reflects the implementation of condition
variables rather than the implementation of mutexes.

Fixes #4051.
2021-09-17 19:38:09 -04:00
Alex R ebdfd0e175 atomic: detect clang separately 2021-09-16 17:33:52 -07:00
Ivan Epifanov 8d1e0ca324 Vita: add support for disabling 'screensaver' (screen dimming and suspend) 2021-09-16 09:03:17 -07:00
Ivan Epifanov 79ec8986d3 Vita: refactor gxm texture render and add SDL_RenderGeometry support 2021-09-16 09:03:17 -07:00
Zach Reedy 2a8938f2bf
Fixed: Whitespace being striped from the end of IME strings incorrectly + Regression with SDL_SetTextInputRect (#4752)
* Fixed: Whitespace being striped from the end of IME strings incorrectly

* Fixed: Google IME Candidate Window not placing correctly

* Why are PostBuild events stored in the vcxproj and not a user file?

* Revert SDL.vcxproj properly...

* Remove whitespace as per code review

* Fix Werror=declaration-after-statement error in code
2021-09-15 09:40:22 -07:00
Ivan Epifanov ce177049f7 Vita: Allow completely skipping pvr init to override apphint from app 2021-09-14 16:20:50 -07:00
Misa 4a9947336c `SDL_RenderSetVSync()`: Restrict `vsync` to 0 or 1
In the future, we might want to support special swap intervals. To
prevent applications from expecting nonzero values of vsync to be the
same as "on", fail with SDL_Unsupported() if the value passed is neither
0 nor 1.
2021-09-14 16:18:02 -07:00
Misa 4549769d7d Add `SDL_RenderSetVSync()`
Currently, if an application wants to toggle VSync, they'd have to tear
down the renderer and recreate it. This patch fixes that by letting
applications call SDL_RenderSetVSync().

This is the same as the patch in #3673, except it applies to all
renderers (including PSP, even thought it seems that the VSync flag is
disabled for that renderer). Furthermore, the renderer flags also change
as well, which #3673 didn't do. It is also an API instead of using hint
callbacks (which could be potentially dangerous).

Closes #3673.
2021-09-14 09:56:29 -07:00
Ivan Epifanov b2504b5da6 Fix typos 2021-09-11 20:40:50 +03:00
Jaylon Gowie e455659467 Simplify Backspace and Enter 2021-09-10 19:49:47 -07:00
Jaylon Gowie f162d9ee23 Fix Indentation 2021-09-10 19:49:47 -07:00
Jaylon Gowie 058c4d36b2 Add envvar to disable touchpads independently 2021-09-10 19:49:47 -07:00
Jaylon Gowie 4435543db1 Add PVR On Screen Keyboard Support 2021-09-10 19:49:47 -07:00
Ivan Epifanov 10d3df44f1 Vita: fix copyright dates 2021-09-09 07:22:01 -07:00
Ivan Epifanov 2a83686071 Fix default path 2021-09-09 07:22:01 -07:00
Ivan Epifanov 134dd46819 Add pvr gles/gles2 context support 2021-09-09 07:22:01 -07:00
Sam Lantinga ff85d4fbe5 Fixed Xbox Series X controller being detected by both IOKit and GCController on macOS 2021-09-08 17:51:47 -07:00
Sam Lantinga 9f8552588d Added mapping for Xbox One S controller with newer firmware on macOS 2021-09-08 17:50:17 -07:00
Sam Lantinga bf97c5a22f Make sure SDL file descriptors don't leak into child processes 2021-09-08 14:47:40 -07:00
Ryan C. Gordon d49d955d73
render: SDL_RenderGeometry should still render when hidden, in most cases.
(otherwise render targets may fail, etc...the check is a legacy helper for
iOS apps that crash if you try to use OpenGL while in the background.)
2021-09-08 11:44:17 -04:00
Sam Lantinga 7d66fa209a Fixed double-copy of the report in BlueZ >= 5.56 2021-09-07 17:38:26 -07:00
Sam Lantinga 7ed7644a26 Fixed compiling HIDAPI Steam Controller support with C89 compiler 2021-09-07 17:37:47 -07:00
Sam Lantinga 27a48b142b Check the pathname first, as that's a faster check for XInput devices 2021-09-07 15:50:21 -07:00
Zach Reedy 6f97205229 Added: Support for showing the IME Candidate Window on Windows 2021-09-02 02:28:54 -10:00
Sylvain 183eb0673b
Fixed bug #4711: prevent opengl SDL_renderer from crashing if GL_ARB_multitexture isn't supported 2021-09-01 15:46:32 +02:00
Rokas Kupstys 515b7e93b5 Fix horizontal wheel scroll direction of X11. 2021-09-01 03:25:49 -10:00
David Gow a1ffeda0ed Add SDL_HINT_APP_NAME and DBUS inhibition hint
See SDL bug #4703. This implements two new hints:
- SDL_APP_NAME
- SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME

The former is the successor to SDL_HINT_AUDIO_DEVICE_APP_NAME, and acts
as a generic "application name" used both by audio drivers and DBUS
screensaver inhibition. If SDL_AUDIO_DEVICE_APP_NAME is set, it will
still take priority over SDL_APP_NAME.

The second allows the "activity name" used by
org.freedesktop.ScreenSavver's Inhibit method, which are often shown in
the UI as the reason the screensaver (and/or suspend/other
power-managment features) are disabled.
2021-08-30 09:15:11 -04:00
Lee Salzman 9fae8f7088 Treat empty SDL_VIDEODRIVER var to check all video drivers. 2021-08-30 05:00:51 +03:00
Lee Salzman 7d90df0ece Restore previous behavior of empty SDL_AUDIODRIVER trying all drivers.
The recent change to make SDL_AUDIODRIVER support comma-separated lists
broke the previous behavior where an SDL_AUDIODRIVER that was empty
behaved the same as if it was not set at all. This old behavior was
necessary to paper over differences in platforms where SDL_setenv may
or may not actually delete the env var if an empty string is specified.
This patch just adds a simple check to ensure SDL_AUDIODRIVER is not
empty before using it, restoring the old interpretation of the empty
var.
2021-08-30 05:00:51 +03:00
Sam Lantinga 8b1f8b6ec5 Use the high speed alternate setting on new Microsoft Xbox controllers 2021-08-27 11:14:09 -07:00
Sylvain 1fe9ad04be
SDL_ConvertSurface: add an intermediate variable to remove static analysis false positive (see bug #4600) 2021-08-27 14:09:47 +02:00
Sylvain be6bee0b5a
SW_RenderGeometry: add a redundant check to clear static analysis (see bug #4600) 2021-08-27 07:47:28 +02:00
Sylvain 54ca1d190e
SW_RenderGeometry: add a redundant check to clear static analysis (see bug #4600) 2021-08-27 07:44:03 +02:00
Sylvain b17aa5d080
SW_RenderGeometry: remove a few static analysis false positives (see bug #4600) 2021-08-27 07:16:40 +02:00
David Gow 3261f7f6ce audio: Support "pulse" as an alias for "pulseaudio"
Originally, SDL 1.2 used "pulse" as the name for its PulseAudio driver.
While it now supports "pulseaudio" as well for compatibility with SDL
2.0 [1], there are still scripts and distro packages which set
SDL_AUDIODRIVER=pulse [2]. While it's possible to remove this in most
circumstances or replace it with "pulseaudio" or a comma-separated list,
this may still conflict if the environment variable is set globally and
old binary builds of SDL 1.2 (e.g. packaged with older games) are being
used.

To fix this on SDL 2.0, add a hardcoded check for "pulse" as an audio
driver name, and replace it with "pulseaudio". This mimics what SDL 1.2
does (but in reverse). Note that setting driver_attempt{,_len} is safe
here as they're reset correctly based on driver_attempt_end on the next
loop.

[1] d951409784
[2] https://bugzilla.opensuse.org/show_bug.cgi?id=1189778
2021-08-25 22:43:32 -10:00
Sam Lantinga 503ea8e89f Don't modify the Nintendo Switch home LED state by default 2021-08-25 14:42:16 -07:00
Vanfanel b1e492d1fc Search for an appropiate plane instead of simply using the first one. 2021-08-25 10:51:26 -10:00
Eric Engestrom 23ffa3d914 Update SDL's copy of the EGL headers from Khronos 2021-08-25 10:50:21 -10:00
Ethan Lee 524964f966 Add SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY 2021-08-25 16:40:02 -04:00
Eric Engestrom 5113fedfa0 video/wayland: use EGL_EXT_present_opaque when available 2021-08-25 16:40:02 -04:00
Sam Lantinga 130b6bebae Manually scan for Linux joysticks before udev scan runs
This allows us to have joysticks sorted by insert time at startup, fixing https://github.com/libsdl-org/SDL/issues/4688
2021-08-24 17:03:19 -07:00
Sam Lantinga cbccf5bb50 Use SDL_GetHint() instead of SDL_getenv() for Linux joystick hints 2021-08-24 17:03:19 -07:00
Shawn Ellis 0ae2a9f8c3 Fixed the Atari gamecontroller mappings and added Atari Xbox 360
This change corrects the mappings for the Atari gamecontroller and
adds support for the Atari Xbox 360 compatible gamecontroller. The Atari
game controller can switch between Atari and Xbox 360 mappings.
2021-08-24 13:06:27 -10:00
Ryan C. Gordon d5fe9c308a x11: Log a warning if we decide to use XVidMode.
Reference issue #1782.
2021-08-24 14:29:39 -04:00
Ryan C. Gordon 9504bb121d
pulseaudio: Fix some function signatures that expect const pointers.
This might have changed at some point in the Pulse API, or this might have
always been wrong, but we didn't notice because the dynamic loading code
hides it by casting things to void *. The static path, where it
assigns the function pointer directly, puts out a clear compiler warning,
though.
2021-08-23 00:47:25 -04:00
Sylvain e426bb80cb
Fixed bug #4671 - D3D_QueueGeometry: use "count / 3" (Thanks alittlesail!) 2021-08-20 07:50:30 +02:00
Oschowa 70c23b25f0 audio: pipewire: Reset hotplug atomic variables on deinit. 2021-08-19 22:26:25 -04:00
Sylvain ae5336a3d2
Fixed bug #4669: D3D_QueueGeometry: -0.5f offset position of vertexs
This similar to D3D_QueueCopy positions
2021-08-19 14:03:10 +02:00
Ozkan Sezer 8270172e74 fix -Wshorten-64-to-32 warnings in android builds.
see: https://github.com/libsdl-org/SDL/pull/4195#issuecomment-901506386
2021-08-19 12:11:10 +03:00
Ozkan Sezer ccb06296b9 SDL_windowsevents.c: fix build against older SDKs. 2021-08-19 03:15:02 +03:00
Sylvain 154384a776 Add (uintptr_t) casts 2021-08-19 00:10:59 +02:00
Sylvain 08d6a4653e Fix dynapi prototypes 2021-08-19 00:10:59 +02:00
Sylvain 1670104ad8 Change 'size_indice' to 'size_indices' 2021-08-19 00:10:59 +02:00
Sylvain a8f89a01aa Change 'size_indice' to 'size_indices' 2021-08-19 00:10:59 +02:00
Sylvain 47db47c1cc Add SDL_HAVE_RENDER_GEOMETRY to compile or not with RenderGeometry support 2021-08-19 00:10:59 +02:00
Sylvain b9bd9da78f OpenGLES2: transfert color as 4 bytes, instead of 4 floats 2021-08-19 00:10:59 +02:00
Sylvain Becker c6ceaaeb4b METAL: use Uchar4Normalized format to transfert color as 4 bytes, instead of 4 floats 2021-08-19 00:10:59 +02:00
Sylvain eff840bb9b Add OpenGLES implementation 2021-08-19 00:10:59 +02:00
Sylvain 32e7910135 Fix warnings 2021-08-19 00:10:59 +02:00
Sylvain 6e47f53869 Fix warnings 2021-08-19 00:10:59 +02:00
Sylvain 4869a3d294 Add Direct3D9 implementation (not tested) 2021-08-19 00:10:59 +02:00
Sylvain 4ba3763897 Save and restore SDL renderer state after transforming triangles to rect 2021-08-19 00:10:59 +02:00
Sylvain cd0663e053 Fix declaration-after-statement and remove tabs 2021-08-19 00:10:59 +02:00
Sylvain Becker cd4663dfcb Update D3D11 for SDL_RenderGeometryRaw 2021-08-19 00:10:59 +02:00
Sylvain Becker 9f59170743 Update METAL backend for SDL_RenderGeometryRaw 2021-08-19 00:10:59 +02:00
Sylvain 61d9e9164f For the software renderer, try to reinterpret triangles as SDL_Rect
With Dear ImGui + software renderer, it draws:
- by default at 250 fps
- drops to 70 fps if you show the color picker
- drops to 10 fps if put the color picker fullscreen
2021-08-19 00:10:59 +02:00
Sylvain cc37c38e30 Add SDL_RenderGeometry based on SDL_RenderGeometryRaw 2021-08-19 00:10:59 +02:00
Sylvain e481261173 Move to SDL_RenderGeometryRaw prototype with separate xy/uv/color pointer parameters 2021-08-19 00:10:59 +02:00
Sylvain 111c70e141 Use 64 bits precision to prevent overflow when interpolating color / texture with wide triangles 2021-08-19 00:10:59 +02:00
Sylvain f73c1eff10 Use normalized texture coordinates 2021-08-19 00:10:59 +02:00
Sylvain 5828cc415a Update METAL backend: fix a typo in drawline 2021-08-19 00:10:59 +02:00
Sylvain 9eab5195fe Update dynapi files 2021-08-19 00:10:59 +02:00
Sylvain Becker 9a8a8e65b8 Update SDL_render_d3d11.c
Fix D3D11 compilation
2021-08-19 00:10:59 +02:00
Sylvain Becker 121114d061 Update METAL compiled shaders 2021-08-19 00:10:59 +02:00
Sylvain Becker 2d01573bb9 Add METAL shaders 2021-08-19 00:10:59 +02:00
Sylvain Becker 1e77dae7b7 Add METAL implementation 2021-08-19 00:10:59 +02:00
Sylvain 1ebef0732a Add D3D11 implementation (not yet tested) 2021-08-19 00:10:59 +02:00
Sylvain 3ee511d71c Add software renderer implementation 2021-08-19 00:10:59 +02:00
Sylvain 37f78fc1cc Add OpenGL implementation 2021-08-19 00:10:59 +02:00
Sylvain faded41ab1 Add OpenGLES2 implementation 2021-08-19 00:10:59 +02:00
Sylvain 6e26d320c6 Add sysrender interface 2021-08-19 00:10:59 +02:00
Sylvain 53a2608bd2 Renderer opengles2: turn color Uniform into Attribute.
all attributes are copied interleaved (based on rmg-nik initial patch+
+ minor clean up of data structure
+ add check for colorswap
2021-08-19 00:10:59 +02:00
Oschowa bfa159313b audio: pipewire: Set PW_KEY_NODE_RATE to suggest a rate.
This can be used by recent pipewire to avoid resampling.
2021-08-18 12:40:13 -04:00
Aleksey Rybalkin 402b86f2a8 waylandevents: prevent segfault if xkb compose table is not found
this can happen e.g. on pure wayland system where there is no X11
locales for xkbcommon to find.
2021-08-15 10:11:19 -04:00
Jānis Rūcis 454943cf3e emscripten: Don't flag window fullscreen on external requests
Also, the condition was always true.
2021-08-14 17:04:46 +01:00
Joseph Kogut 55af8dcad9 emscripten: use emscripten_set_window_title api 2021-08-14 17:04:46 +01:00
Joseph Kogut d8baad7e48 emscripten: use emscripten_get_screen_size api 2021-08-14 17:04:46 +01:00
Charlie Birks abc04270b7 emscripten: Fix framebuffer array creation optimisation 2021-08-14 17:04:46 +01:00
Charlie Birks b4f11a3669 emscripten: Drop commented out code from the dummy driver 2021-08-14 17:04:46 +01:00
David Gow fbc364908a Use the new SDL_clamp() macro where sensible
There were a few places throughout the SDL code where values were
clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp()
macro, use this instead.
2021-08-14 09:01:14 -07:00
Charlie Birks 07a2d71e90 emscripten: Feed silence to device when paused 2021-08-14 12:24:35 +01:00
Sam Lantinga dcc5eef0e2 Clarify that one of the PIDs of the Xbox Elite Series 2 controller is used in Bluetooth mode 2021-08-14 00:31:46 -07:00
Sam Lantinga 91a55a02de Relative mouse motion is delivered to the window with keyboard focus
This was the original intent (note SDL_UpdateWindowGrab() in SDL_OnWindowFocusGained() and SDL_OnWindowFocusLost()) and fixes a bug where relative motion unexpectedly stops if the task bar is covering the bottom of the game window and the mouse happens to move over it while relative mode is enabled.

Another alternative would be to confine the mouse when relative mode is enabled, but that generates mouse motion which would need to be ignored, and it's possible for the user moving the mouse to combine with the mouse moving into the confined area so you can't easily tell whether to ignore the mouse motion. See https://github.com/libsdl-org/SDL/issues/4165 for a case where this is problematic.
2021-08-14 00:00:57 -07:00
Sam Lantinga 694771513c Get the window size for the window receiving the mouse motion
This is the mouse focus except in the case where relative motion is enabled and the mouse is over a window floating on top of the application window (e.g. the taskbar)
2021-08-14 00:00:57 -07:00
Sam Lantinga 6a1e1ed9ae Relative mouse mode grab is based on the window with the input focus
This fixes restoring the cursor clip rectangle after the mouse has moved off of the window.

Also try to better synchronize cursor visibility with mouse position changes when changing relative mode. This doesn't work perfectly, but it seems to improve things on Windows.
2021-08-14 00:00:57 -07:00
Sam Lantinga e42e9a12de Fixed build 2021-08-13 20:48:56 -07:00
Sam Lantinga 441fbcaa3d Added HIDAPI support for the Xbox Adaptive Controller 2021-08-13 20:48:54 -07:00
Sam Lantinga b5e5c1ef48 Added Ctrl-T to toggle topmost mode in test programs 2021-08-13 17:53:39 -07:00
Sam Lantinga 4d9efcb55c Fixed flag test for boolean correctness 2021-08-13 11:52:25 -07:00
Sam Lantinga b28ed02803 Don't warp the mouse for relative mode when the window doesn't have focus 2021-08-13 11:39:41 -07:00
Sam Lantinga 629e9f820a Fixed return value of SDL_GetGrabbedWindow() when we have an internal grab because of mouse relative mode 2021-08-13 11:06:43 -07:00
Sam Lantinga 6aa1498b98 This assert wasn't correct, we set the internal grab for mouse relative mode as well. 2021-08-13 11:03:19 -07:00
Sam Lantinga 907943a236 Added support for the Xbox One S Controller with 5.x series firmware 2021-08-12 17:51:08 -07:00
Joshua Root 1e92135297 Improve portability of SDL_Convert51ToStereo_AVX
Don't rely on checking __clang_major__ since it is not comparable
between different vendors. Don't use "#pragma clang attribute" since it
is only available in relatively recent versions, there's no obvious way
to check if it's supported, and just using __attribute__ directly (for
gcc as well) results in simpler code anyway.
2021-08-12 16:04:35 -07:00
Ozkan Sezer 7aec0b90ee SDL_hidapi_xboxone.c: fix bogus 'uninitialized' warning from clang.
The last 'size == 50' check is always true anyway.
2021-08-13 01:56:56 +03:00
Sam Lantinga cec5a129f5 Fixed libudev hotplug notifications in the HIDAPI driver 2021-08-12 15:49:33 -07:00
Sam Lantinga 6eb4ebb502 Simplified the HIDAPI Xbox One controller initialization 2021-08-12 15:49:33 -07:00
Simon McVittie 25cd749adb x11: Don't change mode if we are already in the correct mode
If we are already in the desired mode, changing it is a no-op at best,
and harmful at worst: on Xwayland, it sometimes happens that we disable
the crtc and cannot re-enable it.

Resolves: https://github.com/libsdl-org/SDL/issues/4630
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-12 12:23:40 -07:00
Sam Lantinga 584b89abe6 Added support for the color LED on the Xbox Elite Series 2 controller 2021-08-12 08:17:10 -07:00
Sam Lantinga 64882b2466 Added support for the Xbox One Elite 2 Controller with 5.x series firmware 2021-08-12 08:17:08 -07:00
Ozkan Sezer ed6eb07e79 SDL_wasapi.c: fixed build against older SDKs. 2021-08-12 01:40:50 +03:00
Andrei Alexeyev 68ca35c318 wayland: fix memleak in output listener 2021-08-11 14:11:52 -07:00
Andrei Alexeyev e9179314c4 joystick/linux: fix memleaks; streamline joylist item removal 2021-08-11 14:11:52 -07:00
Ozkan Sezer 44a76710d1 Don't disable clang avx instrinsics on win32 if __AVX__ is defined.
C.f.: https://github.com/libsdl-org/SDL/issues/4533
2021-08-11 08:47:52 -07:00
Ethan Lee ae7ee2a59c wayland: Ignore stateless/sizeless configs when starting in fullscreen mode 2021-08-11 11:02:33 -04:00
Sam Lantinga ac32c522ad Try using the built-in WASAPI audio rate conversion
Fixes https://github.com/libsdl-org/SDL/issues/4608
2021-08-10 18:11:09 -07:00
Sam Lantinga cb1e20b058 Added KMOD_SCROLL to track the scroll lock state
Fixes https://github.com/libsdl-org/SDL/issues/4566
2021-08-10 17:50:17 -07:00
Sam Lantinga f5794f9eeb Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate a user-specified pointer with an SDL texture 2021-08-10 15:17:59 -07:00
Sam Lantinga a0af7ce731 OSS is no longer the preferred audio backend on modern UNIX systems
Fixes https://github.com/libsdl-org/SDL/issues/4207
2021-08-10 15:05:49 -07:00
Sam Lantinga 3f6ebffff4 Updated to version 2.0.17 for development 2021-08-10 15:02:36 -07:00
Sam Lantinga 016b02f24c Fixed build, C89 doesn't allow non-constant static initializers 2021-08-10 12:17:37 -07:00
Ozkan Sezer 77c8d11137 configuration updates for dlopen:
- cmake, configure (CheckDLOPEN): --enable-sdl-dlopen is now history..
  detach the dl api discovery from SDL_LOADSO_DLOPEN functionality.
  define HAVE_DLOPEN. also define DYNAPI_NEEDS_DLOPEN (CheckDLOPEN is
  called only for relevant platforms.)
- update SDL_config.in and SDL_config.cmake accordingly.
- SDL_dynapi.h: set SDL_DYNAMIC_API to 0 if DYNAPI_NEEDS_DLOPEN is
  defined, but HAVE_DLOPEN is not.
- pthread/SDL_systhread.c: conditionalize dl api use to HAVE_DLOPEN
- SDL_x11opengl.c, SDL_DirectFB_opengl.c, SDL_naclopengles.c: rely
  on HAVE_DLOPEN, not SDL_LOADSO_DLOPEN.
- SDL_config_android.h, SDL_config_iphoneos.h, SDL_config_macosx.h,
  SDL_config_pandora.h, and SDL_config_wiz.h: define HAVE_DLOPEN.

Closes: https://github.com/libsdl-org/SDL/pull/4351
2021-08-10 12:07:32 -07:00
hgs3 cb0fd05eeb Adding a clarifying comment in case a programmer unfamiliar with UTF-16 and UTF-32's relationship chances upon the code. 2021-08-10 12:07:11 -07:00
Henry G. Stratmann III 3470112969 Optimizing the implementation. 2021-08-10 12:07:11 -07:00
Henry G. Stratmann III 712e0d1f06 Fixing WM_CHAR event handling for Unicode characters outside the Basic Multilingual Plane. 2021-08-10 12:07:11 -07:00
Sam Lantinga fcfd19db86 Added support for SDL_RENDERER_PRESENTVSYNC to the software renderer
This fixes https://github.com/libsdl-org/SDL/issues/4612
2021-08-10 12:02:59 -07:00
Sebastian Krzyszkowiak 25f9ed87ff audio: Fix false positives in driver name comparison
Without this change, driver names don't get matched correctly;
for example "a" can get matched with "alsa" since it only checks
whether the string matches up to the length of the requested
driver name.
2021-08-10 08:34:07 -07:00
Sebastian Krzyszkowiak b3a989d0df video: Fix false positives in driver name comparison
Without this change, driver names don't get matched correctly;
for example "x" can get matched with "x11" since it only checks
whether the string matches up to the length of the requested
driver name.
2021-08-10 08:34:07 -07:00
Sam Lantinga de6ba40d9e Added support for the Flydigi Vader 2 controller in 2.4G Android mode 2021-08-09 11:38:22 -07:00
Sam Lantinga 3f440daad9 Added support for the Flydigi Vader 2 controller in Bluetooth mode 2021-08-09 10:40:36 -07:00
Cameron Gutman 6ae227d011 x11/wayland: fix screensaver suspension via D-Bus
b08b1bde introduced a subtle bug. Despite not using D-Bus types directly,
the code used the SDL_USE_LIBDBUS definition set by SDL_dbus.h to conditionally
compile calls SDL_DBus_ScreensaverTickle() and SDL_DBus_ScreensaverInhibit().
As a result, it still compiled without SDL_dbus.h included, but screensaver
suspension silently failed to work.

The D-Bus stuff could probably use some tweaks to be harder to accidentally
break, but for now just restore the header includes.
2021-08-08 23:47:42 -05:00
Sebastian Krzyszkowiak 2e6dac870f wayland: Add a hint to allow disabling libdecor use
Useful for testing xdg-shell path with compositors like Weston.
2021-08-08 18:05:47 -07:00
Cameron Gutman 092a20d945 wayland: Avoid busy waiting for vsync 2021-08-08 18:04:08 -07:00
Cameron Gutman 791d9d3ff6 Fixed DInput mapping for NVIDIA Virtual Gamepad 2021-08-07 14:20:43 -07:00
Ethan Lee 7be970db31 wayland: Avoid setting floating width/height when re-entering fullscreen 2021-08-06 19:51:27 -04:00
Sam Lantinga bec783571b Better fix for compiling using clang on Windows
This fixes https://github.com/libsdl-org/SDL/issues/4533
2021-08-06 14:20:55 -07:00
Sam Lantinga a91ab883e9 Fixed building on Windows with cmake, ninja, and clang 2021-08-06 12:28:24 -07:00
Ryan C. Gordon dd683073bb
hidapi: Patched to compile on QNX.
Fixes #4591.
2021-08-06 15:13:40 -04:00
Sam Lantinga cae7bd9b65 Don't use AVX with clang if the compiler isn't building with AVX instructions
Fixes https://github.com/libsdl-org/SDL/issues/4533
2021-08-06 12:01:24 -07:00
Ethan Lee 10979d37fb wayland: Always assume configure is wrong for non-resizable windows.
Configure events from compositors have an extremely annoying habit of giving us
completely bogus sizes, from all sorts of places. Thankfully, the protocol
gives us the ability to completely ignore the width/height and just stick with
what we know, so for all windows that are not meant to be resized, pretend we
never even got the width/height at all, the compositor is required to respect
our dimensions whether they match configure's suggestion or not.
2021-08-05 17:19:11 -04:00
Sam Lantinga 88674b4a0e Fixed build 2021-08-04 13:17:35 -07:00
Sam Lantinga c14813a879 Fixed spacing 2021-08-04 13:00:14 -07:00
Sam Lantinga 3cad447ee7 Only update the window size if setting the display mode succeeded 2021-08-04 12:57:51 -07:00
Daniel Gibson 0eb6f79190 SDL_SetWindowDisplayMode(): If already fullscreen, adjust window size
Otherwise only the display resolution is changed, but the SDL window size
(and for example the window-surface size) aren't adjusted accordingly
and thus don't fill the whole screen.
See #3313
2021-08-04 12:48:48 -07:00
Daniel Gibson 72d8128520 Improve SDL_CreateWindow() fullscreen support on Windows
.. and maybe other platforms as well (though X11 was not affected)?

The issue was that passing a higher resolution than the current desktop
resolution to SDL_CreateWindow() with SDL_WINDOW_FULLSCREEN didn't switch
to that resolution (even though it did switch to lower resolutions).

When creating a fullscreen window, window->fullscreen wasn't even set
at all (only zeroed out), setting it only happened if the user explicitly
called SDL_SetWindowDisplayMode(). So without that, SDL_CreateWindow()
-> SDL_UpdateFullscreenMode() -> SDL_GetWindowDisplayMode() used the
resolution from window->windowed.w/h which were limited to the desktop size
due to some weird combination of WIN_AdjustWindowRectWithStyle() and
WIN_WindowProc() being called after a call to SetWindowPos().

fixes #3313
2021-08-04 12:48:48 -07:00
Sam Lantinga 9fdb06450d Added support for the Joy-Con Charging Grip when SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is enabled 2021-08-04 11:34:06 -07:00
Ryan C. Gordon d483970262
dbus: Wrap init in a spinlock.
This prevents a race if two threads that need d-bus try to init it at the
same time. Note that SDL_Init will likely handle this from a single thread
at startup, but there are places outside of init where one might trigger
D-Bus init, like setting thread priority (a common first thing for a new
thread to do) resulting in SDL trying to use RTKit.

Fixes #4587.
2021-08-04 13:30:12 -04:00
Cameron Gutman b08b1bde66 linux: remove d-bus lazy init dead code
Lazy init in X11/Wayland is dead code since dbdbae4
2021-08-04 13:14:57 -04:00
Ryan C. Gordon 5fc13fcb21 direct3d: Commit viewport state before clearing, attempt 2.
This reintroduces the fix from 0e16ee8330, but just marks
the viewport state as dirty after a clear that needs to expand the
viewport to fill the render target, as we'll need to also reset
the orthographic projection state elsewhere, and that won't
happen if we clear the dirty flag here.

Fixes #4210.
(again.)
(...sorry...!)
2021-08-04 07:00:17 -04:00
Ryan C. Gordon ed6ce5ccb0
log: Fixed compiler warnings on 64-bit Visual Studio. 2021-08-04 02:34:09 -04:00
Ryan C. Gordon 7e88e772d7
winrt: Fixed incorrect code in a Windows Phone #ifdef. 2021-08-04 02:30:47 -04:00
Ethan Lee 32f909f7e3 wayland: Remove redundant waylanddyn.h includes.
All files including waylanddyn.h already include waylandvideo.h first.
2021-08-03 14:57:22 -04:00
Ethan Lee 124405a0bc wayland: Fix building without Vulkan support 2021-08-03 14:57:22 -04:00
David Gow 4077f7a2d9 Update the Renderer dpi_scale on SIZE_CHANGED event (fix #4580)
The Renderer logical scaling code scales mouse coordinates, and needs to
take the window DPI into account on HIGHDPI windows. However, the
variable which tracks this, renderer->dpi_scale, is set once when the
renderer is created, and then not updated. In the event that the window
is moved to another screen, or the screen DPI otherwise changes, this
will be outdates, and potentially the coordinates will be all wrong.

So let's update the dpi_scale on the SIZE_CHANGED event: it's at least a
possibility that this will be issued on some OSes when DPI changes, and
it's otherwise already handled by SDL_Renderer's event filter.
2021-08-03 09:30:43 -07:00
Sam Lantinga 9b4884d58a Warn if you're building a partially functional RAWINPUT driver without device notifications 2021-08-03 09:25:14 -07:00
Sam Lantinga 886eb02eba Fixed detection of Steam Virtual Gamepad with the WGI driver 2021-08-03 09:25:14 -07:00
Sam Lantinga 7c63e1d37a Added WGI mappings for the Amazon Luna and Google Stadia controllers 2021-08-03 09:25:14 -07:00
Sam Lantinga 99c8972b25 Added WGI mappings for PS4 and PS5 controllers 2021-08-03 09:25:14 -07:00
Sam Lantinga 2dfc92ca1e Added default mapping for WGI game controllers 2021-08-03 09:25:13 -07:00
Sam Lantinga 9d64e6b442 Revert "direct3d: Commit dirty viewport state before clearing."
This reverts commit 0e16ee8330.
2021-08-03 00:29:33 -07:00
Sam Lantinga 993a56766d Only use the default Xbox mapping on Linux
On Windows, this is already covered by XInput and is the wrong mapping if we try to use it with DirectInput/RAWINPUT/WGI controllers
2021-08-03 00:15:24 -07:00
Ryan C. Gordon 0e16ee8330 direct3d: Commit dirty viewport state before clearing.
Otherwise you might have set the viewport to the full size of
the render target in SDL's API but this change hasn't been
transmitted to Direct3D yet by the time we attempt to clear.

Fixes #4210.
2021-08-03 02:32:56 -04:00
Sam Lantinga 7edc7d5392 Added a mapping for the Steam Virtual Gamepad when it's detected in DirectInput mode 2021-08-02 22:45:07 -07:00
Ryan C. Gordon 350ca0f908 winrt: Don't register orientation hint callback in startup code.
SDL_AddHintCallback() uses SDL_malloc(), which means this would
run before main(), so the app wouldn't be able to supply its own
replacement SDL_malloc() implementation in time.

This code was moved to under SDL_Init. Since the hint callback
already makes efforts to not override the app manifest's
orientation settings, this is safe to move until after pre-main()
startup.

Fixes #4449.
2021-08-03 05:07:39 -04:00
Ryan C. Gordon 834a84fabb winrt: Don't use LoadLibraryA on WinRT.
This removes the CM_Register_Notification code on WinRT. Note
that this API _is_ available to UWP apps as of Windows 10.0.17763
(version 1809, released October 2018), according to:

https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-devices-config-l1-1-1dll

So it might be worth readding with some sort of preprocessor check
for minimum targeted version, or whatever is appropriate for WinRT
development.
2021-08-03 05:07:39 -04:00
Ethan Lee 7082fb04af wayland: Only dispatch on fullscreen set when the window is visible.
Fixes hang-on-startup described in #4572.
2021-08-02 22:42:30 -04:00
Ethan Lee 0f5b8a99f0 wayland: For libdecor, dispatch immediately after setting fullscreen
Reference: #4578
2021-08-02 19:48:31 -04:00
Sam Lantinga 022235012c Fixed crash if WGI didn't give us the name for a controller 2021-08-02 16:40:58 -07:00
Ethan Lee 4562da622c wayland: Make libdecor configure match xdg_toplevel 2021-08-02 18:56:14 -04:00
Ethan Lee 1fb1aa1983 wayland: Keep the fullscreen check for maximize/restore events 2021-08-02 12:57:28 -04:00
Ethan Lee 584673a5a1 wayland: Don't ignore configs for non-fullscreen, non-resizable windows.
This was causing configure events to not inform SDL of window size
changes, even when they were based on resizes that we fully expected. The
result was fullscreen->windowed not working at all, because it would
retain the desktop resolution instead of reverting to the floating size
that it had before moving to fullscreen mode.

Fixes Super Hexagon fullscreen toggling.
2021-08-02 12:54:39 -04:00
Sebastian Krzyszkowiak 2506729893 wayland: Flush in SetWindowFullscreen
The flush has been removed in e5f9fae034.
Unfortunately, even though ideally the flush shouldn't be necessary,
our resize sequence isn't... well, perfect, and removing that flush causes
tons of troubles.

We're also still flushing in other paths where the window size can be
changed by the compositor and where we may potentially have to obey that
change, like in Wayland_MaximizeWindow.

This also removes the hack introduced in 7f261d3b76,
which introduces problems with protocol violations and seems to not be
necessary when flushing.
2021-08-02 12:18:23 -04:00
Sebastian Krzyszkowiak ea28187cd5 wayland: Hack surface resize into compliance with set_window_geometry
We have issues with correct resize sequence and happen to commit old-sized
buffers even after configure event for the new size has been already
acknowledged. While the reason for that stays unknown, let's at least
workaround the problem by faking window geometry into expected size.
This does not fix visual glitch on e.g. fullscreen toggling, but having
a split-second glitch is still a much better outcome than being
terminated by the compositor for protocol violation.
2021-08-02 12:18:23 -04:00
Sebastian Krzyszkowiak b5210cac44 wayland: Initialize floating size at window creation
This allows the windowed size to be restored for windows initially
created already in non-floating state.
2021-08-02 12:11:06 -04:00
Ethan Lee dab33844e3 wayland: Fix a warning in handle_configure_xdg_toplevel 2021-08-02 12:05:13 -04:00
Ethan Lee 754aa2d321 Mostly revert cfcdfb7be9.
This was causing window changes to completely break, resulting in broken
decorations and bizarre frame timing, I don't know what exactly it's doing
but it's not good. Kept the libdecor_frame_is_floating logic, at least.
2021-08-02 12:05:10 -04:00
Ethan Lee 8803589fc3 wayland: Avoid redundant SetWindowBordered for libdecor 2021-08-02 12:05:06 -04:00
Sebastian Krzyszkowiak b4c4060ad2 wayland: Clean up Wayland_HandlePendingResize
Commit 871c11191b removed delayed
resize handling, but it left the whole structure untouched that
now became unnecessary. To help with code clarity, get rid
of the structure where pending resize state used to be stored
and pass all the data directly to Wayland_HandlePendingResize
(now renamed to Wayland_HandleResize, since it's not "pending"
anymore but applied immediately)
2021-08-01 21:07:51 -07:00
Sebastian Krzyszkowiak 9bb24ad0cf wayland: Always call Wayland_SetWindowBordered when showing the window
Otherwise our windows have no window decoration on compositors that
support xdg-decoration-unstable-v1, but default to client-side mode.

Contrary to what the comment was stating, there is nothing in the protocol
that would make redundant calls to zxdg_toplevel_decoration_v1::set_mode
problematic.
2021-08-01 21:07:14 -07:00
Christian Rauch cfcdfb7be9 libdecor: use same fullscreen/maximised restore logic as for xdg-toplevel 2021-08-01 15:14:44 -07:00
Christian Rauch 42452f8ca5 wayland: store and restore floating states
Some Wayland compositors send (0,0) as "suggested" configure event sizes to
indicate that the client has to decide on its own which sizes to used. This
is commonly done when restoring from maximised, fullscreen or tiles states
to fullscreen.
We now store the last known floating states in a new set of variables and
restore them when we receive such a (0,0) configure event.
2021-08-01 15:14:44 -07:00
Sebastian Krzyszkowiak d4e1b4974a unix: OpenURL: Move unsetenv above vfork
From the vfork manpage:

> The  vfork()  function has the same effect as fork(2), except that
> the behavior is undefined if the process created by vfork() either
> modifies any data other than a variable of type pid_t used to store
> the return value from vfork(), or returns from the function in which
> vfork() was called, or calls any other function before successfully
> calling _exit(2) or one of the exec(3) family of functions.

unsetenv is still called inside a child process, so it does not
influence the rest of the application.
2021-08-01 03:58:49 -07:00
Sam Lantinga 9b7b928765 Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam
This fixes https://github.com/libsdl-org/SDL/issues/4565
2021-07-31 23:28:59 -07:00
Sebastian Krzyszkowiak 54aea2446e wayland: Disable key repeat when repeat rate equals 0
This fixes a crash on pressing keyboard button when compositor sends
zero as repeat rate, indicating that key repeat should be disabled.

From Wayland protocol spec:

> Negative values for either rate or delay are illegal. A rate of zero
> will disable any repeating (regardless of the value of delay).
2021-07-31 21:40:27 -07:00
Sam Lantinga b033cd0d2e Fixed XSync sequence to match other cases where we set the X11 error handler 2021-07-31 16:01:48 -07:00
Ryan C. Gordon 4c7825f6bd
x11: XSync while trying to catch XRRSetScreenSize error.
Reference issue #4561
2021-07-31 18:27:14 -04:00
Sam Lantinga cb1fd30e9a Updated to version 2.0.16 for release 2021-07-31 13:28:54 -07:00
Ryan C. Gordon d0effadf68
x11: Don't let XRRSetScreenSize fire a BadMatch error.
This is a workaround and not a proper fix, but this is possibly complicated,
and possibly a corner case, so this will do for 2.0.16, if not the
foreseeable future.

Reference issue #4561
2021-07-31 15:58:31 -04:00
Sam Lantinga 3a4b217d6c Allow defining SDL_MAIN_HANDLED on iOS if you're using another runtime that provides an application delegate 2021-07-31 12:44:29 -07:00
Sam Lantinga deed21a83d Removed useless forward declaration 2021-07-31 12:44:11 -07:00
Ethan Lee e5594e6677 wayland: Prefer our SSD implementation if available 2021-07-30 22:19:48 -07:00
Sam Lantinga 2d0075eff8 Updated comments for third party Nintendo Switch controllers 2021-07-30 18:23:43 -07:00
Sam Lantinga 16010f7561 Added support for the PowerA Nintendo Switch Fusion Arcade Stick 2021-07-30 18:23:43 -07:00
Sam Lantinga b33f470901 Fixed detection of the PDP Afterglow Wireless Switch Controller over Bluetooth 2021-07-30 18:23:42 -07:00
Sam Lantinga 6af6950dbc Added support for the Victrix Gambit Tournament Controller 2021-07-30 18:23:42 -07:00
Sam Lantinga 243a8836af The PowerA Nintendo Switch Fusion Pro Controller has a working USB mode, enabled via the switch on the underside of the controller. 2021-07-30 18:23:41 -07:00
Ethan Lee 71897cc1c9 wayland: Always trigger a resize when handling a configure event.
When we removed the OpenGL resize workaround it introduced a problem for
fullscreen windows in particular: When leaving fullscreen we tried to send a
resize event, but UpdateFullscreenMode would send a SIZE_CHANGED immediately
after, deleting our resize event and causing the following configure event's
resize to be ignored. This timing issue resulted in fullscreen windows not
being resized at all when becoming a floating window.

By always forcing resize events from configure events, we ensure that RESIZED
always makes it through. SetWindowSize-type changes should be unaffected as
they do not fire configure events.
2021-07-30 16:05:06 -04:00
David Gow 8f06a629aa render: Fix -Wmaybe-uninitialized warning in RenderDrawLinesWithRects{,F}
The RenderDrawLinesWithRects and RenderDrawLinesWithRectsF functions can
sometimes call QueueCmdFillRects() with the data pointed to by frects
uninitialised. This can occur if none of the lines can be replaced with
rects, in which case the frects array is empty, and nrects is 0.

gcc 10.3.0 will detect this possibility, and print a warning like:
/home/david/Development/SDL/src/render/SDL_render.c: In function 'RenderDrawLinesWithRectsF':
/home/david/Development/SDL/src/render/SDL_render.c:2725:15: warning: '<unknown>' may be used uninitialized [-Wmaybe-uninitialized]
 2725 |     retval += QueueCmdFillRects(renderer, frects, nrects);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/david/Development/SDL/src/render/SDL_render.c:499:1: note: by argument 2 of type 'const SDL_FRect *' to 'QueueCmdFillRects' declared here
  499 | QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int count)
      | ^~~~~~~~~~~~~~~~~

This is harmless, because when this is uninitialised, nrects is always
0, so QueueCmdFillRects() does nothing anyway. We therefore can work
around this by only calling QueueCmdFillRects() when nrects is nonzero.
Somewhat impressively, gcc recognises that this is now safe.
2021-07-30 10:53:49 -04:00
Ethan Lee c20ab7dae9 wayland: Fix GetWindowWMInfo for <2.0.15 2021-07-30 00:16:52 -07:00
Ryan C. Gordon 585c11c5ae
direct3d: Fix possibly-incorrect scissor test when clearing.
Thanks to @JayFoxRox who did the detective work on this!

Fixes #3357.
2021-07-30 00:33:15 -04:00
Cameron Gutman 6f684f674e cocoa: Add keyboard grab support
CGSSetGlobalHotKeyOperatingMode() is not a public API, so we will only
compile this in if SDL_MAC_NO_SANDBOX=1 is defined during compilation.
2021-07-29 19:06:43 -07:00
Sam Lantinga 69518b9ecc Make sure we don't send a resize event while a window is being destroyed
This fixes https://github.com/libsdl-org/SDL/issues/3669
2021-07-29 17:09:24 -07:00
Ryan C. Gordon 659e1f0a3f
audiocvt: The to-5.1 converters now soften FL and FR channels more.
This is experimental and might be tweaked further.

Reference #4104.

Also reference:

https://github.com/Keriew/augustus/issues/194#issuecomment-847655049
2021-07-29 17:55:59 -04:00
Christian Rauch f20a85818c commit after setting/unsetting limits 2021-07-29 14:55:03 -07:00