Commit Graph

4890 Commits (59e510b0b664886171259141c1352cf462453942)

Author SHA1 Message Date
Ozkan Sezer 870c44bfed safer this way, just in case.. 2018-09-25 09:20:56 +03:00
Sam Lantinga da89b81c3c Fixed rare null pointer dereference 2018-09-24 20:31:24 -07:00
Sam Lantinga ef34704875 Fixed bug 4264 - SDL_CreateTextureFromSurface generates error message but returns ok
Anthony @ POW Games

SDL_CreateTextureFromSurface makes an internal call to SDL_GetColorKey which can return an error and spams the error log with "Surface doesn't have a colorkey" even though the original function didn't return an error.
2018-09-24 16:41:55 -07:00
Sam Lantinga cd90e2ca58 Fixed bug 4267 - linkage failure with --enable-hidapi because of missing libudev symbols
Ozkan Sezer

hidapi dynamic udev initial patch
2018-09-24 16:33:14 -07:00
Sam Lantinga e0fe8f3cb3 Support relative mouse for Samsung DeX on Samsung Experience 9.5 or later (Android 8.1 or later) 2018-09-24 11:53:04 -07:00
Sam Lantinga 5febdfcece Fixed whitespace 2018-09-24 11:49:25 -07:00
Drew Pirrone-Brusse 58021b3834 Correct the name of the SDL shared library in CMake for Mac OS 2018-08-18 17:23:40 -04:00
Sam Lantinga 8aaef4b914 Fixed bug 3166 - It would be nice, if SDL would support including SDL project as a subdirectory into another CMake project
Wayde Reitsma

After attempting to use SDL2 in the way described in this bug, I found the main issue was the includes not being added to the compiler command.

I found the issue was that the target_include_directories commands for the SDL2, SDL2-static and SDL2main targets only sets the public includes for installations using the INSTALL_INTERFACE generator expression.

