Commit Graph

7220 Commits

Author SHA1 Message Date
Ozkan Sezer 89a2980a6d CMake: fixes to pthreads detection.
changes unnecessary check_c_source_runs to check_c_source_compiles,
removes the reduntant cross-compile check, and defines _GNU_SOURCE
for PTHREAD_MUTEX_RECURSIVE checks just like the autotools version.

Fixes: https://github.com/libsdl-org/SDL/issues/4262
Closes:  https://github.com/libsdl-org/SDL/pull/4282
2021-04-25 01:28:03 +03:00
Ivan Epifanov ca969eb2be Remove gles2 vita render 2021-04-24 14:13:09 -07:00
Ivan Epifanov 058bbe0286 Set volume on device open 2021-04-24 14:13:09 -07:00
Ivan Epifanov e3ea5b6468 Migrate to lightweight mutexes 2021-04-24 14:13:09 -07:00
Steven Noonan f1ad942a11 SDL_windows_main: use HeapAlloc/HeapFree for command line arguments
If a developer uses SDL_SetMemoryFunctions, we can't rely on SDL_free()
working when SDL_main() returns.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
2021-04-22 17:26:13 -07:00
Steven Noonan 17d8479d98 hidapi/libusb: maintain in-memory cache of vendor/product strings
The get_usb_string call is rather expensive on some USB devices, so we
cache the vendor/product strings for future lookups (e.g. when
hid_enumerate is invoked again later).

This way, we only need to ask libusb for strings for devices we haven't
seen since before we started.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
2021-04-22 16:40:23 -07:00
Steven Noonan 4535d65491 HIDAPI_UpdateDiscovery: only treat "add" and "remove" events as relevant
I have a buggy system which reports a udev "change" event for an empty
USB-C port every 0.14 seconds, which causes annoying frame hitches
because SDL decides that means it needs to do a libusb hid_enumerate,
which is slow (~25ms!) because of the get_usb_string() calls in there.

We only need to re-enumerate if we've seen a device added or removed, so
let's filter out the change event first.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
2021-04-22 16:40:16 -07:00
Steven Noonan b15bbd4e3f SDL_udev: check for NULL return value from udev_device_get_action
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
2021-04-22 16:39:22 -07:00
Sylvain cf05a5eb0c
eglChooseConfig: only add EGL_DEPTH_SIZE if non 0
and fix static / shadowed variables warnings for dump configs
2021-04-22 21:40:57 +02:00
Sylvain 98a966d1c2
Android: don't need to set the SurfaceHolder format from java code
It's already set with ANativeWindow_setGeometry, and eventually set/changed also by eglCreateWindowSurface.
 - avoid issues with older device where SurfaceView cycle create/changed/destroy appears broken:
   calling create/changed/changed, and leading to "deuqueBuffer failed at server side, error: -19", with black screen.
 - re-read the format after egl window surface is created, to report the correct one (sometimes, changed from RGBA8888 to RGB24)
2021-04-22 18:06:17 +02:00
Ethan Lee 8e3ec34d34 wayland: Refactor toplevel mapping, implement HideWindow 2021-04-21 13:11:47 -04:00
Cacodemon345 0838f53d5a Implement SDL_SetWindowAlwaysOnTop for X11 2021-04-21 13:09:10 -04:00
Mathieu Eyraud a5825576fb Fix error handling of wayland message box
Zenity return a small integer on success which may be the same as EXIT_FAILURE. Use a bigger integer for error reporting from child process.
2021-04-21 09:53:39 -04:00
Mathieu Eyraud 12dd412b0b Fix icon of wayland message box
Also add some comments and silence a warning.

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
2021-04-21 09:53:39 -04:00
meyraud705 d0cf3b7555 Return correct button id 2021-04-21 09:53:39 -04:00
meyraud705 1fd95c53b6 Disable pango markup in wayland massage box
Zenity support pango markup, add --no-markup to disable it.
2021-04-21 09:53:39 -04:00
meyraud705 0cd0e9ba98 Reimplement wayland message box function with execvp.
Previous version used 'popen' which required to sanitize user provided text. Not
sanitizing text could cause failure if user provided text included a " or command
injection with `cmd`.
2021-04-21 09:53:39 -04:00
Cacodemon345 99ef03b96e KMSDRM: Only use OpenBSD-specific defines on pre-6.9 releases 2021-04-20 19:44:55 -07:00
Joseph Lyncheski a0a5da5d91 Add SDL_SetWindowAlwaysOnTop() 2021-04-20 08:45:28 -07:00
Sylvain 6be9c00970
Android: prevent error EGL_BAD_DISPLAY while getting egl version without display
There is an error "E libEGL  : validate_display:91 error 3008 (EGL_BAD_DISPLAY)"
that occurs when calling "eglQueryString(display, EGL_VERSION)", with EGL_NO_DISPLAY.

Khronos says "EGL_BAD_DISPLAY is generated if display is not an EGL display connection, unless display is EGL_NO_DISPLAY and name is EGL_EXTENSIONS."
but this was added in SDL with "EGL 1.5 allows querying for client version"
( 56363ebf61 )

In fact:
- it actually doesn't work on Android that has 1.5 egl client
- it works on desktop X11 (using SDL_VIDEO_X11_FORCE_EGL=1)

