Commit Graph

10024 Commits (5d50fa52df747ae9d8b2e893dc6309d931bd4ba5)

Author SHA1 Message Date
Sam Lantinga c51464d9d8 Put the Nintendo Switch Pro controller back into enhanced mode as needed
Fixes https://github.com/libsdl-org/SDL/issues/3450
2022-07-27 09:00:39 -07:00
Anonymous Maarten 5c70e45c53 cmake: don't use result of 'find_library' for Android libraries 2022-07-26 14:24:36 -07:00
Anonymous Maarten 430c39082f ci: test 'sdl2-config --static-libs' + 'pkg-config sdl2 --static' on ci 2022-07-26 14:24:36 -07:00
Anonymous Maarten 4690689a4c cmake: on Apple, don't use find_library for frameworks + use EXTRA_LDFLAGS 2022-07-26 14:24:36 -07:00
Sam Lantinga 613ce7850e Fixed interpreting SDL_KMSDRM_DEVICE_INDEX="" as index 0 2022-07-26 13:34:27 -07:00
Pierre Wendling 36d456797b CI: Fix CMake workflow.
- Add quotes the OSX_ARCHITECTURES list.
- Extract the flag in the matrix.
2022-07-26 23:05:55 +03:00
Ryan C. Gordon cc982ea7a7 kmsdrm: let device indexes be > 2 digits. 2022-07-26 15:43:34 -04:00
Pierre Wendling c37c1f7ac3 CI: Make macOS universal build with CMake. 2022-07-26 12:30:14 -07:00
diddily 1f276a5148 Fix Main Thread Checker warning on macOS
Cache off NSWindow's windowNumber in SDL_WindowData on setup and use that in `Cocoa_SendWakeupEvent` to prevent accessing windowNumber off the main  thread.
2022-07-26 15:17:44 -04:00
Ryan C. Gordon 31d38f2f30
WhatsNew.txt: Note that minimum macOS version is now 10.9. 2022-07-26 15:14:37 -04:00
Ryan C. Gordon 542a4da3d6
kmsdrm: check SDL_HINT_KMSDRM_DEVICE_INDEX hint in dri_getindex().
Otherwise, it would work for Init but not Available.
2022-07-26 15:11:19 -04:00
Ryan C. Gordon 218c3dbb34
cocoa: Don't crash if moving a message box created before SDL_Init.
Fixes #5928.
2022-07-26 14:45:26 -04:00
Sam Lantinga f789bc7d5f Updated minimum OS targets on Apple platforms to match supported platforms using Xcode 13 2022-07-26 11:36:01 -07:00
Ryan C. Gordon 8ff738f234
audio: Report SDL_AUDIODEVICEREMOVED for unopened devices.
Unopened devices, if removed, now send SDL_AUDIODEVICEREMOVED events with
a `which` field set to zero. Apps can use this to decide if they need to
refresh a list of devices being shown in an options menu, etc.

It's safe to call SDL_CloseAudioDevice(0), so even if they try to clean
up this bogus id, it should be safe.

Fixes #5199.
2022-07-26 12:40:47 -04:00
Ryan C. Gordon 5d85c7d300
kmsdrm: Added a hint to specify device index.
Fixes #2811.
2022-07-26 00:19:54 -04:00
Ryan C. Gordon 20a76b0e3e
video: removed unused devindex argument from bootstrap's create method. 2022-07-26 00:19:52 -04:00
Sam Lantinga cbb3f4ca37 Add SDL_guid.h to the global SDL header 2022-07-25 19:53:04 -07:00
pionere 12211df669 hide SDL_GenerateAssertionReport in case SDL_ASSERT_LEVEL is 0
otherwise SDL_PromptAssertion (and SDL_GenerateAssertionReport) can not be eliminated
2022-07-25 14:26:46 -07:00
Sam Lantinga a423848ea0 Allow floating point values for SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED
This allows setting the brightness of the home LED on Nintendo Switch Pro controllers, in the range 0.0 - 1.0.

This can be updated at runtime by setting the hint dynamically.

Fixes https://github.com/libsdl-org/SDL/issues/3787
2022-07-25 11:26:18 -07:00
diddily 1e492b2f6d Improve behavior of SDL_events_need_periodic_poll() and SDL_events_need_polling()
SDL_events_need_periodic_poll() and SDL_events_need_polling() are intended to allow the event loop to update joysticks and/or sensors if needed, however those systems only update when the SDL_update_joysticks and/or SDL_update_sensors variables are true. This change brings the behavior of these functions in line with if work will actually need to be performed.

