Commit Graph

6880 Commits

Author SHA1 Message Date
Sam Lantinga
32547d0c59 Fixed line endings on WinRT source code 2014-03-09 11:06:11 -07:00
David Ludwig
425634092d WinRT: emit SDL_APP_TERMINATING 2014-03-04 19:49:11 -05:00
David Ludwig
b7ef90c7d4 WinRT: emit SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events 2014-03-04 19:30:36 -05:00
David Ludwig
dc66977606 WinRT: cleaned up some hard-to-read SDL_DisplayMode management code 2014-03-01 16:37:30 -05:00
David Ludwig
97842bc021 WinRT: fixed a crash in SDL_Quit
SDL was expected that each SDL_DisplayMode had a driverdata field that was SDL_malloc'ed, and was calling SDL_free on them.  This change moves WinRT's driverdata content into a SDL_malloc'ed field.
2014-03-01 16:08:16 -05:00
David Ludwig
f1438cb55e WinRT: simulate keyboard events on Windows Phone 8 back-button presses
Pressing the hardware back button on a Windows Phone 8 device will now cause SDL to emit a pair of key-down and key-up events, with the SDL scancode, SDL_SCANCODE_AC_BACK.

By default, if WinRT's native back-button-press events are not explicitly marked as 'handled', then Windows Phone will terminate the app.  More details on Microsoft's reasoning behind this can be found on MSDN, at http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx

To mark back-button-press events as 'handled', set SDL_HINT_WINRT_HANDLE_BACK_BUTTON to 1.  Setting it to anything else will cause these events to not be marked as 'handled'.

Due to limitations in Windows Phone's APIs, SDL will emit a virtual key-up event immediately after the back button's key-down event is registered.  Unfortunately, Windows Phone 8 only allows one to register for back-button-press events, and not back-button-release events.
2014-01-26 08:06:36 -05:00
David Ludwig
dd661ff38c WinRT: added a means to display a privacy policy link via the Settings charm
This change is only relevant for Windows 8, 8.1, and RT apps, and only for those that are network-enabled.  Such apps must feature a link to a privacy policy, which must be displayed via the Windows Settings charm.  This is needed to pass Windows Store app-certification.

Using SDL_SetHint, along with SDL_HINT_WINRT_PRIVACY_POLICY_URL and optionally SDL_HINT_WINRT_PRIVACY_POLICY_LABEL, will cause SDL/WinRT to create a link inside the Windows Settings charm, as invoked from within an SDL-based app.

Network-enabled Windows Phone apps do not need to set this hint, and should provide some sort of in-app means to display their privacy policy.  Microsoft does not appear to provide an OS-integrated means for displaying such on Windows Phone.
2014-01-01 16:05:37 -05:00
David Ludwig
71967374d7 WinRT: d3d11 blend mode bug fixes
The destination target's alpha wasn't getting set correctly in many cases.  Among other problems, this prevented some alpha-blended textures from displaying correctly in Windows Phone 8's multitasking screen.

