Commit Graph

4188 Commits (3f5ff751fe06b1e0eb01639fe11bfbddf9fb4c90)

Author SHA1 Message Date
Sam Lantinga e14278ef6f Fixed bug 3804 - Message box on Windows truncates button ID
Simon Hug

I just wanted to fix a simple compiler warning in SDL_ShowMessageBox on Windows (which Sam fixed recently) and ended up finding some issues.

Attached patch fixes these issues:

- Because Windows only reports the lower 16 bits of the control identifier that was pushed, the button IDs used by SDL (C type int, most likely 32 bits) can get cut off.

- The documentation states (somewhat ambiguously) that the button ID will be -1 if the dialog was closed, but the current code sets 0. For SDL 2.1, I think this should be a return code of SDL_ShowMessageBox itself. That will free up the button ID and it seems a more appropriate place for signaling this event.

- Ampersands in controls will create mnemonics on Windows (underlined letters that, if combined with the Alt key, will push the button). I was thinking of adding a hint or flag to let the users enable it, but that might have unexpected results.

- When the size of the text gets calculated, it doesn't use the same parameters as the static control. This can cut off text or wrap it weirdly.

- On Windows, the Tab key is used to switch between control groups and sometimes between buttons in dialogs. This didn't seem to work correctly.

Attached patch also adds:

- Icons. Just the system ones that can be loaded with the ordinals IDI_ERROR, IDI_WARNING and IDI_INFORMATION.

- A button limit of 2^16 - 101.

- Some more specific error messages, but they never reach the user because how SDL_ShowMessageBox handles them if an implementation returns with an error.
2018-03-24 10:26:40 -07:00
Sam Lantinga b41b9d34c7 Fixed return value 2018-03-19 14:52:53 -07:00
Sam Lantinga 8e062f6925 Generalized the handling of instantaneous guide button presses so there's a minimum of 100 ms between guide button press and release.
This happens with at least the following controllers: All Apple MFI controllers, ASUS Gamepad, XiaoMi Bluetooth Controller
2018-03-19 14:42:51 -07:00
Sam Lantinga d529b001bc Added mapping for the ASUS Gamepad removing the guide button, which doesn't generate events even though it's reported in the Android APIs. 2018-03-19 13:16:11 -07:00
Sam Lantinga f536fbea71 Reimplemented Android cursor API support using reflection so it builds with older SDKs 2018-03-16 11:08:53 -07:00
Sam Lantinga e20d4173bf Added Android custom cursor implementation
This is commented out in SDLActivity.java, with the note #CURSORIMPLEENTATION because it requires API 24, which is higher than the minimum required SDK
2018-03-15 18:22:48 -07:00
Sam Lantinga 1cfbe664f5 Added Mac OpenGL ES configure support 2018-03-12 18:41:06 -07:00
Sam Lantinga d401a77eff Fixed bug 4102 - define _WIN32_WINNT_WIN7 if not already defined
Ozkan Sezer

The following patch defines _WIN32_WINNT_WIN7 if it is not already
defined in core/windows/SDL_windows.c,  similar to what is already
there for _WIN32_WINNT_VISTA.
2018-03-10 21:22:42 -08:00
Sam Lantinga 6d39e67bad Fixed bug 4103 - SDL_cpuinfo.h provokes warnings with -Wundef on non-x86 hosts
Felix Geyer

Forwarding from https://bugs.debian.org/892087 quoting verbatim:

The SDL2 header SDL_cpuinfo.h generates gcc warnings if the program using
it compiles with the -Wundef warning. (In particular, this means that QEMU
builds using it fail on at least sparc hosts, since QEMU dev builds
use both -Wundef and -Werror.).

/usr/include/SDL2/SDL_cpuinfo.h:63:5: warning: "HAVE_IMMINTRIN_H" is not defined, evaluates to 0 [-Wundef]
 #if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H)
2018-03-10 21:20:25 -08:00
Micha? Janiszewski 0a5c10654c Fix ARM builds with MSVC 2018-03-10 21:16:14 -08:00
Sam Lantinga cc7b2fc512 Temporary fix for bug 3432 - macOS 10.12: small scrolls (1 wheel notch) don't generate events
Eric Wasylishen

This bug was reintroduced by https://hg.libsdl.org/SDL/rev/fcf24b38a28a

The steps to reproduce are the same: run the "testrelative" SDL demo with "--info all",
connect a USB mouse with a scroll wheel, and roll the scroll wheel one "notch". You'll get log output like:

testdraw2[1644:67222] INFO: SDL EVENT: Mouse: wheel scrolled 0 in x and 0 in y (reversed: 1) in window 1

