Commit Graph

5140 Commits

Author SHA1 Message Date
Sylvain
8dd6edec00
Fixed bug #3232 - Integer overflow generates Illegal instruction under sanitizers + see bug #4995 2021-11-23 09:30:42 +01:00
Ozkan Sezer
e18be04bc6 Fixed undefined behavior in QueueCmdSetDrawColor()
Fixes https://github.com/libsdl-org/SDL/issues/4995
Patch from Andrew Kelley
2021-11-23 08:01:02 +03:00
Sylvain
c878d9a0aa Haiku: comment this should not be SDL_free() 2021-11-22 08:38:46 -08:00
Sylvain
aef7105408 Use SDL_free 2021-11-22 08:38:46 -08:00
Sylvain
2004aaf3bb SDL_wave: use SDL_free 2021-11-22 08:38:46 -08:00
Sylvain
0445c13aae Remove 'malloc' from comment 2021-11-22 08:38:46 -08:00
Sylvain
155db97d14 Remove 'malloc' from comment 2021-11-22 08:38:46 -08:00
Sylvain
c3633d2c99 Haiku: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
79b37cc55f Pandora: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
10ffcbb115 QNX: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
e72beeb2a0 Remove 'malloc' from comment 2021-11-22 08:38:46 -08:00
Sylvain
38cfe25bc5 Remove 'malloc' from comment 2021-11-22 08:38:46 -08:00
Sylvain
4d566e5d5d VITA, PSP: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
9fcc630fb3 X11: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
19bf36db15 DirectFB: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
8fb19d212e Vita: unneeded include 2021-11-22 08:38:46 -08:00
Sylvain
e702a4e520 PSP: un needed include 2021-11-22 08:38:46 -08:00
Sylvain
8e851a277d Remove malloc from comment 2021-11-22 08:38:46 -08:00
Sylvain
0ef9d26622 cpuinfo: remove malloc from comments 2021-11-22 08:38:46 -08:00
Sylvain
30338beb61 Minor comment 2021-11-22 08:38:46 -08:00
Sylvain
fb218e582a PSP: use SDL_malloc/SDL_free 2021-11-22 08:38:46 -08:00
Sylvain
5a7a7ba570 Don't use "realloc" in comment so that it doesn't show up 2021-11-22 08:38:46 -08:00
Sylvain
b4aeaa30a1 Use SDL_calloc / SDL_free 2021-11-22 08:38:46 -08:00
Sylvain
cb9f85e8d0 Don't use "round", so that it's doesn't show up while searching for the function 2021-11-22 08:38:46 -08:00
Sylvain
6fb50bd0a6 Don't use "exp" as a name so that it's doesn´t show up with searching for the function 2021-11-22 08:38:46 -08:00
Sylvain
161dd83c9a Don´t use "trunc" as var name, since it's also a function 2021-11-22 08:38:46 -08:00
Sylvain
d31251b014 use SDL's functions version inplace of libc version 2021-11-22 08:38:46 -08:00
Ozkan Sezer
ee2afa00ba SDL_mfijoystick.m: fix build using older toolchains
Fixes https://github.com/libsdl-org/SDL/issues/4992
Fixes https://github.com/libsdl-org/SDL/issues/4958
2021-11-22 05:11:10 +03:00
Sam Lantinga
c97b721868 Added SDL_PremultiplyAlpha() to premultiply alpha on a block of SDL_PIXELFORMAT_ARGB8888 pixels 2021-11-21 12:18:10 -08:00
Sylvain
49369142bd
Fixed bug #4625: with integer scale, viewport (as reported by SDL_RenderGetViewport) becomes -2147483648x-2147483648
0 isn't valid scale. Min integer scale is 1.0f
2021-11-21 17:40:48 +01:00
Sylvain
a0cb079a42
Fixed bug #4982 - Failed to open audio_device on OpenSLES / Android 5.x with freq 96khz+ 2021-11-21 15:45:08 +01:00
Ryan C. Gordon
ceb9e9a809 cocoa: Removed a debug printf call. 2021-11-21 00:21:41 -05:00
Ryan C. Gordon
18715acb55 cocoa: Position non-left mouse button events in background windows correctly.
Fixes #4828.
2021-11-21 00:14:18 -05:00
Cameron Gutman
343fa61215 hid: fix inconsistent indentation 2021-11-20 13:17:59 -06:00
Cameron Gutman
db60b27188 hid: Only enumerate IOHIDDevices that are likely to be joysticks
Touching HID devices with keyboard usages will trigger a keyboard capture
permission prompt on macOS 11+. See #4887

