Commit Graph

5353 Commits (d3cc5764c0f66872a6b87c0ffbca66c85dccbea3)

Author SHA1 Message Date
Sam Lantinga c3ca3445bd Prefer HIDAPI on macOS, as that has extended functionality 2022-03-08 18:56:49 -08:00
Sam Lantinga 6a787619e6 Allow reading background events for MFi controllers 2022-03-08 18:42:13 -08:00
Sam Lantinga b064ad6ac5 Allow GL_ARB_texture_non_power_of_two environment variable to override OpenGL 2.0 check 2022-03-08 18:14:10 -08:00
Sam Lantinga 1b7669374e Fixed the SDL controller type for USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER 2022-03-08 09:58:24 -08:00
Mahyar Koshkouei 41e7d1baa6 Add SDL_GetDisplayDPI implementation on Emscripten
Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
2022-03-07 07:18:45 -05:00
Cameron Gutman b2463a917c events: Add logging support for several missing event types 2022-03-06 15:02:53 -06:00
Sam Lantinga bdafe1e049 Fixed whitespace 2022-03-04 11:01:55 -08:00
Sam Lantinga 2e801b1ae7 Split long text input into multiple events if needed (thanks @zreedy!) 2022-03-04 10:50:16 -08:00
Cameron Cawley 2f7b885df9 Fix 'potentially uninitialized local pointer variable' error in UWP builds 2022-02-28 09:04:33 -08:00
Cameron Cawley 98353533e5 riscos: Report keyboard repeat events 2022-02-24 09:11:33 -08:00
Sam Lantinga af40cb6f00 Added support for the Razer Huntsman Analog keyboard in controller mode 2022-02-23 15:49:10 -08:00
Phillip Stephens 94d43186f2 GameCubeAdapter: Add suppport for all rumble modes
This adds support for all 3 of the gamecube controller's rumble modes
Rumble: 1
Stop: 0
StopHard: 2
This is useful for applications that need the full range of support
This also adds a hint to control rumble behavior, defaults 0 to maintain compatibility
2022-02-23 07:03:02 -08:00
Ryan C. Gordon b946e31ec8 video: Allow unaccelerated SDL_HINT_FRAMEBUFFER_ACCELERATION renderers.
If the app requested a specific renderer, even if it's not the optimal path,
let them have it, because they might want to render with a specific GPU API
on top of the framebuffer pixels.

This fixes DosBox-X crashing on startup, which forces the hint to "opengl".
2022-02-23 09:36:06 -05:00
Ryan C. Gordon 60ddb74cfe video: rework how we prepare a texture framebuffer.
Now we see if we can create an SDL_Renderer, and if that renderer reports
itself as "accelerated," and added some initial heuristics to the OpenGL
renderer to make better decisions about what qualifies as "accelerated."

This adds some FIXMEs that might be merely hypothetical, and removes the
old OpenGL checks from the video subsystem that probably weren't meaningful
in modern times. This will definitely need to improve the existing list
in the GL renderer, to catch things like llvmpipe, etc.

Reference issue #4624.
2022-02-23 09:36:06 -05:00
Wohlstand 08d27dfd7b SDL_openslES.c: Detect float support in runtime and use it
Allow using of the float output type on newer Android devices, but keep PCM16 output on older