As far as I can tell macOS doesn't have an API for getting the number of "wheel notches"; I get a deltaY of 0.100006 for one "notch", and it's heavily accelerated (if you roll the wheel quickly you'll get large deltas). So NSEvent's deltaY is only meant to be used for scrolling a scroll view, with the given distance in points, not something like selecting an item in a game.

Here's a temporary patch that at restores the foor/ceil in Cocoa_HandleMouseWheel.
Not ideal, but at least it restores the ability to scroll one notch of a mousewheel.
2018-03-10 21:13:50 -08:00
Sam Lantinga 129431b4f4 Delay delivery of the pause button release on MFI controllers so it doesn't happen in the same frame as the button press 2018-03-08 16:32:22 -08:00
Sam Lantinga 92847022f5 Added a mapping for the latest firmware for the Xbox One S controller on Android 2018-03-07 18:10:01 -08:00
Sam Lantinga a2c1d83c02 Include a USB VID/PID for Apple MFI controllers
This is just placeholder VID/PID, but allows code that works with VID/PID to identify the MFI controllers easily.
2018-03-07 18:09:58 -08:00
Sam Lantinga a8ac588549 Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened 2018-03-07 13:30:40 -08:00
Sam Lantinga 9e651b6915 Try to dynamically create a default Android game controller mapping based on the buttons and axes on the controller.
Include the controller USB VID/PID in the GUID where possible, as we do on other platforms.
2018-03-06 14:51:50 -08:00
Sam Lantinga 2419d26724 Progress fixing bug 4100 - errors and warnings after changeset 11917
Ozkan Sezer 2018-03-02 20:02:37 UTC
http://hg.libsdl.org/SDL/rev/d702b0c54e52 resulted in an error and
two warnings when compiled with mingw.

1.  Error from SDL_windowstaskdialog.h:
In file included from src/video/windows/SDL_windowsmessagebox.c:29:0:
src/video/windows/SDL_windowstaskdialog.h:23:54: error: expected ')' before 'HWND'

This is fixed by removing unnecessary annotations:

2.  Warning from SDL_assert.c:
src/SDL_assert.c: In function 'SDL_ExitProcess':
src/SDL_assert.c:138:1: warning: 'noreturn' function does return

Indeed ExitProcess() is prototyped with DECLSPEC_NORETURN, but
TerminateProcess() is not.  This can be rectified by adding an
exit() call in there. Do NOTE, however, that requires building
with a libc:

3.  Warning from SDL_windowsmessagebox.c:
src/video/windows/SDL_windowsmessagebox.c: In function 'WIN_ShowMessageBox':
src/video/windows/SDL_windowsmessagebox.c:513:9: warning: 'nCancelButton' may be used uninitialized in this function

My lazy solution was manually initializing nCancelButton to 0.
2018-03-02 22:53:25 -08:00
Sam Lantinga e9b29ed007 Fixed bug 4101 - configure needs regenerating after changeset 11894 2018-03-02 22:48:15 -08:00
Sam Lantinga ac2d1f6773 Fixed setting the layer drawable size
Without this change the drawable had a size of 0 and the metal renderer asserted because the projection matrix wasn't set.
2018-03-02 12:08:18 -08:00
Ryan C. Gordon cef1c1c2ee windows: Restore patches for Task Dialogs and TerminateProcess().
2.0.8 has shipped, these can live in revision control now!
2018-03-02 14:10:25 -05:00
Sam Lantinga 003c0dce9c Use the real controller name for game controllers on iOS and Apple TV 2018-03-02 10:56:21 -08:00
Sam Lantinga 4f695bc5e5 Added tag release-2.0.8 for changeset dfbae17e87ac 2018-03-01 09:32:53 -08:00
Sam Lantinga e9fc66a038 Added patch note for Android Studio support 2018-03-01 08:26:10 -08:00
Sam Lantinga 0df7fe8404 Temporarily disabled fullscreen switching code on Android, until we can resolve bug 4096 - Enabling fullscreen on Android causes the app to toggle fullscreen mode continuously in a loop 2018-03-01 08:22:56 -08:00
Sam Lantinga eac3766698 Added a patch note for OpenGL ES support on Mac 2018-03-01 08:08:20 -08:00
Ryan C. Gordon 3537c3e7a9 Back out Task Dialog and TerminateProcess patches for 2.0.8.
These can return to revision control once we ship.
2018-02-28 10:39:41 -05:00
Ryan C. Gordon 6a1cfccef8 windows: dos2unix'd messagebox code, and (hopefully) fixed on MingW. 2018-02-28 02:14:15 -05:00
Ryan C. Gordon a749035f10 windows: Message boxes use Task Dialogs if possible (thanks, Jack!).
This lets the message box have an icon. Unless the app has opted-in to using
the v6 common controls, though, this will fall back to the usual SDL message
boxes.
2018-02-28 01:54:22 -05:00
Ryan C. Gordon 8536130aa2 assert: Use TerminateProcess() on Windows, vs ExitProcess (thanks, Jack!).
"What I have done is use TerminateProcess rather than ExitProcess.
ExitProcess will cause Microsoft's leak detection to continue, TerminateProcess
won't. It is also technically wrong to use ExitProcess in the case of aborting
the application.

Jack Powell
Twitter @jack9267"
2018-02-28 01:23:49 -05:00
Sam Lantinga 99683f7c04 Added patch note about the Vulkan Mac SDK 2018-02-26 08:39:25 -08:00
Mark Callow be6ca785e3 Support official Vulkan SDK for macOS.
This tries to load vulkan.framework or libvulkan.1.dylib before MoltenVK.framework
or libMoltenVK.dylib. In the previous version, layers would not work for applications
run-time loading the default library.
2018-02-25 23:02:09 -08:00
Sam Lantinga f9f45d0bf5 Fixed bug 4097 - Segmentation fault by SDL_CreateThreadWithStackSize
Dongsun Kim

Normal case
1. [thread 1] SDL_CreateThreadWithStackSize calls SDL_SYS_CreateThread.
2. [thread 1] If successful, it calls SDL_SemWait.
3. [thread 2] SDL_RunThread calls SDL_SYS_SetupThread, SDL_ThreadID, SDL_SemPost.
4. [thread 1] SDL_CreateThreadWithStackSize calls SDL_DestroySemaphore, SDL_free.

Crash case (Segmentation fault)
1. [thread 1] SDL_CreateThreadWithStackSize calls SDL_SYS_CreateThread.
2. [thread 1] If successful, it calls SDL_SemWait.
--> Error return due to SIGNAL(SYSTEM or Real Time) at sem_wait(pthread).
3. [thread 1] SDL_CreateThreadWithStackSize calls SDL_DestroySemaphore, SDL_free.
4. [thread 2] SDL_RunThread calls SDL_SYS_SetupThread, SDL_ThreadID, SDL_SemPost.
--> Segmentation fault at strlen or sem_post.
2018-02-25 19:51:34 -08:00
Olli Kallioinen 5cbb90da02 cmake: Set debug library name suffix per target instead of setting it globally. Don't add a suffix on android 2018-02-25 19:22:47 +02:00
Ozkan Sezer 3ea093cc85 SDL_test_fuzzer.c: fix strict aliasing warnings by using a union. 2018-02-25 10:15:00 +03:00
Sam Lantinga cbfee82dff Moved Android patch note into the Android section 2018-02-24 09:09:20 -08:00
Sam Lantinga 6cf4d0e43b Fixed bug 4092 - CMake support for building everything in the "test" directory
Eric Wasylishen

Patch to support building the tests with cmake.
Disabled by default, use: "cmake .. -DSDL_TEST=YES" to enable the tests.

Tested on macOS 10.13 with the ninja, makefile, and Xcode generators, and Windows 10 with the Visual Studio 2017 generator.
2018-02-24 08:59:58 -08:00
Sam Lantinga 849d042fa4 Fixed bug 4091 - Undefined references to Android audio functions when SDL_AUDIO_DISABLED is on
Manuel Sabogal

If SDL is compiled with the Audio subsystem disabled there are some undefined references to the functions ANDROIDAUDIO_ResumeDevices and ANDROIDAUDIO_PauseDevices in the file src/video/android/SDL_androidevents.c.
2018-02-24 08:58:22 -08:00
Sam Lantinga 8e4afb556a Added patch note for Ryan's work 2018-02-24 08:42:04 -08:00
Sam Lantinga b33dbd2769 Added missing file to tvOS build 2018-02-24 08:40:30 -08:00
Sam Lantinga 99a0c0f0e2 Fixed MinGW-w64 build 2018-02-24 08:23:44 -08:00
Sam Lantinga 5adc1b7d3e Updated documentation with API changes in SDL 2.0.8 2018-02-24 08:18:09 -08:00
Brandon Schaefer 0626486e2e Backout the vulkan change in d449dea10fc8 breaks Mir builds 2018-02-23 19:12:04 -05:00
Brandon Schaefer e17c3219d3 mir: Disable Mir by default as Mir supports Wayland clients
Also remove enabling VK support for Mir
2018-02-23 11:24:26 -05:00
Ryan C. Gordon 8891f5919f Backed out changeset 6c8521d53507
Apparently this still triggers a compiler warning, have to dig further.
2018-02-21 22:53:52 -05:00
Ryan C. Gordon fd8f12d2a1 android: apparently they fixed this header at some point. 2018-02-21 22:35:17 -05:00
Ryan C. Gordon ac309df7b4 vulkan: Possibly fix a compiler warning (-Wstrict-prototypes). 2018-02-21 22:27:09 -05:00
Ryan C. Gordon c7e4366530 wasapi: let Windows do the resampling for us if possible. 2018-02-21 21:34:06 -05:00
Ryan C. Gordon 7e1fa0ce53 wasapi: fixed typo in an assert message. 2018-02-21 21:34:35 -05:00
Ryan C. Gordon ed64d54dfd windows: added WIN_IsWindows7OrGreater(). 2018-02-21 21:36:10 -05:00
Ethan Lee 6e3d0a133c Use new XInput mapping for Win10+ (Bugzilla #3960) 2018-02-21 12:42:30 -05:00