Commit Graph

5372 Commits (f4375e86f933ba69318a86431225ada1ed3a5f6f)

Author SHA1 Message Date
Sam Lantinga 52e62329c8 Fixed build error 2019-07-17 16:47:19 -07:00
Sam Lantinga a06d8cd0d4 Merged latest changes from Steam into controller_type.h 2019-07-17 16:47:17 -07:00
Sam Lantinga 1dc24160a1 Add linked list of opened HID devices to prevent accessing already freed devices in device removal callback that is sometimes called even after being unregistered 2019-07-17 16:47:13 -07:00
Sam Lantinga 89de2512e5 Added support for the Victrix Pro Fight Stick for PS4 2019-07-17 13:01:44 -07:00
Cameron Gutman a4bfe2a4ae Allow hotplugging joysticks without udev 2019-06-24 21:08:26 -07:00
Sam Lantinga e7c2cf107a Fixed bug 4704 - SDL_HINT_ANDROID_SEPERATE_MOUSE_AND_TOUCH on Windows?
superfury

I notice that, somehow, when locking the mouse into place(using SDL_SetRelativeMouseMode), somehow at least the movement information gets through to both mouse movement and touch movement events?

My app handles both, so when moving a touched finger accross the app(using RDP from an Android device) I see the mouse moving inside the app when it shouldn't(meaning that the touch movement is ignored properly by the app(press-location dependant) but the mouse movement is still performed due to the mouse movement events)?
2019-07-15 09:36:53 -07:00
Sam Lantinga 064d1223f0 Fixed bug 4723 - Generic Xbox pad controller bindings seem odd/broken
alexrice999

I have a knock off wired xbox 360 controller called afterglow for xbox 360 controller. Despite there being a few afterglow controllers in the controller mapping the guid of my controller seems to map to Generic Xbox pad. This binding is as follows:
```
 "030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
```
When running openmw I have a strange issue that the joysticks work for up and down movements but not for side to side. I managed to track this down to the side to side events being classified as joystick events instead of gamepad events.
I believe this is due to both "leftstick" and "leftx" being bound to "a0" which seems odd to me. If I change openmw's mappings to remove these the controller works as expected. I was hoping someone who knows a lot more than me (as I have only been exploring this today trying to fix my controller) would know what is happening
2019-07-14 16:59:39 -07:00
Jimb Esser 6a7161dceb Blacklist Corsair device causing hang 2019-07-14 16:48:31 -07:00
Alex Szpakowski 8fb8adfc90 macOS: Fix SDL_GL_CreateContext/MakeCurrent on non-main threads causing a Main Thread Checker warning when built with Xcode 11 / the macOS 10.15 SDK.
Fixes bug #4714.
2019-07-13 17:04:02 -03:00
Ryan C. Gordon 73536d93ea ios: Fixed MFi guide button not being detected (thanks, Caleb!).
Fixes Bugzilla #4721.
2019-07-12 21:28:43 -04:00
Ryan C. Gordon 70f0b093ff cmake: Add setupapi library to Windows build dependencies (hidapi needs it).
Fixes Bugzilla #4719.
2019-07-12 13:40:58 -04:00
Ryan C. Gordon 27ad8e5d72 cocoa: Set keyboard mod state correctly when turning off capslock.
Fixes Bugzilla #4716.
2019-07-11 01:07:14 -04:00
Sylvain Becker 86965eecd3 x11: prevent a synthetic mouse event when using a touchscreen
With multitouch, register to receive XI_Motion (which desctivates MotionNotify),
so that we can distinguish real mouse motions from synthetic one.

(bug 4690)
2019-07-10 10:06:28 +02:00
Ryan C. Gordon 6ef01e5236 x11: set some modality things on message boxes with parent windows. 2019-07-09 17:28:02 -04:00
Sylvain Becker 6625203514 SDL_Mouse/Touch: discard synthetic events when hints are not set.
Those are generated/flagged by platform layer.
2019-07-09 11:46:42 +02:00
Ozkan Sezer d550867aef fix permissions 2019-07-09 08:55:00 +03:00
Ryan C. Gordon 66d4d8e25d cmake: Added HIDAPI support. 2019-07-08 16:46:52 -04:00
Ryan C. Gordon 4df22d812c configure: Windows and macOS now respect --enable-hidapi.
(and it defaults to "yes" on those platforms. Other places, which use libusb,
still default to no because they probably need root permissions to work.)
2019-07-08 16:08:16 -04:00
Cameron Gutman 7e09718dfe Ignore synthetic mouse events generated for touchscreens
Windows generates fake raw mouse events for touchscreens for compatibility
with legacy apps that predate touch support in Windows. We already handle
touch events explicitly, so drop the synthetic events to avoid duplicates.
2019-07-07 11:23:16 -07:00
Ryan C. Gordon e841b066fd cocoa: Another attempt at mouse vs touch support.
This time, we make anything we think is a MacBook trackpad report its touches
as SDL_MOUSE_TOUCHID, even though they're not _actually_ synthesized events,
and let all mouse input--even if the OS synthesized it from a multitouch
trackpad on our behalf--look like physical input. This is backwards from
reality, but produces the results most apps will expect.