This change allows the hints for AUTO_UPDATE to influence the polling behavior of the event loop such that an app can choose to update joysticks/sensors itself and avoid the expense of constantly sleeping and waking the event loop. Additionally in makes these functions marginally faster in some situations by not searching the active events.
2022-07-25 09:00:31 -07:00
diddily d9bda89fce Fix updating SDL_update_joysticks and SDL_update_sensors in response to hint changes
Hint callbacks are called before the actual value in the hint is changed, so the functions SDL_AutoUpdateJoysticksChanged and SDL_AutoUpdateSensorsChanged were not actually properly updating their respective variables in repsonse to their auto update hint changing.

Instead, we pull the new hint value out of the value passed into the callback and use that to update the variables. Assume true on a null value as that was the previous behavior and it matches with the default values of SDL_update_joysticks/SDL_update_sensors.
2022-07-25 09:00:31 -07:00
diddily 0ec5bb4e6d Add missing controller events to `SDL_GameControllerEventState()`
Events to handle controller touchpads and sensors were added to the library but not added in `SDL_GameControllerEventState()`. This change adds the missing events.
2022-07-25 08:55:17 -07:00
Anonymous Maarten f86ec47f86 ci: don't use ANDROID_NDK_HOME environment variable in Android workflow 2022-07-25 15:08:33 +02:00
Sam Lantinga 4d66501736 Fixed building with 10.9 SDK
Fixes https://github.com/libsdl-org/SDL/issues/5954
2022-07-24 18:04:26 -07:00
Cameron Gutman 3ab1e303ec joystick: Refactor and fix a few bugs in Shield HIDAPI driver
- CMD_CHARGE_STATE was checking the seqnum instead of the payload
- Off-by-one error in size validation for command payload
- Unused payload space was left uninitialized in output report
2022-07-24 15:36:30 -05:00
Cameron Gutman b8a5540740 testgamecontroller: Add battery reporting 2022-07-24 15:21:04 -05:00
Sam Lantinga 4d8bb89c46 Fixed mouse clip rect bounds on Windows
Fixes https://github.com/libsdl-org/SDL/issues/5946
2022-07-24 11:50:14 -07:00
Dean Herbert 6bcde52d88 Further adjust implementation of `Cocoa_GetWindowDisplayIndex`
As discussed in PR review, there may be an off-chance that the index
returned doesn't match up with SDL's display indexing.

This change ensures that the indices match and adds a safety check for
off-screen windows.
2022-07-24 09:25:16 -07:00
Dean Herbert ce8aae1419 Fix `Cocoa_GetWindowDisplayIndex` failing and causing a catastrophic crash
With the introduction of this function, it is possible that for certain
monitor and window configurations, creating an SDL window will cause a
native crash.

```
Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000050
Exception Codes:       0x0000000000000001, 0x0000000000000050
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [56627]

VM Region Info: 0x50 is not in any region.  Bytes before following region: 140737486737328
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->
      VM_ALLOCATE              7fffffe75000-7fffffe76000 [    4K] r-x/r-x SM=ALI

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libSDL2.dylib                            0x10247f665 SDL_UpdateFullscreenMode + 357
1   libSDL2.dylib                            0x10247ec70 SDL_CreateWindow_REAL + 1504
2   ???                                      0x111262de8 ???
3   ???                                      0x110c39fff ???
4   libcoreclr.dylib                         0x101fdf2a9 CallDescrWorkerInternal + 124
```

Tracking thread from our end: https://github.com/ppy/osu-framework/issues/5190
Regressed with: https://github.com/libsdl-org/SDL/pull/5573

In testing, the window would not find a valid screen if created
"hanging" off a primary display with a secondary display below it. In
checking why this was the case, the `display_centre` was being
calculated with a negative y origin, causing a final negative value
falling outside all display bounds:

```
SDL error log [debug]: display_centre.y = -1296 + 1296 / 2

SDL error log [debug]: Display rect 0: 0 0 2560 1440
SDL error log [debug]: Display rect 1: 2560 -625 1080 2560
SDL error log [debug]: Display rect 2: 0 1440 1728 1296
```