The d3d11 renderer now uses the same blending settings found in the d3d9 renderer.
2013-12-30 11:59:04 -05:00
David Ludwig
32aff9ef57 WinRT: minor error cleanup regarding OpenGL init 2013-12-26 14:21:47 -05:00
David Ludwig
26f1b2240b WinRT: took out some dead comments from SDL_winrtopengles.cpp 2013-12-26 14:13:20 -05:00
David Ludwig
ec33828507 WinRT: fixed crash on ARM and x64 during OpenGL window init 2013-12-26 13:59:01 -05:00
David Ludwig
8702636c40 WinRT: minor header file usage cleanup in the d3d11 renderer 2013-12-26 11:04:35 -05:00
David Ludwig
a4caf2df88 WinRT: simplified the d3d11 vertex shader a bit
The projection and view matrices are now computed ahead of time, as they both get computed in the same spot, and typically not often.  If this does, however, become a performance problem later on, this change can always be reverted.
2013-12-26 11:03:43 -05:00
David Ludwig
82452cc1b0 WinRT: implemented SDL_RenderSetClipRect for the d3d11 renderer 2013-12-26 10:18:33 -05:00
David Ludwig
91b45c3a8c WinRT: corrected a minor error in an end-of-file comment 2013-12-25 23:46:19 -05:00
David Ludwig
337bf4817a WinRT: minor rotation/orientation code cleanup in the d3d11 renderer 2013-12-25 23:45:07 -05:00
David Ludwig
8038f0abe9 WinRT: removed a bit of dead d3d11 code 2013-12-25 23:25:25 -05:00
David Ludwig
0ab5b2e9fa WinRT: d3d11 compiled-shader code cleanup
I'm surprised this code even compiled, before this change.  It did, but regardless, here's a cleanup.
2013-12-25 22:27:58 -05:00
David Ludwig
931f21a162 WinRT: made sure d3d11 debug mode doesn't get enabled by default
D3D11 debug mode got inadvertently enabled, in all cases, via changeset c0e68f3.  This change reverts that.
2013-12-25 22:05:18 -05:00
David Ludwig
ecb3e116ad WinRT: compiled the d3d11 renderer's shaders into SDL itself
Previously, the shaders would get compiled separately, the output of which would need to be packaged into the app.  This change should make SDL's dll be the only binary needed to include SDL in a WinRT app.
2013-12-25 21:39:48 -05:00
David Ludwig
96060da8b4 WinRT: prevented a potential race condition in the XInput backend
The race condition could've been triggered on device removal.
2013-12-25 14:42:38 -05:00
David Ludwig
b2af020432 WinRT: added a TODO note regarding texture-[un]locking in the d3d11 renderer 2013-12-25 14:20:40 -05:00
David Ludwig
053ce13c58 WinRT: renamed d3d11-internal struct, SDL_VertexShaderConstants, to just VertexShaderConstants
This is primarily to keep naming consistent with other shader-bound structs.
2013-12-25 14:17:49 -05:00
David Ludwig
75b6ebed62 WinRT: moved contents of the d3d11 renderer's header file into its implementation file 2013-12-25 13:13:15 -05:00
David Ludwig
c0f5f2e58f WinRT: simplified a potentially-common error message from D3D11_SetRenderTarget 2013-12-25 13:00:41 -05:00
David Ludwig
a11653b075 WinRT: removed an unnecessary use of std::string in the d3d11 renderer 2013-12-25 12:58:37 -05:00
David Ludwig
333c827831 WinRT: utilized SDL_SetError's return value in the d3d11 renderer 2013-12-25 12:52:16 -05:00
David Ludwig
48c72ea3c7 WinRT: minor d3d11 code cleanups 2013-12-25 12:48:47 -05:00
David Ludwig
6d89d46b02 WinRT: made d3d11-spawned error messages trickle down
Some error messages had the potential to be overwritten/obscured.
2013-12-25 12:47:39 -05:00
David Ludwig
4e3a952407 WinRT: made d3d11-spawned error messages include the function name of failed calls 2013-12-25 12:43:26 -05:00
David Ludwig
cc7718dccb WinRT: moved ill-performing XInput device-detection calls to a separate thread 2013-12-24 21:28:31 -05:00
David Ludwig
428a107fd5 WinRT: bug fix: game-controller/joystick button-down events weren't getting sent 2013-12-24 21:08:11 -05:00
David Ludwig
e7fd02d52b WinRT: better rendering performance via D3D11_USAGE_DYNAMIC 2013-12-22 21:13:35 -05:00
David Ludwig
9ddee1ffb6 WinRT: enabled OpenGL ES 2 support by default
A copy of ANGLE/WinRT is still needed to run OpenGL content, but is not needed to compile SDL/WinRT.
2013-12-21 10:08:11 -05:00
David Ludwig
805683ec95 WinRT: fixed bug: SDL_RenderReadPixels didn't work with certain orientations of the physical display 2013-12-10 22:34:08 -05:00
David Ludwig
9e74de85a0 WinRT: removed a now-complete TODO comment regarding Direct3D 11 2013-11-29 00:21:56 -05:00
David Ludwig
b13b8b6290 WinRT: enable the OpenGL ES 2 SDL_Renderer backend, if and when OpenGL ES 2 support is compiled in 2013-11-29 00:19:46 -05:00
David Ludwig
e598d85856 WinRT: got the SDL-official OpenGL ES 2 changes working, in an experimental state 2013-11-28 22:59:21 -05:00
David Ludwig
020c4c5046 WinRT: implemented SDL_DetachThread() for WinRT 2013-11-28 22:24:13 -05:00
David Ludwig
c96c4f3dc4 WinRT: merged with latest SDL 2.x/HG code
SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library.  The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
2013-11-28 22:09:21 -05:00
David Ludwig
5c10fe295b WinRT: fixed bug: touch input coordinates weren't normalized [0..1]
Thanks to Pierre-Yves for pointing this out and providing a fix!
2013-11-28 21:15:05 -05:00
Sam Lantinga
94ea4e20bb Fixed windows build with conflict resolve 2013-11-28 02:31:32 -08:00
Sam Lantinga
e309b1101d Added alternative XBox 360 controller GUID on Linux
Leszek Godlewski