Note that if you have a real touch device that doesn't appear to be the
trackpad, it'll produce real touch events with unique device ids, so it's
not a total loss here, but also note that the way we decide if it was the
trackpad is an imperfect heuristic; it happens to work out right now, but
it's not impossible that a real touchscreen could come to the Mac at some
point and (incorrectly?) call it a "mouse" input, etc.

But for now, good enough.

Fixes Bugzilla #4690.
2019-07-08 13:41:01 -04:00
Sam Lantinga 680e7937e0 Fixed bug 4710 - audio/alsa: avoid configuring hardware parameters with only a single period
Anthony Pesch

The previous code first configured the period size using snd_pcm_hw_par-
ams_set_period_size_near. Then, it further narrowed the configuration
space by calling snd_pcm_hw_params_set_buffer_size_near using a buffer
size of 2 times the _requested_ period size in order to try and get a
configuration with only 2 periods. If the configured period size was
larger than the requested size, the second call could inadvertently
narrow the configuration space to contain only a single period.

Rather than fixing the call to snd_pcm_hw_params_set_buffer_size_near
to use a size of 2 times the configured period size, the code has been
changed to use snd_pcm_hw_params_set_periods_min in order to more
clearly explain the intent.
2019-07-07 09:10:56 -07:00
Sam Lantinga 67bb882e13 Fixed bug 4707 - SDL_SetRelativeMouseMode fails on Vivante
Cameron Gutman

The bugfix in https://hg.libsdl.org/SDL/rev/ca9417a52f18 caused SDL_SetRelativeMouseMode() to begin failing on Vivante (Steam Link). Even though Vivante doesn't have a SetRelativeMouseMode() or WarpMouse() function, it's in relative mode already (because it uses evdev) so the function was actually working as intended.

I think providing a no-op SetRelativeMouseMode() function for Vivante is a reasonable fix. Since it's already getting relative events through evdev, it really is a no-op to "enter relative mode".

In fact, this is probably the right thing to do for all backends that use evdev (vivante, raspberry, and kmsdrm). Raspberry and kmsdrm both have WarpMouse() implementations so SDL_SetRelativeMouseMode() isn't failing there, but it still seems to make sense not to have to do the fake warping if they're evdev-based anyway.
2019-07-03 15:57:55 -07:00
Sylvain Becker f994da0ef0 Fixed bug 4702 - Android back button does not send SDL_KEYDOWN event
fallback when event.getSource() is SOURCE_UNKNOWN
2019-07-03 13:37:54 +02:00
Sam Lantinga 3fc447dfc9 Fixed bug 4708 - testdropfile: double-free
Juha Niemim?ki

SDLTest_CommonEvent seems to free the file name so testdropfile prints some garbage to console and crashes when freeing the name again.
2019-07-03 02:37:15 -07:00
Ryan C. Gordon b46c771994 raspberry: Actually commit the whole patch. :) (Thanks, Joe!)
Fixes Bugzilla #4699.
2019-07-02 16:49:35 -04:00
Ryan C. Gordon d2d06f4443 cocoa: Don't report trackpad mouse events as synthesized touches.
Fixes Bugzilla #4690, sort of. I guess.
2019-07-02 12:29:36 -04:00
Ryan C. Gordon d2058b45ae raspberry: Fixed missing mouse cursor (thanks, Joe!)
"Starting with changeset 12433, the mouse cursor is not displayed on the
Raspberry Pi platform, due to a bug in the handling of the new
"global_cursor" in RPI_ShowCursor(). Currently, if cursor == global_cursor,
the function immediately returns 0. The function should not return here.
Instead, if cursor == global_cursor, it shouldn't try to hide the current
cursor and update global_cursor = cursor. However, it *should* still continue
through the rest of the function."