I have written a patch to CMakeLists.txt that fixes this issue by adding another item to the target_include_directories commands, utilizing the BUILD_INTERFACE generator expression to correctly add the include directory during builds.
2018-09-24 08:41:59 -07:00
Sam Lantinga d07fe7ad95 Removed button logging message 2018-09-21 09:41:21 -07:00
Sam Lantinga e8b0859f17 Added missing call to WindowsDeleteString() 2018-09-20 15:55:52 -07:00
Sam Lantinga 600126c90e Added experimental support for Windows.Gaming.Input 2018-09-19 10:03:40 -07:00
Ryan C. Gordon c19516b50c cmake: correctly report Vulkan support at configure time (thanks, Tiago!).
Fixes Bugzilla #4262.
2018-09-18 11:49:42 -04:00
Sam Lantinga c179d3948a Fixed NullPointerException if there's no singleton 2018-09-17 12:08:05 -07:00
Sam Lantinga f6a537cbfa Store the API device refcount on the device itself, so if the device is disconnected and we have multiple application references to it, we only free it once. 2018-09-17 11:35:24 -07:00
Sam Lantinga 59a2d12cc3 Fixed creating an Android game controller mapping for HIDAPI devices on initialization 2018-09-17 11:35:22 -07:00
Ozkan Sezer 305e5968aa do not export hidapi symbols from SDL dlls (bug #4259). 2018-09-15 14:28:10 +03:00
Ozkan Sezer 5a34f1e3ee acinclude: rename ax_gcc_x86_cpuid.m4.htm to ax_gcc_x86_cpuid.m4 2018-09-15 09:24:04 +03:00
Ozkan Sezer bab5b08437 fix permissions 2018-09-15 08:11:50 +03:00
Sam Lantinga 6b3e893105 Added hints SDL_HINT_MOUSE_DOUBLE_CLICK_TIME and SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS to allow tuning double-click sensitivity.
Also increased the default double-click radius to 32 pixels to be more forgiving for touch interfaces
2018-09-14 19:26:26 -07:00
Sam Lantinga 66294d31df Guard against Steam Controller input when we're shutting down. 2018-09-14 18:31:03 -07:00
Sam Lantinga e8a0e35e24 Use atomic reference counting for the HID device object 2018-09-14 18:31:01 -07:00
Sam Lantinga 6a7b0c27af Fixed crash launching under Steam on Mac OS X 2018-09-14 12:41:29 -07:00
Sam Lantinga 0b3a350c90 Fixed Chinese IME support (thanks ???!) 2018-09-10 23:01:33 -07:00
Sam Lantinga af823cc1d9 Fixed building on tvOS 2018-09-10 23:00:09 -07:00
Sam Lantinga 63848141c1 Fixed building on tvOS without any sensor support 2018-09-10 22:59:49 -07:00
Ozkan Sezer 33381d3d10 hidapi/SDL_hidapijoystick.c: fix build in C90 mode:
src/joystick/hidapi/SDL_hidapijoystick.c: In function 'HIDAPI_InitializeDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: 'true' undeclared (first use in this function)
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: (Each undeclared identifier is reported only once
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: for each function it appears in.)
src/joystick/hidapi/SDL_hidapijoystick.c: In function 'HIDAPI_UpdateDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:339: error: 'true' undeclared (first use in this function)
src/joystick/hidapi/SDL_hidapijoystick.c:341: error: ISO C90 forbids mixed declarations and code
2018-09-07 11:03:24 +03:00
Ozkan Sezer afc1738ecb SDL_sensor.h, SDL_video.h: remove comma at end of enumerator lists.
Avoids gcc -pedantic warnings, closes bug #4253.
2018-09-07 10:47:50 +03:00
Anthony Pesch c591429542 alsa: avoid hardware parameters with an excessive number of periods.
The previous code attempted to use set_buffer_size / set_period_size
discretely, favoring the parameters which generated a buffer size that was
exactly 2x the requested buffer size. This solution ultimately prioritizes
only the buffer size, which comes at a large performance cost on some machines
where this results in an excessive number of periods. In my case, for a 4096
sample buffer, this configured the device to use 37 periods with a period size
of 221 samples and a buffer size of 8192 samples. With 37 periods, the SDL
Audio thread was consuming 25% of the CPU.

This code has been refactored to use set_period_size and set_buffer_size
together. set_period_size is called first to attempt to set the period to
exactly match the requested buffer size, and set_buffer_size is called second
to further refine the parameters to attempt to use only 2 periods. The
fundamental change here is that the period size / count won't go to extreme
values if the buffer size can't be exactly matched, the buffer size should
instead just increase to the next closest multiple of the target period size
that is supported. After changing this, for a 4096 sample buffer, the device
is configured to use 3 periods with a period size of 4096 samples and a buffer
size of 12288 samples. With only 3 periods, the SDL Audio thread doesn't even
show up when profiling.

Fixes Bugzilla #4156.
2018-05-04 21:21:32 -04:00
Ryan C. Gordon c70db0cabf cmake: Look in popular places for X11 headers, export this info properly.
Fixes CMake not being able to find X11 on FreeBSD (which generally has the
headers in /usr/local/include/X11).

List of other popular places borrowed from CMake's FindX11 module.

This worked on the configure script because of magic in the AC_PATH_X macro.

Fixes Bugzilla #4815.
2018-06-24 15:12:18 -04:00
Ryan C. Gordon 59574fe2f0 x11: Normalize x11xinput2 touch x to be 1.0 at width (thanks, Zach!).
"Applications (such as SDL's testgesture) do "event.tfinger.x * window_width"
to find window coord. Currently the X11 XInput2 backend expects application
to do "event.tfinger.x * (window_width-1)" instead.

X11 XInput2 touch events are normalized so x is 1.0 at "width - 1" but other
SDL backends appear to have x be 1.0 at "width". Same issue for touch event
y with regards to height."

Fixes Bugzilla #4183.
2018-06-24 13:57:22 -04:00
Tomeu Vizoso fe6828272a egl: Don't change context when deleting current.
If we change the current context behind the app's back, those tracking
the current context to minimize context changes are going to get
confused.

This brings the EGL backend in line with the GLX one.

Fixes Bugzilla #4199.
2018-06-14 06:12:12 +00:00
Ryan C. Gordon 5308a245a4 Fixed some possible malloc(0) calls reported by static analysis. 2018-06-24 12:16:58 -04:00
Sam Lantinga 88dfa46644 Use a blank cursor instead of PointerIcon.TYPE_NULL since that shows the default cursor on Samsung DeX 2018-06-18 13:14:04 -07:00
Sam Lantinga a515853569 Added support for external mouse in Samsung DeX mode
relative mode doesn't work, but absolute coordinates are functional
2018-06-18 13:14:02 -07:00
Sam Lantinga f1d8f5f7fd Make certain we only hide system UI when we're fullscreen for real. (thanks Rachel!) 2018-06-18 13:14:00 -07:00
Sam Lantinga 8b574dc43c Deal with situations where the system UI is shown when the keyboard pops up (thanks Rachel!) 2018-06-18 13:13:58 -07:00
Sam Lantinga 74ec7cabdb Fixed race condition where Android touch events could get scaled by a render target's viewport 2018-06-18 13:13:56 -07:00
Sam Lantinga 9924a8e392 Fixed bug 4094 - No SDL_TEXTEDITING after pressing Alt key on Raspberry Pi Linux
This was reproducible by running an SDL app on the console from an ssh login. In this case the terminal wasn't owned by the user running the app, so we were using the default keymap, which didn't have state transitions defined for ctrl and alt, so once we entered that state keypresses would no longer transition out of that state, nor would they generate text.

As a workaround, we'll just reset to the default shift state if that happens, which means we'll get text for keys pressed while ctrl is held down, but I don't think that's a big problem.

Note that in this case we also can't mute the keyboard, so the keypresses go to the console, which probably isn't what you want...
2018-06-14 00:51:45 -07:00
Sam Lantinga 12ff19c035 SDL Android fullscreen code extensively tested on Steam Link with no issues reported 2018-06-13 14:24:30 -07:00
Ozkan Sezer 08de74ec49 use the 'aborts' pragma of Watcom for SDL_NORETURN functions
SDL_ExitProcess(), SDL_AbortAssertion() and SDLTest_BailOut().

(Commit 303c1e0fb0cf for bug #4100 removed SDL_NORETURN from
SDL_ExitProcess() and SDL_AbortAssertion() in order to avoid
warnings from windows builds, but that's temporary I guess..)
2018-06-13 14:45:02 +03:00
Sam Lantinga 4a4bac95eb Deal with fullscreen limitations under windowed Android environments (Chromebook, DeX, etc.) (Thanks Rachel!) 2018-06-12 13:22:58 -07:00
Ozkan Sezer 41da7b79c0 ran 'chmod -x' on many files 2018-06-12 14:00:15 +03:00
Sam Lantinga 864b8f89fa Merged in community contributed controller mappings from https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt 2018-06-12 01:04:26 -07:00
Sam Lantinga 1205978244 Added common controllers used with Steam Big Picture
These are entirely untested
Several USB ids refer to multiple packaged products. In those cases I tried to use the most common name, or a general name (e.g. PS3 Controller), or a completely generic name (e.g. USB gamepad) if it wasn't clear what type of controller it was.
Patches welcome!
2018-06-12 00:18:10 -07:00
Sam Lantinga 63317dfb17 Don't crash on exit from SDLActivity if we don't have a singleton for some reason. (Thanks Rachel!) 2018-06-07 17:07:05 -07:00
Sam Lantinga fe196db774 Track android device panel width & height as well as window surface & height.
Expand SDLActivity::SDLSurface::surfaceChanged() callback to grab the panel width and height at the same time and pass that along to the native code. Only works on API 17+. Duplicates surface dimensions whenever it fails.

Add Android_DeviceWidth/Android_DeviceHeight globals to native code.
Disambiguate Android_ScreenWidth/Android_ScreenHeight -> Android_SurfaceWidth/Android_SurfaceHeight
Use device width/height for all display mode settings.
2018-06-07 17:07:03 -07:00
Sam Lantinga db86e7a633 Added support for the PS3 controller driver in PlayStation Now 2018-06-07 10:54:54 -07:00
Sam Lantinga 77709aecc7 Added Android hardware feature support to the default manifest 2018-06-06 09:42:12 -07:00
Sam Lantinga 7c5f3cf3cb Added improved mouse pointer capture under API 26. (Thanks Rachel!) 2018-06-05 14:08:39 -07:00
Sam Lantinga 113801b790 Added SDL_IsChromebook() to determine if we're running on a Chromebook. 2018-06-05 12:46:13 -07:00