Commit graph

9009 commits

Author SHA1 Message Date
Sam Lantinga
02ae0da6a6 Fixed bug 3368 - SDL_Blit_Slow doesn't ignore alpha values in colorkey comparison
Simon Hug

When the SDL_Blit_Slow function compares the pixel to the color key it does so without removing the alpha component from the pixel value and the key. This is different from the optimized 32-bit blitters which create a rgb mask and apply it to both to filter the alpha out. SDL_Blit_Slow will only skip the pixels with the exact alpha value of the key instead of all pixels with the same color.

The attached test case blits a surface with a color key and prints the pixel values to the console. The third row is expected to be skipped.
2016-10-01 10:46:10 -07:00
Sam Lantinga
1d23b0f046 Fixed bug 3373 - OpenGL implementation differences of glDrawTexfOES
Simon Hug

It seems not everyone implemented glDrawTexfOES the same. Intel and Mesa ignore the viewport entirely, whereas the Raspberry Pi implementation offsets the coordinates and does viewport clipping.

The glDrawTexfOES extension text [1] for the function says "Xs and Ys are given directly in window (viewport) coordinates." I guess this wasn't clear enough.

Alex Szpakowski

Honestly I'd probably remove that codepath from SDL_Render entirely. It's an OpenGL ES 1-specific extension that isn't likely to give huge performance gains and adds additional maintenance overhead to SDL_Render while also having bugs in some drivers (as seen here).
2016-10-01 10:43:01 -07:00
Bastien Nocera
d71fc04225 Fix running autogen.sh out-of-tree
As done in GNOME's jhbuild building tool.

https://bugzilla.libsdl.org/show_bug.cgi?id=3374
2016-10-01 10:39:03 -07:00
Sam Lantinga
7f13262fea We should be using a string constant for the strftime format string 2016-10-01 10:38:15 -07:00
Bastien Nocera
d9190db2eb Fix "format not a string literal" errors
With GCC 6.1.

https://bugzilla.libsdl.org/show_bug.cgi?id=3375
2016-10-01 10:36:24 -07:00
Jonathan Dowland
2948e51c65 Add gamecontrollerdb lines for SFC30 controller in various modes
SFC30 controller: http://www.8bitdo.com/sfc30/

The SFC30 controller can present itself in a variety of modes and it offers up
different names in each. This patch captures data for three modes (one USB and
two Bluetooth) on three platforms (Mac OS X, Windows, Linux).

However, USB mode on Linux and Windows is missing as the button events did not
make it through to SDL's controllermap tool on Fedora 24/Linux 4.5.5 nor Steam
Big Picture mode on Windows. The two Bluetooth modes were indistinguishable on
Windows. Two modes on OS X were indistinguishable.

There exists a similar controller called the SNES30 (And some others) that are
very likely identical except for the name, but I have not verified this yet so
haven't synthesized lines for those controllers until I can.
2016-07-01 16:47:27 +01:00
Cole Campbell
c3ab42cd1f Commit KEYCODE_SPACE as text input on Android 2016-07-04 10:39:32 -04:00
Sam Lantinga
b26da9ce71 Fixed bug 3336 - Failure to build with MinGW-w64
Kai Sterker
There are already patches available from mingw64 that fix the issue

https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-SDL2

With those applied, I could compile SDL2 without problems. But of course, it would be preferable if SDL built cleanly from source.
2016-10-01 10:28:00 -07:00
Sam Lantinga
f4a55d371b Fixed bug 3388 - Fail to build src/thread/windows/SDL_systhread.c on MinGW 4.9.3
Vitaly Novichkov

Line 124
====================================================================
const DWORD flags = thread->stacksize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0;
====================================================================

Error of compiler:
====================================================================
  CC     build/SDL_systhread.lo
src/thread/windows/SDL_systhread.c: In function 'SDL_SYS_CreateThread':
src/thread/windows/SDL_systhread.c:124:45: error: 'STACK_SIZE_PARAM_IS_A_RESERVA
TION' undeclared (first use in this function)
     const DWORD flags = thread->stacksize ? STACK_SIZE_PARAM_IS_A_RESERVATION :
 0;
                                             ^
src/thread/windows/SDL_systhread.c:124:45: note: each undeclared identifier is r
eported only once for each function it appears in
make: *** [build/SDL_systhread.lo] Error 1
====================================================================

Fixing when I adding into begin of the file:
====================================================================
#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000
#endif
====================================================================
2016-10-01 10:08:34 -07:00
Philipp Wiesemann
0d17b15d91 iOS: Removed unused constant in demo. 2016-09-30 23:31:24 +02:00
Philipp Wiesemann
a60440593d Fixed crash if allocating memory for mouse clicks failed. 2016-09-30 23:30:54 +02:00
Ryan C. Gordon
77f3e9007b windows: Removed hardcoded "1" for mouse clickthrough hint. 2016-09-29 23:42:18 -04:00
Ryan C. Gordon
efa4b74b56 haiku: Patched to compile. 2016-09-29 23:15:56 -04:00
Ryan C. Gordon
629e8b3052 windows: fix borderless windows at desktop resolution (thanks, Evgeny!).
Fixes Bugzilla #3404.
2016-09-29 23:12:58 -04:00
Ryan C. Gordon
59a480975b x11: fixed incorrect SDL_GetWindowPosition() after resize (thanks, Jason!).
Fixes Bugzilla #3272.