Closes #5358
2022-02-22 08:31:14 -08:00
Ryan C. Gordon 293a0aa80e
opengl: If GL version >= 2.0, NPOT textures are supported, so favor them.
Fixes #5041.
2022-02-22 10:54:21 -05:00
Sam Lantinga 9299a3e796 Workaround for crash in CoUninitialize() 2022-02-21 16:24:45 -08:00
Sam Lantinga 978fbc3250 Fixed compile warnings 2022-02-21 12:02:44 -08:00
Sam Lantinga 6c531c4334 Correct handling of sentinel events when polling without removing events
Fixes https://github.com/libsdl-org/SDL/issues/5350
2022-02-21 11:35:31 -08:00
Cacodemon345 d90bd261f3 wscons: Make USB keyboard input layout independent 2022-02-18 09:30:04 -08:00
Sylvain 9d86ec8573
Palette format: software Render Jitter in rotation (see #5143)
- same fix applied for rotation with palette surfaces
- allow other 8bits format (eg 332)
2022-02-18 09:57:10 +01:00
Sylvain ceb09ee740
Fixed #5143 - software Render Jitter in rotation
better precision calculating rotated coordinates and interpolation
2022-02-17 23:11:02 +01:00
Sam Lantinga 18032979d8 Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks
This hint defaults off, but when it is enabled the mice will have a game controller mapping set up for Profile 3 (set in the Armoury Crate software)
2022-02-15 13:07:51 -08:00
Sylvain 75ffa24e3a
Software Render Jitter in rotation (bug #5143)
The output surface doesn't necessarily to have even width and height.
2022-02-15 13:35:59 +01:00
Sylvain 61abc4e5b6
PSP: SDL_RenderCopyEx rotation and global scaling around the wrong way (see #bug 3070) 2022-02-15 11:34:50 +01:00
Sylvain 18b76fcc5d
Fixed bug #3070 - SDL_RenderCopyEx rotation and global scaling around the wrong way (software renderer) 2022-02-15 11:33:56 +01:00
Sylvain e366ad1288
Fixed bug #2308: SDL_RenderCopyEx rotation center precision (software renderer) 2022-02-15 10:02:34 +01:00
Wouter Wijsman 66ee79bd68 [PSP] Don't swizzle streaming textures
It was causing issues in the teststreaming demo and unswizzling
later is inefficient and causes issues.
2022-02-14 10:59:25 +01:00
Sam Lantinga f97a29f6e1 Use the real device VID/PID when seeing the Steam virtual controller 2022-02-11 22:10:33 -08:00
Sylvain 85e6500065
X11 Segmentation fault with multiple windows and renderers (see #5256) 2022-02-11 11:08:08 +01:00
Sylvain a75041e8dd
Fixed bug #2140: basic support to convert 16 colors palette PIXELFORMAT_INDEX4, to allow conversion to SDL_Texture 2022-02-10 13:44:59 +01:00
Wouter Wijsman abc8198a1f Render all sides when drawing rect on PSP 2022-02-09 09:36:19 -08:00
Frank Praznik 228db35287 audio: pipewire: Tidy up formatting 2022-02-08 14:33:34 -05:00
Frank Praznik 9da9e85cba audio: pipewire: Reset all hotplug values and pointers on shutdown
Ensure that all hotplug variables and pointers are reset to NULL or their original value when shutting down.
2022-02-08 14:33:34 -05:00
Frank Praznik 5b36a527ed audio: pipewire: Remove redundant locks
The io_list_check_add() and io_list_remove() functions are only ever called from within the Pipewire thread loop, so the locks are redundant.  io_list_sort() is called from within a lock in the device detection function, so those additional locks are redundant as well.
2022-02-08 14:33:34 -05:00
Frank Praznik 48b4d1c412 audio: pipewire: Convert atomic hotplug conditional variables to SDL_bool
The hotplug loop condition variables are always guarded by the loop mutex while the loop is running, so they don't need to be atomic.
2022-02-08 14:33:34 -05:00
Ozkan Sezer 67f12ede3b move bug #5333 fix to headers 2022-02-08 21:32:50 +03:00
Wouter Wijsman 54304b971d Fix rotation direction and center point on PSP 2022-02-08 09:47:10 -08:00
Wouter Wijsman 2b572dff88 Make RenderCopyEx rotate around center
This still isn't perfect. The rotation is the wrong way around and the
images are upside down.
2022-02-08 09:47:10 -08:00
Ozkan Sezer 7935cfacc5 SDL_mfijoystick.m: use __typeof instead of typeof.
Fixes https://github.com/libsdl-org/SDL/issues/5319
2022-02-08 18:55:10 +03:00
Ozkan Sezer 9b817248c5 SDL_spinlock.c: define HAVE_GCC_ATOMICS for windows/clang builds,
... if not already defined.
Fixes https://github.com/libsdl-org/SDL/issues/5333

diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index bdd347e..4f10741 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -28,6 +28,12 @@
 #include "SDL_mutex.h"
 #include "SDL_timer.h"

+#if defined(__WIN32__) && defined(__clang__)
+# ifndef HAVE_GCC_ATOMICS
+# define HAVE_GCC_ATOMICS 1
+# endif
+#endif
+
 #if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
 #include <atomic.h>
 #endif
2022-02-08 18:50:02 +03:00
Sylvain e7e44df039
Dynapi: add SDL_GetTouchName() entry 2022-02-08 11:34:41 +01:00
Sylvain 34d4f5b14e
Fixed bug #2032: add SDL_GetTouchName to expose the driver name of the device (Thanks @mgerhardy!) 2022-02-08 11:32:20 +01:00
Frank Praznik 53091e36a3 audio: pipewire: Remove the hard upper bound on rates and buffer sizes
Remove the hard upper limit of 8192 samples and instead use the buffer sizes provided by Pipewire to determine the size of the intermediate input buffer and whether double buffering is required for output streams. This allows for higher latency streams to potentially avoid double-buffering in the output case, and we can guarantee that the intermediate input buffer will always be large enough to handle whatever Pipewire may deliver.

As the buffer size calculations occur in a callback in the Pipewire processing thread itself, the stream readiness check has been modified to wait on two distinct flags set when the buffers have been configured and when the stream is ready and running.
2022-02-07 15:11:31 -05:00
Frank Praznik 66866249a2 audio: pipewire: Condition variable doesn't need to be atomic
The condition variable is guarded by a mutex, so no need for it to be atomic.
2022-02-07 15:11:31 -05:00
Sylvain b0dd4c7d36 SDL_Render OpenGL: do batching like in the GLES2 backend (with no VBO) 2022-02-07 14:02:20 -05:00
Sylvain 90f0d2ce49 Revert OpenGL point drawing performance, do to proper batching 2022-02-07 14:02:20 -05:00
waddlesplash 423feac69b haiku: Actually remove BDirectWindow and fix OpenGL handling.
This provides the other half of 05c72b113c830392f8b08532317ef07972b29a2e.
2022-02-06 19:19:21 -05:00
pionere 6d5592a201 minor cleanup of SDL_CreateRenderer 2022-02-05 10:05:25 -05:00
Ozkan Sezer e8c48981f9 pthread/SDL_systhread.c: always include errno.h
fixes build for several targets after commit 87b02d3 for bug #5283.
2022-02-05 08:56:56 +03:00
Sam Lantinga 5c4fff7f63 Don't fail to get battery status if the upower refresh call fails 2022-02-04 14:02:44 -08:00
Ozkan Sezer c8cee0b8ca OS2_HasClipboardText: store the boolean result before closing clipboard.
just in case..
2022-02-04 23:28:56 +03:00
Ozkan Sezer c93e552068 minor update to winrt/SDL_sysurl.cpp
from: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0006-Update-SDL_sysurl.cpp.patch
2022-02-04 20:03:50 +03:00
Ozkan Sezer 3b9e6c1cec SDL_os2video.c: fixed HasClipboardText() semantics.
Empty string in clipboard is expected to give FALSE by SDL_HasClipboardText.
Noticed in a commit by josch1710 in bitwiseworks' os/2 fork.
2022-02-04 19:50:20 +03:00
Joshua Ashton 86b7a0642f Add additional VID/PIDs for Anne Pro II
This thing changes its VID/PID on firmware revisions...
2022-02-04 08:45:19 -08:00
Sam Lantinga dd69c28d6f Added a mapping for the Xbox Series X controller, firmware version 5.11.3118.0, connected to Linux via Bluetooth 2022-02-03 18:01:34 -08:00
Temdog007 b59e75c259 Handle menu button press from controller 2022-02-02 21:21:44 -08:00
pionere 2cfc83eab7
sync D3D_RenderReadPixels with D3D11_RenderReadPixels
- use the result of SDL_ConvertPixels to propagate error
- get rid of the verbose error message of D3D11_RenderReadPixels in case SDL_ConvertPixels failed
2022-02-02 14:56:38 -05:00
pionere 3bef4a5da6
cleanup error-handling in SDL_egl.c
- always set error message in SDL_EGL_ChooseConfig / SDL_EGL_CreateContext
- assume SDL_EGL_DeleteContext does not alter the error message
- sync generic error message of SDL_EGL_MakeCurrent with SDL_EGL_Get/SetSwapInterval
- do not overwrite error message of SDL_EGL_ChooseConfig in WINRT_CreateWindow
2022-02-02 14:56:21 -05:00
pionere b5c5052608
cleanup error-handling in SDL_bmp.c
- add missing error-message in SDL_LoadBMP_RW
- check return value of SDL_RWtell in SDL_LoadBMP_RW
- use standard SDL_EFREAD error instead of custom strings
+ adjust return type of readRlePixels
2022-02-02 14:55:36 -05:00
pionere 19df4af2aa
simplify SDL_DUMMY/OFFSCREEN_CreateWindowFramebuffer 2022-02-02 14:45:48 -05:00
SonicMastr ecd922b5cf Fix touch holding detection after #5244 changes 2022-02-02 08:55:26 -08:00
Sylvain df0d696a62
RISCOS: attempt to fix compilation ERANGE 2022-02-02 15:22:14 +01:00
Sylvain 87b02d3795
Linux thread name limitation: test for ERANGE (see bug #5283) 2022-02-02 15:09:29 +01:00
Sylvain 220a9596f3
Remove testing instruction (see bug #5283) 2022-02-02 10:01:11 +01:00
Sylvain 9e46a512b1
Fixed bug #5283 - limit thread name to 16 characters when using pthread_setname_np() 2022-02-02 09:58:15 +01:00
Weng Xuetian b11dfd7611 Only generate key repetition for keys that should repeat on wayland.
This fix repetition on modifier keys, e.g. Control.
2022-02-01 17:56:04 -05:00
Weng Xuetian a90a2e7582 Fix text_input_v3 preedit string
For every batch of text_input_v3 updates, if there is no preedit in this
batch, preedit should be cleared.
2022-02-01 15:51:26 -05:00
Sam Lantinga 03c4405b3b Fixed D-Bus battery refresh call 2022-02-01 09:33:18 -08:00
Sylvain d224a63bda
Fix compilation for non Android 2022-02-01 11:34:01 +01:00
Sylvain fe2ed6cf6f
Fixed bug #5221 - Add SDL_AndroidSendMessage() 2022-02-01 11:30:43 +01:00
pionere 97269e143d adjustments to ime_candidates
- allocate ime_candidates on demand
- allow write to the whole allocated memory of ime_candidates
- ensure ime_candcount is set to zero in case the candidates can not be queried for any reason
2022-01-31 22:06:26 -05:00
pionere 6f404d0f04 cleanup IME_GetCandidateList / UILess_GetCandidateList
- move IME_ShowCandidateList, ImmGetContext and ImmReleaseContext to this function
- set ime_candpgsize to MAX_CANDLIST if dwPageSize is zero
- comment out deselection of ime_candsel in case of korean language for the moment (LANG_CHT does not work anyway)
2022-01-31 22:06:26 -05:00
Sam Lantinga ec8e3104c8 Refresh the battery state before we query it on Linux 2022-01-31 17:01:08 -08:00
Frank Praznik 0b34f18045 audio: pipewire: Don't double free properties on init failure
The context and stream creation functions will destroy the passed properties object on failure, so no need to do it manually.

The pw_properties_free() function pointer is no longer needed, so it can be removed.
2022-01-30 23:23:03 -05:00
Sylvain f7d3abddba
Fixed bug #964 - SDL_RenderCopy stretch loses proportion on viewport.
Handle the case when there is blending
2022-01-29 10:19:08 +01:00
pionere a5c610b0a3 revert 'Changed to use 0xFE instead of 0xFF for better sound quality.' 2022-01-28 20:40:19 -05:00
Ryan C. Gordon 43f0271b4e Revert "fix compiler warnings in SDL_windows_gaming_input.c"
This reverts commit ca36cdb185f2f26241598068927821896f36b904.

The older Windows SDK's headers are wrong, and this change would crash if
you hotplug a device.
2022-01-28 20:40:19 -05:00
pionere a70bb259c7 drop handle parameter of OpenDevice 2022-01-28 20:40:19 -05:00
pionere 47ddb04e17 cleanup/sync the main loop of *_OpenDevice functions to pick audio format II. 2022-01-28 20:40:19 -05:00
pionere 2eafe4340c cleanup/sync the main loop of *_OpenDevice functions to pick audio format 2022-01-28 20:40:19 -05:00
pionere 3939ef72f8 cleanup SDL_GetAudioDeviceSpec
- drop unnecessary hascapture check
- call SDL_InvalidParamError and return -1 in case the index is out of range
- do not zfill SDL_AudioSpec
- adjust documentation to reflect the behavior
2022-01-28 20:40:19 -05:00
pionere 113109f839 cleanup SDL_GetAudioDeviceName
- drop unnecessary hascapture check
- call SDL_InvalidParamError in case the index is out of range
2022-01-28 20:40:19 -05:00
pionere f91211eb17 cleanup WASAPI_PrepDevice
- reorganize the loop which checks for the right wave-format
- use the return value of UpdateAudioStream
- ensure SetError is called in SDL_NewAudioStream
2022-01-28 20:40:19 -05:00
pionere c9e8d1573a re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory II. 2022-01-28 20:40:19 -05:00
pionere 1043dd8c0d adjust handling of iscapture
- drop iscapture parameter of OpenDevice
- use SDL_bool for iscapture
2022-01-28 20:40:19 -05:00
pionere e2f70a2dff cleanup SDL_EventState 2022-01-28 20:40:19 -05:00
pionere 32c7d5d352 cleanup IME_UpdateInputLocale
- do not store the HKL in a static variable
- always set the ime_candvertical value in case the HKL is changed
2022-01-28 20:40:19 -05:00
pionere 25aa7244dc cleanup IME_GetId
- use assert instead of a check (it is a static function with constant parameter)
- assume it is called with 0 first (simplifies the logic)
- reuse dwLang value instead of a new 'call' to LANG()
2022-01-28 20:40:19 -05:00
pionere 60deadba59 re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory 2022-01-28 20:40:19 -05:00
pionere ebdd536676 use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError 2022-01-28 20:40:19 -05:00
pionere 4a17612bff get rid of BeginLoopIteration 2022-01-28 20:40:19 -05:00
pionere 0770c5829c get rid of PrepareToClose 2022-01-28 20:40:19 -05:00
Ryan C. Gordon e0236c02ce audio: Removed an unnecessary commented-out line. 2022-01-28 20:40:19 -05:00
pionere 0dda8a7f4c cleanup init functions of audio
- use SDL_bool if possible
- assume NULL/SDL_FALSE filled impl
- skip zfill of current_audio at the beginning of SDL_AudioInit (done before the init() calls)
2022-01-28 20:40:19 -05:00
pionere 6fcfcc3d6f get rid of SkipMixerLock 2022-01-28 20:40:19 -05:00
pionere 3c85cef46c cleanup SDL_RegisterApp
- fix memory leak when RegisterClassEx fails
- set style according to the documentation
- eliminate duplicated SDL_Instance setter
2022-01-28 20:40:19 -05:00
pionere 014e2bbdb2 use SDL_COMPILE_TIME_ASSERT instead of SDL_STATIC_ASSERT 2022-01-28 20:40:19 -05:00
pionere 95f30c7a48 fix compiler warnings in video/uikit 2022-01-28 20:40:19 -05:00
pionere 176941a4fb allow MacOS build without SDL_FILE 2022-01-28 20:40:19 -05:00