The commit moves the version call where it's used, eg inside the "if (platform) {"
and checks that "eglGetPlatformDisplay" has been correctly loaded.
2021-04-20 13:46:25 +02:00
Ryan C. Gordon 03503423e9
filesystem: Better OpenBSD support for SDL_GetBasePath().
Fixes #3752.
2021-04-19 23:32:45 -04:00
ReNoM de6d290266 Fix keymap updating for X11 backend 2021-04-19 15:54:09 -04:00
Ethan Lee 509228c423 wayland: Implement GetDisplayDPI 2021-04-19 00:14:15 -04:00
Ethan Lee fcbfe33ce5 wayland: Implement SetWindowModalFor 2021-04-19 00:14:15 -04:00
Ethan Lee 213bfc194e wayland: Implement RestoreWindow for xdg/zxdg 2021-04-19 00:14:15 -04:00
Ethan Lee 0f51800229 wayland: Removed unused GetDisplayModes/SetDisplayMode functions 2021-04-19 00:14:15 -04:00
Ethan Lee 46df195b2a wayland: Implement GetDisplayBounds 2021-04-19 00:14:15 -04:00
Ethan Lee ed24c3452a wayland: Implement basic window move events via wl_surface_listener.
This unearthed an unspeakably large amount of bugs in the wl_output enumerator,
notably the fact that the wl_output user pointer was to temporary memory!
This was "fixed" in e862856, and was then pointed out as a leak in 4183211,
which was undone in d9ba204. The busted fix was correct that the malloc was an
issue, but wrong about _why_; SDL_AddVideoDisplay copies by value and does not
reuse the pointer, so generally you want your VideoDisplay to be on the stack,
but of course the callbacks don't allow that, so a malloc was a workaround. But
we can do better and just host our temporary display inside WaylandOutputData
because that will be persistent while also not leaking.

Wait, wasn't I talking about move events? Right, that: wl_surface_listener does
at least give us the ability to know what monitor we're on, even though we have
no idea where we are on the monitor. All we need to do is check the wl_output
against the display list and then push a move event that both indicates the
correct display while also not being _too_ much of a lie (but enough of a lie
to where our event doesn't get discarded as "undefined" or whatever). The index
check for the video display is what spawned the great nightmare you see before
you; aside from the bugfix this is actually a really basic patch.
2021-04-16 21:12:02 -07:00
Sylvain 859230ec82
Android: add AAudio entry in CMake SDL_config 2021-04-16 13:04:36 +02:00
Sylvain d4e96e1153
Android: enable audio driver OpenSLES when building with CMake 2021-04-16 09:44:07 +02:00
Sylvain b4f89c56c6
AAudio: add aaudio pause/resume function to android events loop 2021-04-15 21:16:10 +02:00
Sylvain 02b1ebc9e0
Android: add openslES and AAudio compilation to CMakeLists 2021-04-15 21:13:17 +02:00
Sylvain 146656cfe6
AAudio: add compilation to Android.mk, but not activated in SDL_config_android.h 2021-04-15 21:03:10 +02:00
Sylvain f1fab24e35
AAudio: add bootstrap in SDL_audio.c 2021-04-15 21:00:00 +02:00
Sylvain 04b2f5f6ec
Android: add AAudio back-end, with playback and capture (see #3710)
https://developer.android.com/ndk/guides/audio/aaudio/aaudio
2021-04-15 20:54:58 +02:00
Sylvain 4118fe62fe
Android: OpenSLES, explicitly initialise the global variable 'bqPlayerPlay',
it may be read even if OpenSLES back-end hasn't been intialized
2021-04-15 20:52:43 +02:00
Ozkan Sezer babd79b8ef bump minimum required autoconf version and revise autogen.sh 2021-04-14 23:20:40 +03:00
Ozkan Sezer 69203851dc rename PKG_CONFIG_LIBS_PRIV to PKGCONFIG_LIBS_PRIV
i.e.: do not steal PKG_CONFIG namespace.
2021-04-14 21:40:50 +03:00
Ozkan Sezer 197cfcaf71 ran configure.ac through autoupdate-2.69
generated configure script is practically the same except for whitespace
changes.
2021-04-14 21:10:40 +03:00
Sam Lantinga 499d31e9cd Cleanup Linux joystick code 2021-04-13 17:00:24 -07:00
Luis Cáceres 5c78df9c23
Support key composing (i.e. dead keys) in Wayland driver (#4296)
Based on an old patch by chw from the old Bugzilla issue tracker.

Authored-by: chw

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2021-04-13 16:56:50 -07:00
Sam Lantinga b04136e75e Fixed Xbox controller when using the default Linux gamepad mapping
Tested with the Xbox Series X controller and the xow driver
2021-04-13 16:29:48 -07:00
Sam Lantinga 1aaafc2bd8 Show the real name of the Xbox controller when using the generic mapping on Linux 2021-04-13 16:29:46 -07:00
Paul Cercueil 1542300a89 joystick: linux: Avoid checking for gamepad mapping each frame
The information whether a specific joystick can be used as a gamepad is
not going to change every frame, so we can cache the result into a
variable.

This dramatically reduces the performance impact of SDL2 on small
embedded devices, since the code path that is now avoided was quite
heavy.

Fixes #4229.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-04-13 16:07:35 -07:00
okuoku 401f485490 cmake: Weak link with CoreHaptics
Add link to CoreHaptics so we can compile against latest iOS SDKs.
2021-04-13 16:04:04 -07:00
Kyle Schaefer dbedaeceb3 Adding checks to see if any ASAN flags are set, if so then we set(HAVE_ASAN ON) so the infomartion output will properly list ASAN as on. 2021-04-13 16:03:37 -07:00
Kyle Schaefer 70bd205bb1 Adding messages to output CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG, this way when using Debug builds you can see which debug flags are set 2021-04-13 16:03:37 -07:00
Kyle Schaefer 320666044e Moving ASAN macros and calls to macros above the information output section so we can display ASAN information properly. 2021-04-13 16:03:37 -07:00
Ethan Lee f88d91d596 wayland: Minor whitespace fix 2021-04-13 16:02:53 -07:00
Ethan Lee d785dab5fd wayland: Add unscaled resolutions to the display mode list 2021-04-13 16:02:53 -07:00