--HG--
extra : rebase_source : 3b2db0d619c70987a9d7f5cd76d2542f6bf3c13c
2016-09-29 23:01:43 -04:00
Ryan C. Gordon
68abf12b7b Added SDL_SetWindowResizable(). (thanks, Ethan!)
--HG--
extra : rebase_source : a1929f1de6844265f3744a87384620703f960de9
2016-09-29 22:52:41 -04:00
Sam Lantinga
d7c4e4aa49 Fixed bug 3426 - Fixes for joystick related issues
ny00

This report is going to cover three issues, with a suggestion for fixes. For reference, tests were done using an installation of android-x86-5.1-rc1.iso within a VirtualBox session. I've actually used an adapter that accepts up to two Playstation 1/2 controllers.

A ZIP file should be attached, with the following contents:
- The patch file itself.
- Outputs of joysticks lists from testjoystick with different orders (before fixing bug).
- Game controllers database entries (for reference).
--- Different outputs for different platforms may stem from different tools being used; The Android mapping was manually constructed using a previously available mapping as a base.
--- Note that it turns out the Linux mapping is already out there in some form: https://github.com/gabomdq/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt

And so, let's begin listing the issues:

1. While changeset https://hg.libsdl.org/SDL/rev/f6567f77f663 has good intentions, it appears to make various input devices being mistakenly detected as SDL joysticks. I got lists of the devices from joysticktest, given in the ZIP file. "badordering.txt" is what I get if the device has been plugged since a reboot of the virtual machine, while I've gotten "goodordering.txt" after hot-plugging the USB adapter. As expected, only in the latter case I could use the controller in the test program (assuming it isn't modified).

To take care of this, I updated pollInputDevices and added the function SDLActivity.isDeviceSDLJoystick, in order to have a better filter. Note that it also checks that the device id is non-negative, since VIRTUAL_KEYBOARD appears to include a SOURCE_DPAD, and I should probably keep accepting it as an SDL_joystick (good if you want, say, to support multiple independent d-pad devices).

I hope the device id filter does not break support for the virtual remote (mentioned in the changeset above).

2. So there's a weird glitch here, where the game controller is reported to have SOURCE_KEYBOARD and SOURCE_JOYSTICK, while each controller button press/release emits a KeyEvent with SOURCE_KEYBOARD only. So obviously any test going over the event's own sources is expected to fail.

It is possible to try and filter by the key code, but then there are the dpad key codes, which can also be emitted by actual PC keyboard's key presses/releases (the arrow keys).

So instead, I just call the newly added isDeviceSDLJoystick function again and check if the input device (not the event) has any source considered to be a joystick/gamepad for us.

3. Finally, if SDL2 properly detects an SDL_Joystick being connected, but it is not opened, then whenever a KeyEvent is received after a button press/release from the same controller, SDLActivity.onNativePadDown/onNativePadUp returns a negative value. In such a case, the onKey handler continues to check for SOURCE_KEYBOARD (and possibly also SOURCE_MOUSE), which is clearly not desired.

And so, in the given patch, the return values of onNativePadDown and onNativePadUp are ignored and "true" is returned either way.

(Note: Maybe the native functions should be modified to have the return value of "void".)

Finally, as another side-note, I've noticed that the various bitwise tests for sources are wrong. For instance, to check if an InputDevice 'device' has source SOURCE_JOYSTICK, the value (device.getSources() & SOURCE_JOYSTICK) should be compared to SOURCE_JOYSTICK, not 0.
However, I think there's enough that this patch covers. At the least, isDeviceSDLJoystick partially solves this.
2016-09-29 16:52:48 -07:00
Sam Lantinga
82e80692e1 Fixed bug 3427 - Android accelerometer z-axis incorrect
Alex Szpakowski

As seen here https://bitbucket.org/rude/love/issues/1202/accelerometer-z-axis , the Java code for sending accelerometer data to SDL's C code has an incorrect Z-axis calculation.
2016-09-29 16:40:34 -07:00
Sam Lantinga
295b8597ae Fixed bug 3429 - Update AM_PATH_SDL2() to also check for SDL2.framework
neoaggelos

It is common for Mac OS X to use the SDL2.framework instead of the classic UNIX dynamic lib.

Therefore, it makes sense for AM_PATH_SDL2() to be able to locate it. Attached is a patched sdl2.m4 (updated for that purpose).

Changes:
* look for SDL2.framework ONLY if pkg-config and sdl2-config tests failed (this is to ensure compatibility with the old behaviour)

* adds option ('--disable-sdlframework') to retreat to the old behaviour

* adds variable 'SDL2_FRAMEWORK' for the user to specify the exact path to SDL2.framework (e.g. if it is installed in a non-standard location)

