10175 Commits

Author SHA1 Message Date
Sam Lantinga
531ddf5eb5 Fixed macOS framework detection in sdl2.m4
Fixes https://github.com/libsdl-org/SDL/issues/6141
(cherry picked from commit 3d516b841a5c643e049804c72c9193229535fb30)
2022-09-12 23:28:28 +03:00
Sam Lantinga
abac672a2d Fixed crash if there are no devices available
(cherry picked from commit 679582e702bef0ccd743f07dab860ebce8912856)
2022-09-12 21:33:50 +03:00
Ozkan Sezer
782862b95c apply commit d0a3570300812bc81888e7a7eadb9311621dc9a7 to cmake side too.
(cherry-picked from commit 5b2884cb0203cc63bf9753f8b55ea4c6c6f19cfb)
2022-09-12 20:37:56 +03:00
Ozkan Sezer
525e201728 regenerated configure script.
(cherry-picked from commit d936499670e4ec46c6f92633b129ab25b2208e75)
2022-09-12 20:37:56 +03:00
Sam James
0680314c2a configure.ac: fix configure tests broken with Clang 15 (implicit function declarations)
Clang 15 makes implicit function declarations fatal by default which
leads to some configure tests silently failing/returning
the wrong result.

Signed-off-by: Sam James <sam@gentoo.org>
(cherry-picked from commit d0a3570300812bc81888e7a7eadb9311621dc9a7)
2022-09-12 20:37:56 +03:00
Ozkan Sezer
7be77f0b3d Fix https://github.com/libsdl-org/SDL/issues/6191
(cherry picked from commit 5ffede35d94e2ba513114996447df9484e195ac6)
2022-09-06 19:56:55 +03:00
Cameron Cawley
e70db38d60 Fix compatibility with Windows XP
(cherry picked from commit 10e1ef00e29479f3ac0ba4d0bf3e0083fca8b2a0)
2022-09-06 17:10:00 +03:00
Anonymous Maarten
08e8824372 cmake: fix location of SDL2::SDL2test imported library 2022-09-05 21:54:48 +02:00
Gleb Mazovetskiy
b6661c016b CMake: Make SDL_SHARED/STATIC/TEST options
This makes it easier to set these options when SDL is used as a subprojects.
Since CMake v3.13+, one can simply `set(SDL_TEST OFF)` before include the SDL2 subproject because options do not override existing variables. (https://cmake.org/cmake/help/latest/policy/CMP0077.html#policy:CMP0077)
This is also true for `set(CACHE)` commands but only in CMake v3.21+ (https://cmake.org/cmake/help/latest/policy/CMP0126.html).
2022-09-04 13:59:43 +02:00
Anonymous Maarten
62302d08f1 cmake: always create SDL2::SDL2main target in autotools' cmake config script 2022-08-24 06:41:20 -07:00
Anonymous Maarten
b19e2f1e56 cmake: create SDL2::SDL2main target in Apple framework official release 2022-08-24 06:41:20 -07:00
Oleg Derevenetz
ac44b22a24 Use __ARM_ARCH instead of __ARM_ARCH__ 2022-08-22 18:22:03 -07:00
slime
84004d1e47 cocoa: change Shape data to use ObjC objects instead of C structs.
Fixes #6089
2022-08-21 15:36:34 -07:00
Anonymous Maarten
329794daf3 cmake: add library directories & pthread to imported targets of sdl2-config.cmake
This fixes linking to SDL2::SDL2-static on systems where external libraries such as X11 are not in a standard location.
Pthread also needs special care.
2022-08-20 19:17:37 -07:00
Sam Lantinga
3739dda6bd Fixed minimized window detection when handling WM_WINDOWPOSCHANGED
When minimizing a window, we get this sequence of events:
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_NCCALCSIZE
WM_WINDOWPOSCHANGED - IsIconic() is true
WM_MOVE
WM_SIZE - SDL sees minimized state here

When restoring a window, we get this sequence of events:
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_NCCALCSIZE
WM_NCPAINT
WM_ERASEBKGND
WM_WINDOWPOSCHANGED - IsIconic() is false
WM_MOVE
WM_SIZE - SDL sees restored state here

On Windows 10 a minimized window has a non-empty client rect, so we were delivering a minimized size before SDL knows that the window is minimized, and then ignoring the restored size when handling the restore message.

The fix is to use IsIconic() which returns the correct window state when WM_WINDOWPOSCHANGED is actually delivered.
2022-08-19 17:40:30 -07:00
Sam Lantinga
8c9beb0c87 Updated to version Updated to version 2.24.0 for release release-2.24.0 2022-08-19 08:44:09 -07:00
Sam Lantinga
6e007c36e7 Add null termination to Wayland_data_source_get_data() if requested
Fixes https://github.com/libsdl-org/SDL/issues/6083
2022-08-18 19:05:55 -07:00
Sam Lantinga
948dbe7d3f Don't include the null terminator in Wayland clipboard text
Fixes https://github.com/libsdl-org/SDL/issues/6083
2022-08-18 16:24:20 -07:00
Sam Lantinga
f6b81125b3 Always define SDL_COMPILE_TIME_ASSERT as static_assert() in C++
Apparently some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.

Fixes https://github.com/libsdl-org/SDL/issues/6078
2022-08-18 16:06:42 -07:00
Frank Praznik
3bae2d57da wayland: Set the libdecor app ID after visibility calls
Set the frame app ID after toggling visibility or the name displayed in window manager task switchers may not display correctly.
2022-08-18 10:58:32 -07:00
Ryan C. Gordon
51be30f3cd
emscripten-buildbot.sh: force -s USE_SDL=0
This avoids using Emscripten-provided SDL headers from its own
sysroot instead of the headers in our own include directory!

Reference https://github.com/emscripten-core/emscripten/discussions/17647
2022-08-17 21:39:59 -04:00
Sam Lantinga
8acb4e45b3 Fixed interactions between mouse capture and grab on X11
Fixes https://github.com/libsdl-org/SDL/issues/6072
2022-08-17 14:26:34 -07:00
Frank Praznik
7da74eb5be wayland: Never commit with an undefined window title
If libdecor performs a commit with the frame title being undefined, a crash can occur within the library or its plugins. Always ensure that the title is set to a valid string to avoid this.
2022-08-17 12:40:16 -07:00
Cameron Gutman
99e9156ff5 testgles2: Fix typo in help text 2022-08-16 20:38:55 -07:00
Cameron Cawley
09b6956dcc opengl: Support NV12 textures on GPUs with only 2 texture units 2022-08-16 07:30:13 -07:00
Cameron Cawley
2fcd8f889c Handle SDL_PIXELFORMAT_EXTERNAL_OES in SDL_GetPixelFormatName() 2022-08-16 07:29:45 -07:00
Cameron Gutman
222f1a2693 testgles2: Add --threaded option to use a render thread per window
This is helpful for reproducing bugs like #6056
2022-08-16 07:29:07 -07:00
Sam Lantinga
9670d2bb9e Make sure we hold the joystick lock when disconnecting a HIDAPI joystick
This prevents crashes when calling SDL joystick API functions from a different thread while disconnection is happening.

See https://github.com/libsdl-org/SDL/issues/6063 for a more thorough review of joystick locking.
2022-08-15 17:28:50 -07:00
Ryan C. Gordon
26948f01a3 cocoa: Make SDL_MinimizeWindow() work with borderless windows.
Fixes #6046.
2022-08-15 20:09:09 -04:00
Frank Praznik
650612fdcb wayland: Eliminate excessive calls to SetFullscreen
Eliminate excessive calls to SetFullscreen by removing the calls in the libdecor and xdg-toplevel config callbacks.

These calls were being made there in case something explicitly called the window minimization function from within SDL, which unsets fullscreen, and as minimizing a window in Wayland is just a suggestion to the compositor and doesn't actually change the window state or communicate anything back to the application, it was necessary to call SetFullscreen in every call to the config functions just in case something minimized a window via SDL_MinimizeWindow() and later needed to restore it.  GNOME in particular had issues when fullscreen set/unset operations were being hammered, leading to overlapping acks and commits when switching to fullscreen.

With the new video system flag to disable unsetting fullscreen when minimizing a window, these calls in the configuration functions are no longer needed and can be removed. This significantly reduces calls to the SetFullscreen() function, reverts #6044 while fixing the issue, and fixes a similar problem when hiding and showing a window initially created with fullscreen flags.
2022-08-15 11:16:20 -07:00
Frank Praznik
cc9cc2028d video: Add video device quirk flags and apply them to the video subsystem
Add quirk flags to the video device struct and add flags to allow video backend drivers to disable mode switching and disable unsetting the fullscreen mode when minimizing a window. As certain platforms can have multiple video backends compiled in at once, #ifdefs, as used by other platforms, aren't suitable as different backends on the same platform may not need the same quirks.

This replaces the formerly dedicated 'disable_display_mode_switching' boolean as additional quirks are needed by the Wayland backend.  Helper functions have also been added to simplify reading the flag states.
2022-08-15 11:16:20 -07:00
Sam Lantinga
0cc8dfdb58 Added SDL_system.h for the declaration of SDL_iPhoneSetAnimationCallback() and SDL_iPhoneSetEventPump() 2022-08-15 07:44:56 -07:00
Mathieu Eyraud
c6c688ab01 Add SDL_JOYBATTERYUPDATED event to SDL_JoystickEventState() 2022-08-14 07:00:12 -07:00
Frank Praznik
b72cf207fb core: linux: Don't cache the RealtimeKit D-Bus connection
If the D-Bus subsystem is shutdown and restarted mid-execution, the cached connection will be invalid. Fetch it each time that it is used to ensure that the connection is always from the current context.
2022-08-14 06:59:18 -07:00
Francisco Javier Trujillo Mata
7d5ccae22d Fix memory leak when destroying texture 2022-08-14 08:13:37 -04:00
Francisco Javier Trujillo Mata
5b4b4fa1ff Decrease audio thread priority when created 2022-08-14 08:13:17 -04:00
Sam Lantinga
cf134235d7 Removed line wrapping in patch notes 2022-08-13 08:23:40 -07:00
Sam Lantinga
cb46e1b3f0 Removed unused variable prerelease-2.23.2 2022-08-12 20:51:44 -07:00
Sam Lantinga
67cb3874ef Fixed potential uninitialized variable usage 2022-08-12 20:51:28 -07:00
Frank Praznik
74bdb2115d wayland: Don't roundtrip in ShowWindow unless restoring a hidden window
Don't call the roundtrip in ShowWindow unless restoring a previously hidden window.  This fixes a regression in GNOME when creating a window with the fullscreen flag set, as the fullscreen window will be positioned down the screen by the height of the top bar if the window is made fullscreen on the primary display and the roundtrip is called when initially displaying the window.
2022-08-12 23:34:47 -04:00
Cameron Gutman
3046d55d0e cocoa: Return an error if GetWindowDisplayIndex() is called too early
SDL_CreateWindow() may call GetWindowDisplayIndex() to compute the position
of a new window that the caller has requested to be placed on a certain
display. Since we haven't fully constructed the window yet, our driverdata
will be nil and we will fail to get the NSScreen (which is fine). However,
we need to return an error (not 0, which is a valid display index) for
SDL_GetWindowDisplayIndex() to know to figure out the display index itself.

Fixes positioning new windows on secondary displays when using
SDL_WINDOWPOS_CENTERED_DISPLAY() and SDL_WINDOWPOS_UNDEFINED_DISPLAY().
2022-08-12 20:30:59 -07:00
Sam Lantinga
f1416ef2ba Updated to version 2.23.2 for release candidate 2022-08-12 20:27:22 -07:00
Sam Lantinga
08d17f47b3 Removed unused variable 2022-08-12 20:26:23 -07:00
Sam Lantinga
be0cf257fe Only force the resize event in the DPI changed case
OpenGL windows don't actually get the WM_WINDOWPOSCHANGED event in the SetWindowPos() call in WIN_SetWindowFullscreen(), so setting the window size to zero never gets reset and we're stuck with a zero sized window.

Instead, just force the resize event in WM_DPICHANGED handling, where we know we need it. If we end up needing to force it in WIN_SetWindowFullscreen(), just set a flag in the window data and respond to that in WM_WINDOWPOSCHANGED, but that's a fairly risky behavior change as suddenly all applications would start getting SDL_WINDOWEVENT_SIZE_CHANGED when going fullscreen, and they may respond to that in expensive and potentially disruptive ways.

For later we'll probably create a DPI changed event and respond to that in the renderer instead of this window size changed hack.

This fixes https://github.com/libsdl-org/SDL/issues/6033 @ericwa
2022-08-12 18:21:00 -07:00
Sam Lantinga
b880709e9c Added libusb hack for Gamesir-G3w which needs the same adjustment as the Hori controllers 2022-08-12 18:21:00 -07:00
Cameron Gutman
1b08cd20b3 wayland: Add roundtrip in SetWindowFullscreen() to get new size
The video core assumes that window->w/h will be updated before returning
from SetWindowFullscreen(). This is needed to generate a resize event
with the correct window size when exiting fullscreen.

The roundtrip allows us to receive the configure callback that informs
us of the new window size before returning.

Fixes #6043
2022-08-12 19:03:18 -05:00
Cameron Gutman
780b031b1b wayland: Avoid duplicate resize events when entering fullscreen 2022-08-12 18:47:09 -05:00
Ethan Lee
a28f426acb render: Only update size/scale/viewport when moving to a new display, rather than all window movement.
We really only care about DPI changes here, so this both reduces work and also avoids weird cases where viewport state can be corrupted by trivial window events. This doesn't _completely_ get rid of the issue but this is somewhat intentional, since apps will definitely want to do a full reset when changing displays anyhow (otherwise DPI/adapter changes will screw things up, and that's out of our control as long as both window size and drawable size are exposed at the same time.

Note that OpenGL still captures window events because of weird platform-specific issues like macOS and viewport stretching!

Fixes #5949
2022-08-12 16:13:24 -04:00
Your Name
cfbeb438c1 fix a bug if XINPUTGETBATTERYINFORMATION is nullptr 2022-08-12 10:07:35 -04:00
Sam Lantinga
f42291ce68 Don't change mouse capture based on touch events
Fixes https://github.com/libsdl-org/SDL/issues/5652
2022-08-11 16:13:14 -07:00