Like the IOKit joystick backend, we accept HID devices that have joystick,
gamepad, or multi-axis controller usages. We also allow the Valve VID for
the Steam Controller, just like the Windows HIDAPI implementation does.
2021-11-20 13:13:17 -06:00
Ryan C. Gordon
23b7bdef87
offscreen: Don't fail to create a window because of driver_loaded politics.
Fixes #4922.
2021-11-20 14:12:11 -05:00
Ozkan Sezer
504e7aa59b minor tidy-up for ifdefs & co. 2021-11-20 21:51:10 +03:00
Sylvain
b6e8651ae9
Audio 6.1 should be allowed now (see #4974) 2021-11-20 15:31:21 +01:00
Ozkan Sezer
990fb668f7 tests: several -Wwrite-strings fixes. 2021-11-20 01:02:02 +03:00
Sam Lantinga
665865eda2 If the hardware is in an error state, the final page flip may not come.
We should either put a timeout on the wait when destroying the window, or skip it entirely.
2021-11-19 09:58:13 -08:00
Sam Lantinga
6828955ddf Trim any extra platform strings from mappings when they're returned to the application 2021-11-19 09:58:11 -08:00
Cameron Gutman
881a674926 rawinput: Only access SDL_RAWINPUT_mutex if initialized
We can also ditch the lock in RAWINPUT_JoystickQuit() now that the joystick
subsystem quits drivers in reverse order. There's no chance of a racing call
to RAWINPUT_WindowProc() anymore.
2021-11-19 08:19:30 -06:00
Cameron Gutman
1237142be3 joystick: Quit drivers in reverse order to ensure dependencies are not broken
SDL_WINDOWS_JoystickDriver depends on callbacks in SDL_RAWINPUT_JoystickDriver
and SDL_HIDAPI_JoystickDriver being available. It also manages the common
WindowProc used for joystick detection in both WINDOWS and RAWINPUT drivers.

If we don't tear them down backwards, there's a window of time where we could
invoke RAWINPUT_WindowProc() after RAWINPUT_JoystickQuit() was called.
2021-11-19 08:19:30 -06:00
Ozkan Sezer
b67965979a SDL_hidapi.c: fix SDL_udev.h include path
fixes https://github.com/libsdl-org/SDL/issues/4981
2021-11-19 11:55:50 +03:00
Ethan Lee
a7a54e6452 wayland: Add support for display connect/disconnect events 2021-11-18 00:44:08 -05:00
Sylvain
5be8a22113 Add audio conversion from/to 61 2021-11-17 16:04:54 -08:00
Ozkan Sezer
d2cf191936 hidapi, linux: merged a minor warning + code style fix from mainstream. 2021-11-17 10:00:10 +03:00
Ethan Lee
5cc23868ed wayland: Add support for SDL_DisplayOrientation 2021-11-16 11:58:23 -08:00
Sam Lantinga
40d808620d SDL_classic_joysticks defaults off 2021-11-15 20:17:14 -08:00
Sam Lantinga
66058bbbd5 Fixed exception accessing Bluetooth devices on Android 12
Since accessing Bluetooth prompts the user for permission on both Android and iOS, and we only need it for Steam Controller support, we'll leave it off by default. You can enable it by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init()

Fixes https://github.com/libsdl-org/SDL/issues/4952
2021-11-15 16:52:56 -08:00
Sam Lantinga
be5b4d980d Added nativeGetHintBoolean for Java code 2021-11-15 16:52:54 -08:00
Sam Lantinga
9ec2b35147 Fixed the GLES2 shader count to be in sync with the enum 2021-11-15 13:45:53 -08:00
Sylvain
b649314d62
Add comment to audio clipping (see bug #4104) 2021-11-15 13:43:40 +01:00
Sylvain
d4df5d33c5
GLES2: prevent batching if blend mode changes (see bug #4964) 2021-11-15 09:43:44 +01:00
Sylvain
92f2fdfc84
GLES2: batch non joined lines (see #4964) 2021-11-15 09:36:18 +01:00
Sylvain
17f156fae5
Fixed bug #4964 - opengles2 & batching = conjoined lines
put back the initial switch case because groups of joined lines cannot be batched.
2021-11-15 09:08:09 +01:00
Sylvain
d8888e468e
Fixed bug #4964 - opengles2 & batching = conjoined lines 2021-11-15 08:37:49 +01:00
Sam Lantinga
cc094f4d7c Fixed building with the macOS 10.8 SDK 2021-11-14 20:15:48 -08:00
Cameron Gutman
d7d67af441 mouse: Fix Y value in motion events when confinement is active 2021-11-14 17:52:41 -06:00
Zack Middleton
1cd3e83756 cocoa: Fix abort on touch event types without a subtype
macOS 10.6 has some touch NSEvents which do not have a subtype
(Begin/EndGesture, Magnify, Rotate, Swipe) and cause an uncaught
exception which triggers SIGABRT and the program exits.

As it is, none of the macOS 10.6 touch events are detected as a
trackpad (including Gesture due to using different subtypes).
2021-11-14 15:21:51 -08:00
Ozkan Sezer
781caec2b2 SDL_waylandevents.c (keyboard_handle_keymap): silenced -Wwrite-strings . 2021-11-15 00:55:24 +03:00
Ozkan Sezer
5c067906ba wasapi: AvSetMmThreadCharacteristicsW takes an LPCWSTR param, not LPWSTR 2021-11-15 00:55:04 +03:00
Ozkan Sezer
3eb9bfac7a win32 rawinput & wgi joystick: avoid -Werror=declaration-after-statement 2021-11-14 22:22:50 +03:00
Sam Lantinga
c55ab9631f Added a hint for alternate OpenGL NV12 data format 2021-11-13 22:21:57 -08:00
Ozkan Sezer
8a6e48d46d constified SDL_RegisterApp() 2021-11-14 04:40:50 +03:00
Ozkan Sezer
7dfd22ac5e fix XGetDefault signature - its first and second params are _Xconst 2021-11-14 02:32:00 +03:00
Ozkan Sezer
c7aa04d03e SDL_test_harness.c: avoid -Wwrite-strings 2021-11-14 02:31:20 +03:00
Ozkan Sezer
be7b663c2c audio/winmm/SDL_winmm.c (SetMMerror): constify. 2021-11-14 02:30:56 +03:00
Ozkan Sezer
e4aa608a5c change (char*) casts to (const char*) in WIN_UTF8 macros 2021-11-14 02:30:34 +03:00
Cameron Gutman
674f361dec wayland: Fix memory leaks in clipboard code 2021-11-13 11:44:36 -06:00
Cameron Gutman
c8061ed2d1 alsa: Fix possible uninitialized string 2021-11-13 10:33:37 -06:00
Ozkan Sezer
a2c27d39cf SDL_hidapi_switch.c (ConstructSubcommand): lose use of '&' on rumbleData
SwitchCommonOutputPacket_t->rumbleData is an array.
2021-11-13 17:56:28 +03:00
Ozkan Sezer
6ad0fb8462 SDL_hidapi_ps4.c, SDL_hidapi_ps5.c: use SDL_zeroa() 2021-11-13 17:55:10 +03:00
Sylvain
70c8d20a46
Revert previous commit a50ca98e2b (see bug #4625) 2021-11-13 15:04:19 +01:00
Sylvain
a50ca98e2b
Fixed bug #4625 - SDL_RenderSetLogicalSize issues
viewport becomes -2147483648x-2147483648 when logical_w/h is greater than window size.
division should be done with floats
2021-11-13 14:48:36 +01:00
Ozkan Sezer
a948ff8494 SDL_hidapijoystick.c: worked around a bogus 'unreachable code' warning. 2021-11-13 11:50:02 +03:00
Cameron Gutman
eb3f1462b8 x11: Fix memory leak in X11_CreatePixmapCursor() 2021-11-12 18:26:26 -06:00
Cameron Gutman
704edf6323 audio: Fix crash calling SDL_OpenAudio() after SDL_AudioInit() fails
The SDL_WasInit() checks don't work when using SDL_AudioInit() directly,
which is exactly what audio_initOpenCloseQuitAudio() in testautomation
does.
2021-11-12 17:07:22 -06:00
Cameron Gutman
78013aeef9 alsa: Fix use-after-free when reinitializing 2021-11-12 16:57:24 -06:00
Ozkan Sezer
3dc7813ae4 more whitespace tidy-ups in SDL_os2messagebox.c 2021-11-12 20:47:02 +03:00
Sam Lantinga
c2dd50a9a0 Fixed whitespace 2021-11-12 08:28:02 -08:00
Sam Lantinga
074e613bbb Fixed typo 2021-11-12 03:04:11 -08:00
Sam Lantinga
35d90f17e1 Better implementation of SDL_SetWindowMouseGrab() and SDL_SetWindowMouseRect() on macOS 2021-11-12 03:04:11 -08:00
Mathieu Eyraud
5fc7a90a8b Fix refcounting in SDL_hid_exit 2021-11-12 01:25:15 -08:00
Sam Lantinga
162772aa63 Fixed build warnings on Android 2021-11-11 20:50:54 -08:00
Cameron Gutman
50971577e4 dinput: Fix memory leak when SDL_DINPUT_JoystickPresent() returns true 2021-11-11 22:35:41 -06:00
Misa
3bf7994fe2 Add and use SDL_FALLTHROUGH for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Clang before Clang 10 and GCC before GCC 7 have problems with using
__attribute__ as a sole statement and warn about a "declaration not
declaring anything", so fall back to using the /* fallthrough */ comment
if we are using those older compiler versions.

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-12 07:26:14 +03:00
Sam Lantinga
9c3bcf8e8a Added SDL_hid_ble_scan() for pairing Steam Controllers on iOS and tvOS 2021-11-11 17:31:14 -08:00
Sam Lantinga
abc12a832c Revert "Add and use SDL_FALLTHROUGH for fallthroughs"
This reverts commit 66a08aa391.

This causes problems with older compilers:
https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
2021-11-11 15:58:44 -08:00
Sam Lantinga
36b2690e40 Moved SDL HIDAPI functions into a single block for the ABI 2021-11-11 15:48:56 -08:00
Cameron Gutman
fe09a4930a joystick: Add APIs to query rumble support 2021-11-11 15:10:08 -08:00
Cameron Gutman
afccabb881 joystick: Add capability flags for rumble and trigger rumble
When API limitations force us to guess, we favor a false positive (reporting
support when it doesn't exist) compared to a false negative.
2021-11-11 15:10:08 -08:00
Cameron Gutman
1ccfbf963e joystick: Convert HasLED() into a generic GetCapabilities() function 2021-11-11 15:10:08 -08:00
Sam Lantinga
911d91c55c Retry hid_send_feature_report() if the ioctl() fails with EPIPE (e.g. the device stalled) 2021-11-11 14:36:05 -08:00
Sam Lantinga
b15e880e73 Fixed open functions in the SDL_hidapi.h header 2021-11-11 13:50:16 -08:00
Sam Lantinga
b9b0df40bf Fixed Linux build 2021-11-11 12:52:40 -08:00
Sam Lantinga
c9ada1c142 Made HIDAPI device change notifications available via SDL_hid_device_change_count() 2021-11-11 12:46:10 -08:00
Ethan Lee
63ae103cd1 wayland: QTWAYLAND_CONTENT_ORIENTATION can support multiple values as bitmasks 2021-11-11 13:16:34 -05:00
Sam Lantinga
ebed961cb2 Fixed build with older Linux kernel headers 2021-11-11 09:51:39 -08:00
Sam Lantinga
11ae43ca16 Only lock the pointer for mouse relative mode, there isn't really a concept of grab and confinement on iOS
Locking the pointer prevents the on-screen cursor from moving, which isn't what we want with a grab behavior.

Fixes https://github.com/libsdl-org/SDL/issues/4941
2021-11-11 07:51:34 -08:00
Misa
66a08aa391 Add and use SDL_FALLTHROUGH for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-11 07:23:25 -08:00
Sam Lantinga
828a0a4a10 Fixed mapping for PS4 controller when using the classic Joystick
interface on Linux
2021-11-11 07:13:29 -08:00
Sam Lantinga
dc9de1e2bd Get the correct USB VID/PID information for /dev/input/js* devices 2021-11-11 07:03:30 -08:00
Sam Lantinga
bd92a95f22 Cleanup for the /dev/js* support (thanks @meyraud705) 2021-11-11 06:30:36 -08:00
Mathieu Eyraud
3090812e1e Convert last SDL_IOReady()'s 2nd parameter to flags
Conversion missed in https://github.com/libsdl-org/SDL/pull/4897
2021-11-11 06:17:26 -08:00
Sam Lantinga
1c78b08007 Added support for /dev/input/js* on Linux
Added the hint SDL_HINT_LINUX_JOYSTICK_CLASSIC to control whether /dev/input/js* or /dev/input/event* are used as joystick devices

Added the hint SDL_HINT_JOYSTICK_DEVICE to allow the user to specify devices t
hat will be opened in addition to the normal joystick detection

Fixes https://github.com/libsdl-org/SDL/issues/1314
Fixes https://github.com/libsdl-org/SDL/issues/1727
Fixes https://github.com/libsdl-org/SDL/issues/1981
Closes https://github.com/libsdl-org/SDL/pull/4727
2021-11-10 20:02:25 -08:00
Sam Lantinga
65a50b2430 Re-enable udev joystick enumeration by default 2021-11-10 16:15:22 -08:00
Sam Lantinga
dfb834d3d4 Track button state for each mouse input source separately
This way we'll get button down and up events for each mouseID
individually.

Fixes https://github.com/libsdl-org/SDL/issues/4518
2021-11-10 13:44:29 -08:00
Sam Lantinga
eda4c40732 Make sure the X event is an Xkb event before checking the Xkb event type 2021-11-10 12:48:09 -08:00
Sam Lantinga
98c9836287 Don't clobber the error in SDL_ShowMessageBox() if one has been set at
the platform level

Fixes https://github.com/libsdl-org/SDL/issues/4760
2021-11-10 11:04:51 -08:00
Sam Lantinga
dc4c7d9539 Fixed infinite loop in SDL_vsnprintf() if the format string is too large for the output buffer
Fixes https://github.com/libsdl-org/SDL/issues/4940
2021-11-10 09:48:49 -08:00
Sam Lantinga
d5032582e0 Use consistent language between SDLTest_AssertPass() and SDLTest_AssertCheck() 2021-11-10 09:45:56 -08:00
Sam Lantinga
6c4b4ee7a6 Don't assert on API parameters
This causes lots of spam in test automation and it's not clear it's useful to developers. If we need this level of validation, we should add a log category for it.
2021-11-10 09:41:43 -08:00
Sam Lantinga
fed857787a Update the orientation and display modes when the display settings change on Windows
Fixes https://github.com/libsdl-org/SDL/issues/1061
2021-11-10 08:47:39 -08:00
Sam Lantinga
c0f1109bd0 Implemented querying the orientation of displays on Windows 2021-11-10 06:03:01 -08:00
Sam Lantinga
3a31a45028 End the scene before resetting the D3D device, since we'll start with BeginScene after that.
If we don't do this, we'll end up with unbalanced Begin/End scene pairs which causes D3DERR_INVALIDCALL in the present.

Fixes https://github.com/libsdl-org/SDL/issues/4933
2021-11-10 05:24:31 -08:00
Cameron Gutman
6b64c47b69 haptics: Enumerate XInput/DInput joysticks after haptic init
Since the haptic subsystem is usually initialized after the joystick subsystem,
the initial calls to HapticMaybeAddDevice() from inside SDL_JoystickInit() will
arrive too early to be handled by the haptic subsystem. We need to add those
haptic devices for those already present joysticks ourselves.
2021-11-09 23:46:34 -06:00
Eric Wasylishen
0d98793693
testwm2: Fix video modes menu hit detection when highdpi or logical size used (#4936)
* SDLTest_CommonDrawWindowInfo: log SDL_RenderGetScale, SDL_RenderGetLogicalSize

* testwm2: fix video modes menu hit detection in High DPI cases

- also when logical size is specified, e.g.
  `--logical 640x480 --resizable --allow-highdpi`

* add function to determine logical coordinates of renderer point when given window point

* change since to the targeted milestone

* fix typo

* rename for consistency

* Change logical coordinate type to float, since we can render with floating point precision.

* add function to convert logical to window coordinates

* testwm2: use new SDL_RenderWindowToLogical

* SDL_render.c: alternate SDL_RenderWindowToLogical/SDL_RenderLogicalToWindow

Co-authored-by: John Blat <johnblat64@protonmail.com>
Co-authored-by: John Blat <47202511+johnblat64@users.noreply.github.com>
2021-11-09 21:03:42 -08:00
Sam Lantinga
27ce914463 Send absolute mouse motion when in normal mouse mode and relative mouse motion when in relative mode on iOS
This keeps the SDL cursor in sync with the visible cursor when in normal mouse mode.
2021-11-09 20:51:42 -08:00
Sam Lantinga
19c129faba Added documentation that the UIApplicationSupportsIndirectInputEvents key must be set to true
in your application's Info.plist in order to get real Bluetooth mouse events.
2021-11-09 20:32:16 -08:00
Sam Lantinga
7681929cb4 Don't send the initial joystick axis event if the application is in the background 2021-11-09 12:30:37 -08:00
Sam Lantinga
d31f90d9e1 Don't send game controller touchpad or sensor events unless the application has focus
Fixes https://github.com/libsdl-org/SDL/issues/4891
2021-11-09 12:09:01 -08:00
Sam Lantinga
d2f756360e When making the window centered it should use windowed mode size since it doesn't affect fullscreen windows
Fixes bug https://github.com/libsdl-org/SDL/issues/4750
2021-11-09 11:55:02 -08:00
Susko3
1fc25bd839 Properly position the IME window(s) on windows 2021-11-09 11:00:46 -08:00
Ryan C. Gordon
04f42e0468 metal: Deal better with -[CAMetalLayer nextDrawable] returning nil.
Fixes #4863.
2021-11-09 12:03:12 -05:00
Sam Lantinga
0f2bf62935 Fixed building hidapi when libusb is available 2021-11-09 06:20:46 -08:00
Sylvain
e8731933cc
Fixed warning: macro is not used 2021-11-09 13:33:25 +01:00
Sylvain
c7065bf42f
Fix warning: declaration shadows a local variable 2021-11-09 13:33:24 +01:00
Cameron Gutman
715e7bda22 haptic: Don't enumerate joysticks if the joystick subsystem is active
The joystick subsystem has complex precedence logic to deal multiple competing
backends like XInput, RawInput, and WGI. Let it fire the MaybeAdd callbacks
for joystick devices, since it knows which backend will end up managing them.

This resolves a situation where the RawInput joystick backend would take
control of an XInput device but the XInput haptic backend would still create
a haptic device. Since the XInput joystick backend didn't own the underlying
joystick device, we'd end up with an orphaned haptic device that didn't work
with SDL_HapticOpenFromJoystick() on the associated joystick device.
2021-11-09 01:43:44 -06:00
Ethan Lee
ae67c7d2da Implemented SDL_SetWindowMouseRect() on Wayland 2021-11-09 01:34:02 -05:00
Sam Lantinga
18e69827aa Fixed Linux build 2021-11-08 22:29:02 -08:00
Yufei Huang
881f747d5c Always destroy icon 2021-11-08 22:20:50 -08:00
Yufei Huang
7fea557b99 SDL_windowsmouse.c: Remove LR_COPYDELETEORG flag 2021-11-08 22:20:50 -08:00
Sam Lantinga
67c42cb44c Fixed Windows build 2021-11-08 22:16:01 -08:00
Sam Lantinga
fd79607eb0 Added SDL_GetWindowMouseRect()
Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
2021-11-08 21:34:48 -08:00
Sam Lantinga
4db546b092 Implemented SDL_SetWindowMouseRect() on macOS 2021-11-08 20:35:56 -08:00
Cameron Gutman
9c95c2491c x11: Use XCheckIfEvent() instead of XNextEvent() for thread-safety
A racing reader could read from our fd between SDL_IOReady()/X11_Pending()
and our call to XNextEvent() which will cause XNextEvent() to block for
more data. Avoid this by using XCheckIfEvent() which will never block.

This also fixes a bug where we could poll() for data, even when events were
already read and pending in the queue. Unlike the Wayland implementation,
this isn't totally thread-safe because nothing prevents a racing reader
from reading events into the queue between our XCheckIfEvent() and
SDL_IOReady() calls, but I think this is the best we can do with Xlib.
2021-11-08 19:17:18 -08:00
Sam Lantinga
2d23d66a61 Fixed SetWindowMouseRect return value on Windows 2021-11-08 16:33:50 -08:00
Sam Lantinga
7d21322df1 Implemented SDL_SetWindowMouseRect() on Windows 2021-11-08 16:29:19 -08:00
Ethan Lee
4b42c05ba1 video: Add SDL_SetWindowMouseRect.
This API and implementation comes from the Unreal Engine branch of SDL, which
originally called this "SDL_ConfineCursor".

Some minor cleanup and changes for consistency with the rest of SDL_video, but
there are two major changes:

1. The coordinate system has been changed so that `rect` is _window_ relative
   and not _screen_ relative, making it easier to implement without having
   global access to the display.
2. The UE version unset all rects when passing `NULL` as a parameter for
   `window`, this has been removed as it was an unused feature anyhow.

Currently this is only implemented for X, but can be supported on Wayland and
Windows at minimum too.
2021-11-08 14:16:54 -08:00
Sam Lantinga
a3e8fd49e6 Cancel any accumulated mouse wheel motion in the opposite direction when the wheel direction changes
Fixes https://github.com/libsdl-org/SDL/issues/2912
2021-11-08 09:58:11 -08:00
Sam Lantinga
5dbbc8e61f Added mouse wheel deltas with floating point precision
Fixes https://github.com/libsdl-org/SDL/issues/4888
2021-11-08 09:44:31 -08:00
Sam Lantinga
d95a52c9a5 Fixed comment typo 2021-11-08 09:39:21 -08:00
Ethan Lee
fc998b8ec9
wayland: Return true for HasScreenKeyboardSupport only if no physical keyboard exists 2021-11-08 12:37:10 -05:00
Sam Lantinga
b8327a4a48 Added SDL_HIDAPI_DISABLED so it can be disabled like other SDL subsystems 2021-11-08 07:19:45 -08:00
Sam Lantinga
2a6feb5011 Removed accidental debugging commit (thanks @DomGries!) 2021-11-08 07:10:38 -08:00
Sam Lantinga
6c56e27511 Set both _NET_WM_NAME and WM_NAME so SDL windows can be shared in the browser.
Fixes https://github.com/libsdl-org/SDL/issues/4924
2021-11-08 07:05:17 -08:00
Yufei Huang
301819cd1d SDL_windowsmouse.c: Fix WIN_CreateCursor does not scale with system cursor size preference 2021-11-08 06:59:36 -08:00
Sam Lantinga
f61b10dcf1 Do more robust validation of devices passed to the SDL HIDAPI functions 2021-11-08 06:34:32 -08:00
Ozkan Sezer
dd8c354843 SDL_hidapi.c: avoid possible NULL pointer dereferences. 2021-11-08 17:00:56 +03:00
Sam Lantinga
5b646cd19e Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
2021-11-07 23:00:59 -08:00
Thomas Ballinger
94c1276a5f
emscripten: Decrease vertical scroll speed by using deltaMode
Reference issue #4623.
2021-11-07 20:50:07 -05:00
Cameron Gutman
f6dc47caef WGI/DInput: Fix SDL_IsXInputDevice() checks when RawInput is enabled
Enabling the RawInput backend causes SDL_XINPUT_Enabled() to return false.
That causes WGI and DInput backends to take ownership of XInput-compatible
controllers, because they think there's no XInput-specific backend enabled.

In WGI's case, it will actually race with RawInput to open the device. By
properly excluding XInput devices from WGI, we can ensure that the sets of
devices managed by WGI and RawInput don't intersect. This makes the race
harmless, since they'll never both go after the same device.
2021-11-07 16:14:33 -06:00
Sam Lantinga
301389cecc Fixed iOS build 2021-11-07 13:53:12 -08:00
Cameron Gutman
b3e909dc41 WGI: Fix SDL_IsXInputDevice() for Xbox One controllers
The Xbox One driver stack doesn't propagate the VID/PID down to the
HID devices that end up in the GetRawInputDeviceList() output. This
means we end up matching against the wrong VID/PID and can't properly
exclude Xbox One controllers from WGI.

Fortunately, it is possible to walk back up the device tree to find
the parent with the matching VID/PID.
2021-11-07 13:33:18 -08:00
Sam Lantinga
b8c00bf914 Allow opening joysticks that are read-only on Linux
Fixes https://github.com/libsdl-org/SDL/issues/4713
2021-11-07 13:11:29 -08:00
Sam Lantinga
0323d983c6 Add the platform to the game controller mapping so it can be read back in without changes
Fixes https://github.com/libsdl-org/SDL/issues/4848
2021-11-07 12:52:48 -08:00
Charlie Birks
d950b9e2d9
emscripten: Make timers work (if used with emscripten_set_main_loop)
Co-authored-by: aidanhs <aidanhs@cantab.net>
2021-11-07 15:40:54 -05:00
Sam Lantinga
fe2fe29049 Backed out accidentally committed PR https://github.com/libsdl-org/SDL/pull/4849 2021-11-07 11:48:16 -08:00
Sam Lantinga
86bc65a741 Fixed non-Apple builds 2021-11-07 11:35:12 -08:00
Sam Lantinga
637bcd0b72 Fixed build warnings 2021-11-07 11:19:07 -08:00
Sam Lantinga
e14358265e Cleanup sfSymbolName support and add them to the dynamic API functions 2021-11-07 11:16:48 -08:00
Patrick Hogan
149e5c656a Support returning sfSymbolsName for gamepad controls on macOS / iOS / tvOS 2021-11-07 10:58:37 -08:00
Ryan C. Gordon
3acb172531 stdlib: SDL_snprintf now adds decimal places for ("%f", 0.0).
This patch was from @Markvy (thanks!).

Fixes #4795.
2021-11-07 09:34:55 -08:00
Eric Wasylishen
2008f2a8a6 SDL_test_font.c: fix type of SDLTest_CharTextureCacheList 2021-11-07 08:42:09 -08:00
Eric Wasylishen
a0e055a7f9 testwm2: add mode menu, click on a mode to call SDL_SetWindowDisplayMode 2021-11-07 08:42:09 -08:00
Eric Wasylishen
70f7ebe635 SDL_test_font.c: add ability to draw on different SDL_Renderers
fixes `testwm2 --windows 2`
2021-11-07 08:42:09 -08:00
Cameron Gutman
6312aaea0f WGI: Add workaround for delayed callbacks after WGI_JoystickQuit() 2021-11-06 21:35:01 -07:00
Sam Lantinga
2248a54937 Update the focus in case we changed focus to a child window and then away from the application
In this case we'll get WM_KILLFOCUS when the child window is focused, but we'll retain focus on the top level window, but when we Alt-Tab away, we won't get another WM_KILLFOCUS or WM_NCACTIVATE, we get WM_ACTIVATE instead, so we need to check for focus updates in response to that as well.
2021-11-05 22:52:18 -07:00
Ozkan Sezer
6407d4b0a8 remove unnecessary parentheses from SDL_abs() 2021-11-05 17:10:02 +03:00
Kevin Colour
6cbee0634e include: Swap parameter names in atan2 functions 2021-11-05 17:04:00 +03:00
Cameron Gutman
2371b247ff windows: improve feature detection consistency between CMake and non-CMake builds 2021-11-03 08:41:36 -07:00
superzazu
839ca0ea64
SDL_OpenURL (macOS): try to open path if the url cannot be opened (#4830)
* SDL_OpenURL (macOS): try to open path if the url cannot be opened

* SDL_OpenURL (macOS): use CFURLCreateWithBytes & LSOpenCFURLRef to correctly escape input

* fix type casting + indentation
2021-11-03 08:35:24 -07:00
Sam Lantinga
8593076da7 Fixed whitespace 2021-11-02 16:04:36 -07:00
Brick
62629c2b5d Fix 64-bit timeval/timespec delta calculations 2021-11-02 16:02:18 -07:00
Sam Lantinga
6d5edfa733 Fixed crash on Android 8, due to bugs in AAudio implementation 2021-11-02 15:59:26 -07:00
Frank Praznik
43ddc59fa8
Export SDL_LinuxSetThreadPriorityAndPolicy() function (#4877)
It's marked as being a public symbol internally, however, it was missing from the header files and not visible in the shared library.  This adds it to the necessary headers and to the DynAPI list to expose it for use by applications.

Co-authored-by: Frank Praznik <frank.praznik@oh.rr.com>
2021-11-02 13:56:14 -07:00
Ivan Epifanov
848d7b1254 Vita: Implement command batching 2021-11-02 13:43:22 -07:00
Ivan Epifanov
3f7a94fc94 Vita: Remove FillRects 2021-11-02 13:43:22 -07:00
Cameron Gutman
f73376ae24 events: Add logging for SDL_CONTROLLERTOUCHPAD*, SDL_CONTROLLERSENSORUPDATE, and SDL_SENSORUPDATE events 2021-11-02 00:31:25 -05:00
Ryan C. Gordon
2379c52849 os/2: Don't try to be clever with the 32-bit GetTicks fallback. 2021-11-01 14:28:00 -04:00
Ryan C. Gordon
cca79d32a2 android: Patched SDL_GetTicks64() to compile. 2021-11-01 14:28:00 -04:00
Ryan C. Gordon
affb183ea4 unix: Fixed SDL_GetTicks64 function signature. 2021-11-01 14:28:00 -04:00
Ryan C. Gordon
99c9727dc0 timer: Added SDL_GetTicks64(), for a timer that doesn't wrap every ~49 days.
Note that this removes the timeGetTime() fallback on Windows; it is a
32-bit counter and SDL2 should never choose to use it, as it only is needed
if QueryPerformanceCounter() isn't available, and QPC is _always_ available
on Windows XP and later.

OS/2 has a similar situation, but since it isn't clear to me that similar
promises can be made about DosTmrQueryTime() even in modern times, I decided
to leave the fallback in, with some heroic measures added to try to provide a
true 64-bit tick counter despite the 49-day wraparound. That approach can
migrate to Windows too, if we discover some truly broken install that doesn't
have QPC and still depends on timeGetTime().

Fixes #4870.
2021-11-01 14:28:00 -04:00
Northfear
fba82ad1cb Remove sceGxmFinish from RenderPresent on Vita. Make sure that rendering is finished on render texture during locking 2021-10-31 09:17:13 -04:00
Sam Lantinga
a01aaf053c Fixed compiler warning 2021-10-30 21:42:07 -07:00
Cameron Cawley
4d3da5b75b riscos: Disable the mouse pointer for now 2021-10-30 21:25:01 -07:00
Cameron Cawley
1c256b892e riscos: Fix enumerating screen modes 2021-10-30 21:25:01 -07:00
Cameron Cawley
5a3c97f3a3 riscos: Fix detection of the current mode 2021-10-30 21:25:01 -07:00
Cameron Cawley
53b3db0c5d Handle the KMOD_SCROLL modifier on RISC OS 2021-10-30 21:25:01 -07:00
Cameron Cawley
1268984edc Implement mouse input on RISC OS 2021-10-30 21:25:01 -07:00
Cameron Cawley
f7f54f0d04 Implement keyboard input on RISC OS
Partially based on a patch from http://www.riscos.info/websvn/listing.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Flibraries%2Fsdl%2Flibsdl2%2F&rev=7174#a6401c766f408f1ea356e6977894cc6a5
Currently lacks support for mapping scancodes to keycodes.
2021-10-30 21:25:01 -07:00
Cameron Cawley
f8a8ca3e1f Support proper mode switching on RISC OS 2021-10-30 21:25:01 -07:00
Cameron Cawley
fe9bb74764 riscos: Refactor framebuffer code 2021-10-30 21:25:01 -07:00
Cameron Cawley
25c71748ad Add a barebones RISC OS video driver 2021-10-30 21:25:01 -07:00
Cameron Gutman
a559864968 x11/wayland: Fix signal handling while blocking in WaitEventTimeout()
Add a new flag to avoid suppressing EINTR in SDL_IOReady(). Pass the
flag in WaitEventTimeout() to ensure that a SIGINT will wake up
SDL_WaitEvent() without another event coming in.
2021-10-30 21:23:45 -07:00
Cameron Gutman
c97c46877f core: Convert SDL_IOReady()'s 2nd parameter to flags 2021-10-30 21:23:45 -07:00
Ryan C. Gordon
8a4a282aaa
alsa: Make hotplug thread optional.
Even without the thread, it'll do an initial hardware detection at startup,
but there won't be any further hotplug events after that. But for many cases,
that is likely complete sufficient.

In either case, this cleaned up the code to no longer need a semaphore at
startup.

Fixes #4862.
2021-10-30 16:02:12 -04:00
Sam Lantinga
26706319d7 Ignore the ASRock LED controller, it's not a joystick 2021-10-30 05:53:12 -07:00
Cameron Gutman
ac54d57aa5 event: Check subsystem initialization before events or devices
SDL_WasInit() is cheaper SDL_NumJoysticks()/SDL_NumSensors().
2021-10-27 22:35:56 -05:00
Cameron Gutman
1bc6dc3ea0 event: Cap maximum wait time if sensor or joystick subsystems are active
Joystick and sensor subsystems require periodic polling to detect new devices.
2021-10-27 22:35:56 -05:00
Cameron Gutman
2bf36bfac4 wayland: Implement WaitEventTimeout() and SendWakeupEvent()
We can have spurious wakeups in WaitEventTimeout() due to Wayland events
that don't end up causing us to generate an SDL event. Fortunately for us,
SDL_WaitEventTimeout_Device() handles this situation properly by calling
WaitEventTimeout() again with an adjusted timeout.
2021-10-27 19:16:53 -05:00
Ivan Epifanov
9c799802c9 Vita: fix IME input languages 2021-10-26 08:29:56 -07:00
David Gow
c57bcb47b1 test: Fix building with libunwind under autotools
There are two issues which are stopping the SDL tests from building on
my machine:
- libunwind is not being linked
- Even if it is, it is missing several symbols.

The first is fixed by having the test programs link against libunwind if
available. Technically, SDL2_test should be linking against it, as it's
used in SDL_test_memory.c, but as SDL2_test is a static library, it
can't itself import libunwind. We just assume that if it's present on
the system, we should link it directly to the test programs. This should
strictly be an improvement, as the only case where this'd fail is if
SDL2 was compiled when libunwind was present, but the tests are being
compiled without it, and that'd fail anyway.

The second is fixed by #define-ing UNW_LOCAL_ONLY before including
libunwind.h: this is required to make libunwind link to predicatable
symbols, in what can only be described as a bit of a farce. There are a
few more details in the libunwind man page, but the gist of it is that
it disables support for "remote unwinding": unwinding stack frames in a
different process (and possibly from a different architecture?):
http://www.nongnu.org/libunwind/man/libunwind(3).html

Note that I haven't tried this with CMake: I suspect that it'll work,
though, as the CMakeLists.txt seems to have SDL2 link against libunwind if
it's present. This adds an ugly extra dependency to SDL2, but does mean
that issue 1 isn't present. The UNW_LOCAL_ONLY change shouldn't be
build-system-specific.
2021-10-25 11:28:20 -07:00
Cameron Gutman
408a93a1ec wayland: Use multi-thread event reading APIs
Wayland provides the prepare_read()/read_events() family of APIs for
reading from the display fd in a deadlock-free manner across multiple
threads in a multi-threaded application. Let's use those instead of
trying to roll our own solution using a mutex.

This fixes an issue where a call to SDL_GL_SwapWindow() doesn't swap
buffers if it happens to collide with SDL_PumpEvents() in the main
thread. It also allows coexistence with other code or toolkits in
our process that may want read and dispatch events themselves.
2021-10-25 12:00:35 -04:00
Sylvain
4960cc3dcb
Fixed a few warnings 2021-10-25 16:18:40 +02:00
Sylvain
b793394590
SDL_Renderer: make clear that we use render geometry for fillrect/copy/copyex when there is no specific back-end implementation (currently software, PSP, directfb) 2021-10-25 13:46:40 +02:00
Ozkan Sezer
b3f9d8f38d remove unused local vars after the latest commits. 2021-10-25 07:05:50 +03:00
Sylvain
502e9c3b45 SDL_Renderer simplifications:
- Factorize PrepQueueCmdDraw{,DrawTexture,Solid) into one single function
- Change SDL_Texture/Renderer r,g,b,a Uint8 into an SDL_Color, so that it can be passed directly to RenderGeometry
- Don't automatically queue a SET_DRAW_COLOR cmd for RenderGeometry (and update GLES2 renderer)
2021-10-24 22:27:56 -04:00
Sylvain
23e252bfc5 DirectFB: provide RenderCopyEx via RenderGeometry 2021-10-24 22:27:56 -04:00
Sylvain
79732c9d1e Remove FillRects from back-end, where RenderGeometry can be used 2021-10-24 22:27:56 -04:00
Sylvain
f02ad2820f Remove FillRects from back-end, where RenderGeometry can be used 2021-10-24 22:27:56 -04:00
Sylvain
70b10c753d Use correct indices when using RenderGeometry / FillRects 2021-10-24 22:27:56 -04:00
Sylvain
16beed9aeb Less code since color is constant when done with triangles 2021-10-24 22:27:56 -04:00
Sylvain
99a346439c OpenGLES2: LINES and POINTS successive commands are combined into a single draw call
(using the same case for DRAW_GEOMETRY)
2021-10-24 22:27:56 -04:00
Sylvain
f0cdc1d0f6 OpenGLES2: remove FillRects, since it's can be done with RenderGeometry 2021-10-24 22:27:56 -04:00
Sylvain
37c39d5cb4 Use geometry to implement FillRects 2021-10-24 22:27:56 -04:00
Sylvain
b0eef52fe1 GLES2 batching: probably need to check for blendMode changes 2021-10-24 22:27:56 -04:00
Sylvain
c27e1249e1 Remove SDL_HAVE_RENDER_GEOMETRY define 2021-10-24 22:27:56 -04:00
Sylvain
77026f673b Metal: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Sylvain
0e5160a056 VITA: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Sylvain
73f4ab4c13 Direct3D11: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Sylvain
ab758398af Direct3D: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Sylvain
1fe7e3616b OpenGL: a few opengl functions become unused 2021-10-24 22:27:56 -04:00
Sylvain
88548070a5 OpenGLES: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Sylvain
d192515428 OpenGL: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Sylvain
b92056bbea OpenGLES2: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Sylvain
76f9fb96d9 Use RenderGeometry to implement RenderCopy and RenderCopyEx at higher level 2021-10-24 22:27:56 -04:00
Ryan C. Gordon
08797adaef opengles2: Attempt to batch RenderCopy calls into a single glDrawArrays call. 2021-10-24 22:27:56 -04:00
Tanuj Bagaria
1f0eb03a76
Fix PS5 mapping with HID-PLAYSTATION driver (#4675)
* add missing PS5 Linux GUID for Bluetooth

* Fix PS5 Mapping to work with HID-Playstation driver
2021-10-24 17:54:26 -05:00
Cameron Gutman
f499168c2c x11: Use SDL_IOReady() instead of calling select() directly
SDL_IOReady() properly handles EINTR and can use poll() if available.
2021-10-24 15:54:57 -05:00
Alex Szpakowski
ba4ef461ea macOS: Fix implicit integer downcast warnings 2021-10-23 17:45:27 -04:00
Ryan C. Gordon
d9d8f51eec
wikiheaders.pl: Add support for deprecated functions. 2021-10-23 14:41:23 -04:00
David Gow
a76b73dd2c kmsdrm: Use SDL_PremultiplySurfaceAlphaToARGB8888() for cursor surface
Instead of taking a direct copy of the mouse cursor surface, and then
premultiplying on every BO upload (using the custom
legacy_alpha_premultiply_ARGB8888 function), use the new
SDL_PremultiplySurfaceAlphaToARGB8888() function, which converts a whole
surface at a time, once and save the result.

The already-premultiplied data is then copied from that to the BO on
each upload, adjusting for the stride (which the previous implementation
required to be equal to the width), thereby making the extra copy
slightly useful..

This also adds support for non-SDL_PIXELFORMAT_ARGB8888 surfaces.
2021-10-22 05:50:00 -07:00
David Gow
b528d48446 wayland: Wayland cursors should use premultiplied alpha
It turns out that Wayland's WL_SHM_FORMAT_ARGB8888 format (and, indeed,
all wayland RGBA formats) should be treated as premultiplied. SDL
surfaces tend not to be premultiplied, and this is assumed by other
backends when dealing with cursors.

This change premultiplies the cursor surface in Wayland_CreateCursor()
using the new SDL_PremultiplySurfaceAlphaToARGB8888(). In so doing, it
also adds support for a wider range of input surfaces, including those
with non-ARGB8888 pixel formats, and those which don't have
pitch==width.

This should fix #4856
2021-10-22 05:50:00 -07:00
David Gow
84808ea4bb video: Add SDL_PremultiplySurfaceAlphaToARGB8888()
A number of video backends need to get ARGB8888 formatted surfaces with
premultiplied alpha, typically for mouse cursors. Add a new function to
do this, based loosely on legacy_alpha_premultiply_ARGB8888() from the
KMSDRM backend.

The new function, SDL_PremultiplySurfaceAlphaToARGB8888() takes two
arguments:
- src: an SDL_Surface to be converted.
- dst: a buffer which is filled with premultiplied ARGB8888 data of the
  same size as the surface (assuming pitch = w).

This is not heavily optimised: it just repeatedly calls SDL_GetRGBA() to
do the conversion, but should do for now.
2021-10-22 05:50:00 -07:00
uyjulian
007b5463e8 video/uikit: Do not use setNeedsUpdateOfPrefersPointerLocked on iOS SDKs older than 14 2021-10-21 21:21:57 -07:00
Sam Lantinga
b360965d0d Added a hint for alternate OpenGL NV12 data format 2021-10-21 20:48:05 -07:00
Cacodemon345
19dee1cd16
Add SDL_GetWindowICCProfile(). (#4314)
* Add SDL_GetWindowICCProfile

* Add new SDL display events

* Implement ICC profile change event for macOS

* Implement ICC profile notification for Windows

* Fix SDL_GetWindowICCProfile() for X11

* Fix compile errors
2021-10-21 17:37:20 -07:00
Sam Lantinga
a34fe8161f Added the ability to bind NV12 textures in the OpenGL renderer 2021-10-21 12:28:35 -07:00
Sam Lantinga
f3fd1ffb99 Fixed crash if SDL API functions are called on a disconnected controller on iOS 2021-10-20 15:18:03 -07:00
Sam Lantinga
a43d3f6931 Don't detect the ROG Chakram mouse as a joystick 2021-10-20 15:19:22 -07:00
Sam Lantinga
bfd2f8993f Fixed grab handling when focus changes between windows in the same application 2021-10-19 17:29:23 -07:00
James Howard
d9c44b6537 Allow Cocoa_VideoInit to succeed when current display mode has invalid flags
This fixes a specific issue seen on macOS 10.14.6 where a DELL E248WFP
Display connected to a 2014 Mac Mini with a scaled 1920x1080 resolution
selected and SDL_Init(SDL_INIT_VIDEO) failed with the error: "The video
driver did not add any displays".

The underlying cause was that the current 1080p display mode did not
have the flag kDisplayModeSafeFlag, the check for which was added in
a963e36, with the idea that certain display modes should not be
candidates for switching to in fullscreen exclusive mode. That may well
be the right thing to do for filtering down a list of candidate modes,
but it doesn't pay to be so picky about the current mode. After all,
this current mode was set by System Preferences, the picture does appear
correctly on screen, and other non-SDL based applications launch and run
correctly in this mode.

Therefore the fix is to have GetDisplayMode only filter out a mode based
on flags if it's part of a candidate list, but if it's the current mode
and it can possibly be converted to an SDL_DisplayMode, do so.
2021-10-19 15:50:21 -07:00
Sylvain
649a33ae47
X11: remove redundant 'wakeup_lock' mutex creation 2021-10-18 23:00:43 +02:00
Ozkan Sezer
c4bac66b74 os2, geniconv: replaced many uses of libc calls with SDL_ counterparts.
FIXME: figure out a way to handle errno checks properly.
2021-10-18 14:11:20 +03:00
Ozkan Sezer
0a0f685473 SDL_os2video.c: missed replacing a use of libc function 2021-10-18 14:10:56 +03:00
Ozkan Sezer
8e9ea2e362 SDL_os2joystick.c: missed replacing a use of libc function 2021-10-18 14:10:37 +03:00
Sylvain
8b1a2fe860
backout SDL_AndroidSetInputType() 2021-10-17 23:47:59 +02:00
Sylvain
6ef3bc5688
Add Dynapi for SDL_AndroidSetInputType() 2021-10-17 23:40:36 +02:00