As described in the other thread
(http://lists.libsdl.org/pipermail/sdl-libsdl.org/2013-November/091997.html),
I've run into a case of SDL2 not recognizing a wireless Xbox 360
controller receiver properly on Debian Linux amd64 testing.
Apparently, the generated GUID is slightly different.

Device in question:
Bus 001 Device 015: ID 045e:0291 Microsoft Corp. Xbox 360 Wireless
Receiver for Windows
2013-11-27 10:29:43 -08:00
Sam Lantinga
2310005ab0 Fixed bug 2260 - SDL_SetCursorGrab() is buggy on Windows
BurnSpamAddress

Steps to reproduce:
1. Grab the cursor with SDL_SetCursorGrab()
2. Alt-tab away from the window
3. Click on the titlebar of the window

This will cause the window to disappear underneath the taskbar!

This appears to be a general issue with ClipCursor() on windows, i.e. I am getting the same behavior if I call ClipCursor() directly.

It is caused by a feedback loop between the ClipCursor function and the modal resize/move event loop that handles mouse-based sizing on Windows.
2013-11-27 10:29:38 -08:00
Sam Lantinga
026c14a2f2 Fixed large relative mouse motion when iconifying the SDL window.
Windows will move the window to -32000,-32000 when it is iconified, so we don't want to send mouse motion for iconic windows.
2013-11-27 10:29:32 -08:00
Sam Lantinga
1bc76ccb74 Don't crash when no WM is present.
CR: Sam Lantinga.
2013-11-27 10:29:27 -08:00
Sam Lantinga
beacc372d4 Fixed bug 2274 - SDL_ceil is incorrectly implemented when HAVE_LIBC is not defined
Ghassan Al-Mashareqa

The SDL_ceil function is implemented incorrectly when HAVE_CEIL is not defined (HAVE_LIBC not defined).

The following code:

    double val = SDL_ceil(2.3);
    printf("%g", val);

prints "2.0", as STD_ceil is defined as:

    double
    SDL_ceil(double x)
    {
    #ifdef HAVE_CEIL
        return ceil(x);
    #else
        return (double)(int)((x)+0.5);
    #endif /* HAVE_CEIL */
    }

This functions is used in the SDL_BuildAudioResampleCVT function of the audio subsystem (SDL_audiocvt.c), and causes a bug in that function.
2013-11-27 00:29:46 -08:00
Gabriel Jacobo
7f94f11314 Fixes #2271, Add KD detection under CMake by Scott Percival 2013-11-26 11:50:54 -03:00
Gabriel Jacobo
b2eb92bcec Fixes #2272, typo in CMakeLists.txt (thanks Boris Bendovsky!) 2013-11-26 11:47:52 -03:00
Gabriel Jacobo
e0b4d63b5b [Android] Fixes #2228, reworked touch code
Lets Android take care of which is the primary pointer (the one acting as the
mouse in SDL), reorganized the Java side code as well to make it easier to
understand.
2013-11-25 12:28:09 -03:00