The method that was being used to find the current window using the frame
origin/size seems unreliable, so I have opted to replace it with with a
tried method (https://stackoverflow.com/a/40891902).

Initial testing shows that this works with non-standard DPI screens, but
further testing would be appreciated (cc @sezero / @misl6 from the
original PR thread).
2022-07-24 09:25:16 -07:00
Sebastian Krzyszkowiak 041666e6c3 video: wayland: Don't switch to libdecor path for borderless windows
We actually request CSD mode with xdg-decoration for borderless
windows, so we get what we wanted there and there's no point in going
into fallback paths.
2022-07-24 10:59:42 -04:00
Sebastian Krzyszkowiak 405d1f6598 video: wayland: Roundtrip after falling back to libdecor in xdg-decoration handler
Otherwise libdecor doesn't have a chance to acquire xdg-toplevel after
libdecor_new before we attempt to use it in Wayland_ShowWindow.

Fixes #5952
2022-07-24 10:57:51 -04:00
Anonymous Maarten fc2497b109 Revert "cmake: don't add -mwindows to link flags in sdl2.pc"
This reverts commit d211aaddc1.
2022-07-23 18:05:35 +02:00
Anonymous Maarten 2fdedd17be Revert 6fa7d62 and 856c99e5 2022-07-23 17:29:45 +02:00
Anonymous Maarten 856c99e583 android: target android-19 by default when building with build-scripts/androidbuildlibs.sh 2022-07-23 16:28:50 +02:00
Anonymous Maarten 832754b970 ci: install SDL when built as a subproject 2022-07-23 15:43:06 +02:00
Anonymous Maarten 6fa7d62408 ci: use android-ndk r25 (LTS) on CI 2022-07-23 15:31:35 +02:00
Anonymous Maarten d211aaddc1 cmake: don't add -mwindows to link flags in sdl2.pc 2022-07-23 15:29:39 +02:00
Anonymous Maarten d63a699e01 cmake: by default, disable install target when building SDL as a subproject 2022-07-23 15:29:13 +02:00
Ozkan Sezer 8c51cae784 audio/aaudio, audio/openslES: fix -Wdeclaration-after-statement errors
Fixes https://github.com/libsdl-org/SDL/issues/5950
2022-07-23 14:56:04 +03:00
slime 65647b3417 SDL_Render: use high precision texcoords in ES2 shaders, when possible
Fixes #5884
2022-07-22 19:03:53 -07:00
Sam Lantinga f9beef760a Added support for the Nintendo Switch Joy-Con Controllers on iOS and tvOS 16 2022-07-22 18:58:29 -07:00
Sam Lantinga aad7ef6eaf Added support for the Nintendo Switch Pro Controller on iOS and tvOS 16 2022-07-22 10:58:34 -07:00
Sam Lantinga 59963473ef Enable bitcode by default for iOS and tvOS builds 2022-07-22 10:58:32 -07:00
Sam Lantinga 20f51b1fd7 Fixed crash if debug text wasn't drawn during a session 2022-07-22 10:58:29 -07:00
Ozkan Sezer 8cd515c324 better wording. 2022-07-22 20:37:28 +03:00
Frank Praznik 41b89aec19 video: Improve the SDL_WINDOW_ALLOW_HIGHDPI flag documentation
Extend the SDL_WINDOW_ALLOW_HIGHDPI flag documentation to stress the importance of querying the window drawable size after every window event to avoid rendering issues in a mixed-DPI environment.
2022-07-22 13:01:57 -04:00
Ivan Epifanov 0a1641635d VIta: enable arm neon/simd optimisations 2022-07-21 10:45:45 -07:00
Anonymous Maarten e5698d1394 cmake: allow cmake re-configuration after installation of x11 library
check_include_path is not meant to be used to check for presence of a
library. This is because a BOOL is cached.
Avoid this caching by using find_file.
`find_file` caches a patch instead of a bool and will always run when
the result failed.
2022-07-21 18:38:12 +02:00
Ozkan Sezer 192ae1e356 WhatsNew.txt: added line for the calling convention fixes. 2022-07-21 17:11:30 +03:00
Anonymous Maarten 9ad3711a6b cmake: only enable x11_xss/x11_xrandr/x11_xfixes when its lib is available 2022-07-21 15:19:19 +02:00