Open to suggestions for further improvements
2016-09-29 16:37:08 -07:00
Sam Lantinga
97b094e050 Added debug output for new window events 2016-09-29 16:10:08 -07:00
Sam Lantinga
9961af217a Implemented SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH on X11 2016-09-29 16:05:29 -07:00
Sam Lantinga
71e9b9f781 Added Windows support for SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH 2016-09-29 14:48:33 -07:00
Sam Lantinga
5d60a58a8b Generalized the hint for whether the application gets a mouse event when clicking on the window to activate it, and is now named SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH.
The behavior is defined to not receive the click event, and this hint allows you to override that.
2016-09-29 13:34:49 -07:00
Sam Lantinga
273f71a704 When clicking on a window to give it focus, don't pass the mouse click to the application. 2016-09-29 03:59:04 -07:00
Ryan C. Gordon
ee85553e33 Updated Linux notes on building with Mir and Wayland support. 2016-09-29 12:04:07 -04:00
Sam Lantinga
79485875b5 Updated version to 2.0.5 in preparation for release 2016-09-28 22:24:01 -07:00
Philipp Wiesemann
bd1799c67f Updated configure script. 2016-09-26 23:09:34 +02:00
Philipp Wiesemann
c6bf0b860a iOS: Updated comment in demo. 2016-09-26 23:09:19 +02:00
Alex Szpakowski
ef9bde21c8 Enable SDL_LoadObject on iOS 8+ and tvOS. 2016-09-25 15:02:06 -03:00
Alex Szpakowski
d7b455f987 tvOS launch images are now properly supported. 2016-09-25 11:46:25 -03:00
Alex Szpakowski
448940e133 Update the code for the iOS demos to handle modern devices. Fixes bug #3337 2016-09-25 00:23:35 -03:00
Alex Szpakowski
d3410d304c Don't try to load a launch storyboard on tvOS (it doesn't use them). 2016-09-25 00:21:12 -03:00
Alex Szpakowski
1b8e2f31be iOS/tvOS: Try to load the launch screen as a storyboard. Xcode 8 compiles it as a storyboard instead of a nib. 2016-09-24 23:33:49 -03:00
Alex Szpakowski
2e80731ac4 iOS/tvOS: Always send SDL_WINDOWEVENT_FOCUS_GAINED when a window is created on the main screen (fixes bug #3395). 2016-09-24 20:12:57 -03:00
Alex Szpakowski
053c6decab Use OS-provided click counts on macOS and iOS for mouse press and release events. 2016-09-24 18:46:34 -03:00
Alex Szpakowski
9ec0713e72 Fix mouse wheel events on macOS 10.12 (thanks Eric Wasylishen!)
Fixes bug #3432
2016-09-24 13:28:40 -03:00
Brandon Schaefer
9a227e9976 Mir: Add gamma support set/get. Still need one more function to complete the set 2016-09-21 18:23:59 -07:00
Brandon Schaefer
4f622562df Mir: Add fixme (waiting for a public api to be added) 2016-09-21 16:28:23 -07:00
Brandon Schaefer
e2434a9b73 [Mir] Move to the new MirDisplayConfig API 2016-09-21 15:57:15 -07:00
Philipp Wiesemann
546554a3f1 Mac: Fixed markdown formatting in README.
The newlines were lost in doxygen output.
2016-09-21 23:07:08 +02:00
Philipp Wiesemann
42f3ecb5d5 Mac: Fixed whitespace around function return type. 2016-09-21 23:06:49 +02:00
Philipp Wiesemann
0f1075b48e Fixed compiling of three test programs with C++. 2016-09-21 23:06:38 +02:00
Philipp Wiesemann
7cbbd89bb3 Android: Fixed two warnings about unused variables. 2016-09-21 23:06:26 +02:00
Alex Szpakowski
cac05aa410 Handle audio interruptions on iOS/tvOS. Fixes bugs 2569 and 2960. 2016-09-18 19:22:09 -03:00
Ryan C. Gordon
0378b1263e Xcode/mac: fix building standalone static and shared libraries. 2016-09-18 18:19:32 -04:00
Ryan C. Gordon
597bf224a1 emscripten: get even more aggressive about audio device closing.
I still get exceptions thrown sometimes on shutdown without this.

--HG--
extra : rebase_source : 6f1a4c742a186e29b540fde244b95f4a51c7e4e9
2016-09-18 18:07:47 -04:00
Sam Lantinga
d2cb290156 Recommended settings from Xcode 7.3.0 2016-09-16 22:28:12 -07:00
Sam Lantinga
9b769a983d Fixed warning with Xcode 7.3.0 2016-09-16 22:27:58 -07:00
Alex Szpakowski
bc55781bff Updated URL in a comment 2016-09-17 01:36:29 -03:00
Alex Szpakowski
3a2d9cee43 Added a new hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION.
When set to "1", the orientation of the Apple TV remote affects the axes of the corresponding SDL joystick. It is "0" (disabled) by default.
2016-09-17 01:31:07 -03:00