Fixes Bugzilla #4699.
2019-07-02 10:26:54 -04:00
Ryan C. Gordon d5ebbcb4e5 dbus: Don't SimulateUserActivity if we're already inhibiting the screensaver. 2019-07-02 09:43:26 -04:00
Ryan C. Gordon 94658099e5 dbus: Add org.freedesktop.ScreenSaver.SimulateUserActivity support. 2019-07-02 09:38:31 -04:00
Alex Szpakowski 027887da15 iOS: Fix the window size not being set properly when Split View is used on an iPad (bug #4586). 2019-07-01 14:52:56 -03:00
Sam Lantinga 972bdfb47f Made it more explicit that 2.0.10 and newer are required for the SDL_RW* functions 2019-07-01 09:05:15 -07:00
Sam Lantinga 60606dfb31 Documented that the SDL_RW* macros no longer exist, and you can't use an older SDL library if you build with SDL 2.0.10. 2019-07-01 09:02:04 -07:00
Sam Lantinga 959cfc428e Fixed memory barrier macro check so it isn't quite so fragile 2019-06-30 23:58:31 -07:00
Sam Lantinga a8bea85810 Limit the compile error to the case where we actually define the memory barrier macro as the function 2019-06-30 23:55:28 -07:00
Sam Lantinga cc47810d36 Fixed bug 4683 - SDL_atomic infinite recursion on armv6/armv5 w/ thumb
The real problem is that SDL_atomic.c was built in thumb mode instead of ARM mode, which is required to use the mcr instruction on ARM platforms. Added a compiler error to catch this case so we don't generate code that does infinite recursion.

I also added a potentially better way to handle things on Linux ARM platforms, based on comments in the Chromium headers, which we can try out after 2.0.10 ships.
2019-06-30 23:26:16 -07:00
Sam Lantinga 797d2c5957 Fixed bug 4436 - [OpenBSD] fix D-pad
daniel.c.sinclair

Hi, this patch breaks dpad/hat input on my PS4 controller.  The attached patch restores functionality.  Calling SDL_PrivateJoystickHat() at the end of BSD_JoystickUpdate was setting the hat state to zero on every kind of input, instead of just the HUG_DPAD events.
2019-06-30 22:48:13 -07:00
Sylvain Becker 22a2decf64 Android: concurrency issues, make sure Activity is in running State when calling
functions like SDL_CreateWindow, SDL_CreateRenderer, Android_GLES_CreateContext

Bugs 4694, 4681, 4142
2019-06-28 16:38:42 +02:00
Sylvain Becker cfed0b7738 Add an "error" label in SDL_CreateRenderer (no op) 2019-06-28 16:14:50 +02:00
Sylvain Becker aa45af7fcb Android: explicitly expand Android_GLES_MakeCurrent/Android_GLES_CreateContext
from SDL_egl_c.h
2019-06-28 16:05:20 +02:00
Ryan C. Gordon 57e08c27ef cocoa: Check for capslock in -[NSResponder flagsChanged], not with IOKit.
Using IOKit for this pops up a warning at startup on macOS 10.15 ("Catalina"),
asking the user to authorize the app to listen to all keyboard input in the
system, which is unacceptable.

I _think_ we were using IOKit under incorrect presumptions here; the Stack
Overflow link mentioned in it was complaining about not being able to use
flagsChanged to differentiate between left and right mod keys, but that's not
an issue for capslock.

It's also possible this code was trying to deal with capslock changing when
the window didn't have focus, but we handle this elsewhere now, if we didn't
at the time.
2019-06-26 13:21:43 -04:00
Ryan C. Gordon 0beadea574 windows: Call GetWindowText() with the correct parameters (thanks, Zebediah!)
GetWindowText() wants you to tell it the size of the buffer--including the
terminating NULL char--but we weren't counting that last char, losing the
last char of the string in the process. This was only seen with the special
case of SDL_CreateWindowFrom() to use an existing native window, not
the usual SDL_CreateWindow() codepath.

Fixes Bugzilla #4696.
2019-06-26 01:29:01 -04:00
Ozkan Sezer 282b2b9395 define __ARM_NEON for Windows only if _M_ARM or _M_ARM64 is defined. fixes Visual Studio builds. 2019-06-25 11:47:02 +03:00
Ozkan Sezer 83a713f1a0 update version in os/2 makefile 2019-06-24 23:51:10 +03:00
Ozkan Sezer bcb357d451 fix permissions 2019-06-24 23:50:20 +03:00
Sylvain Becker ccba8d4691 Android: export Lock/Unlock activity API 2019-06-24 18:08:11 +02:00
Sam Lantinga 7f78d0f0d3 Fixed bug 4684 - GLES1 variables missing under Android with CMake
Braden Obrzut

https://hg.libsdl.org/SDL/file/7dc39b047055/CMakeLists.txt#l911

I believe the following should also be specified there:

set(SDL_VIDEO_OPENGL_ES 1)
set(SDL_VIDEO_RENDER_OGL_ES 1)

As it is now GLES1 support is missing when building for Android despite it linking to the library.
2019-06-21 22:01:27 -07:00
Ryan C. Gordon 31bb95f11f direct3d: Use D3DPOOL_DEFAULT for vertex buffers after all, release correctly.
Fixes Bugzilla #4679.
Fixes Bugzilla #4537.
2019-06-21 15:07:39 -04:00
Sam Lantinga 51555a85cc Enable Raspberry Pi video by default 2019-06-21 10:58:30 -07:00
Cameron Gutman e681623cb2 direct3d: Fix dirty textures failing to update
Even if the texture itself has not changed since last time, the data may have
so we must call UpdateDirtyTexture() to handle that possibility.
2019-06-20 19:51:00 -07:00
Sam Lantinga f3226457e0 Fixed bug 4672 - Warnings in SDL_LogEvent() 2019-06-19 17:11:20 -07:00