Commit Graph

5113 Commits

Author SHA1 Message Date
Ryan C. Gordon
a46c5fea53 Added some (harmlessly) missing braces. 2014-06-05 00:02:42 -04:00
Brandon Schaefer
c1c51aab6e Assume all motion events are mouse events unless tool_type states otherwise. 2014-06-04 12:55:18 -07:00
Sam Lantinga
2adb8c82d2 Setting the window size changes the fullscreen display mode, unless a window display mode has been set.
Testing:
* Ran testsprite2 --fullscreen, used Ctrl+ and Ctrl- to change window sizes, verified that the display mode changed as well.
2014-06-04 10:57:52 -07:00
Sam Lantinga
dfc0f7dd26 Fixed crash and lost pixel data when recovering from a lost device situation (e.g. alt-tab from fullscreen) 2014-06-04 10:57:40 -07:00
Sam Lantinga
1de549ae43 Ryan C. Gordon <icculus@icculus.org> 2014-05-24 01:23 -0400
Generated dynapi stuff for the new WinRT entry points.
http://hg.libsdl.org/SDL/rev/6a9da341d3e8
2014-06-04 10:57:12 -07:00
Sam Lantinga
667b15f3c8 Added annotations to help code analysis tools
CR: Bruce Dawson
2014-06-04 10:56:56 -07:00
Sam Lantinga
6dc0ed70a3 Fixed bug 2526, but regressed delivering dead key presses 2014-06-04 10:56:43 -07:00
Sam Lantinga
162dd3281b When the window fullscreen mode changes, update the display resolution 2014-06-04 10:56:37 -07:00
Sam Lantinga
f515c7de07 Fixed bug where changing the window border would change the window size on Windows. 2014-06-04 10:56:30 -07:00
Sam Lantinga
299869c965 Fixed Mac OS X build 2014-06-04 10:56:17 -07:00
Sam Lantinga
a7fe260d58 Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal() 2014-06-04 10:55:26 -07:00
Sam Lantinga
15f5e2f1ab Added a hint to disable windows message processing in SDL_PumpEvents()
SDL_SetHint( SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, "0" );
2014-06-04 10:52:34 -07:00
Sam Lantinga
afe35ca58c Added a hint to disable window frame and title bar interaction when the cursor is hidden 2014-06-04 10:50:32 -07:00
Jørgen P. Tjernø
dc73e037f2 SDL_opengl: Fix Mac build with new glext.h 2014-06-04 09:59:10 -07:00
Sam Lantinga
b48ae9b9dd Wait for the fullscreen transition to complete before allowing the application to continue.
This fixes Alt-Enter in the Steam streaming client, which sets the window size and position immediately after switching out of fullscreen mode.
2014-06-04 09:39:08 -07:00
Sam Lantinga
da280113b6 Fixed escape cancelling fullscreen mode now that the SDL window is the first res
ponder.
2014-06-04 01:56:14 -07:00
Jørgen P. Tjernø
ad1fbda549 X11: Provide specific X error when SDL_GL_CreateContext fails.
This makes the X error handler used for GL context creation handle *all* errors
and provide the user with specific error messages when SDL_GL_CreateContext
fails.

CR: icculus@icculus.org
2014-06-03 21:13:00 -07:00
Sam Lantinga
a8d6be7585 Hopefully really fixed the Android build 2014-06-02 09:20:09 -07:00
Sam Lantinga
5d60450a3c Fixed Android build 2014-06-02 09:12:51 -07:00
Sam Lantinga
7e083b162d Fixed bug 2534 - Mac: black bar at top of screen in SDL_WINDOW_FULLSCREEN mode
Alex Szpakowski

Patch to fix the y component of the position of fullscreen windows in OS X.

In Mac OS X with the latest Mercurial code, when a window is in exclusive-fullscreen the y component of its position is offset by the same amount that is normally taken up by the menubar, resulting in a black bar at the top of the screen.

The recent changes to the internal ConvertNSRect function make it treat the bottom of the menubar as 0 for the y component of window positions, even when the window is fullscreen and 'above' the menubar.

I have attached a patch which fixes the issue by only making the window position relative to the menubar in windowed modes.
2014-06-02 09:09:40 -07:00
Sam Lantinga
ba306ba681 Fixed bug 2550 - [OS X 10.9] Enabling SDL_WINDOW_FULLSCREEN after relative mouse mode leaves cursor visible
Eric Wasylishen

Steps to reproduce:

- Run testwm2 app in the SDLTest Xcode project
- Press Control+R to enable relative mouse mode. The mouse cursor should disappear.
- Press Control+Enter to enter fullscreen.
- Expected: a black screen with no cursor visible. Observed: a black screen, but the mouse cursor is visible in the middle of the screen. It doesn't move when I move the mouse.

Reproduced with latest sdl2 hg (changeset 29aac8b813d9) on OS X 10.9.2. Can't reproduce the problem on OS X 10.6.8 or 10.7.5.

I'm speculating that this really an Apple bug.. but anyway, the attached workaround seems to fix it for me, and I think it's fairly safe.

A more obvious idea, sticking a call SDL_SetCursor(NULL) at the end of Cocoa_SetWindowFullscreen, didn't work.
2014-06-02 09:06:38 -07:00
Sam Lantinga
1de08260b6 Added a way to get the native Android window and EGL context 2014-06-02 09:01:26 -07:00
Sam Lantinga
f7b194150b Fixed bug 2479 - [OS X] SDL_SetWindowFullscreen fails to switch to windowed
Eric Wasylishen

The problem seems to be the spaces handling code in -setFullscreenSpace: (SDL_cocoawindow.m) is incorrectly reporting that the SDL_WINDOW_FULLSCREEN -> windowed transition has already happened.

i.e. I saw this case was getting hit when trying to leave SDL_WINDOW_FULLSCREEN:

"else if (state == isFullscreenSpace) {
    return YES;  /* already there. */
}"

With the attached patch, both Control+Enter (SDL_WINDOW_FULLSCREEN toggle) and Option+Enter (SDL_WINDOW_FULLSCREEN_DESKTOP toggle) work in an sdl test app (I tried testwm2). Tested on OS X 10.9.2.
2014-06-02 09:01:10 -07:00
Sam Lantinga
409cb10830 Don't use D3D9Ex by default, since it can change behavior for games which rely on D3D9 classic. 2014-06-02 08:58:07 -07:00
Sam Lantinga
608db044d7 Fixed bug 2520 - Held double-click app startup creates a stuck MOUSEBUTTONDOWN event
snake5creator

When starting application with the usual "double click on file" method on Windows, only holding the last click, an unnecessary MOUSEBUTTONDOWN event is sent before the initial MOUSEMOTION event, and mouse button state is stuck in the sense that it takes a subsequent button release, followed by another press for the system to resume sending events (beginning with the next button release / MOUSEBUTTONUP event).

Input event log with held double-click startup: http://i.imgur.com/nypGKR2.png

Without: http://i.imgur.com/yaIqAvV.png
2014-05-31 14:03:04 -07:00
Sam Lantinga
24faac4ab3 Fullscreen to windowed mode switch
From Melesie

I noticed that when user switches from fullscreen mode to windowed mode and exits application while in windowed mode, Windows performs an additional change of display settings, even though desktop resolution is the same as current one. This causes short black screen to show up. The only way I know of avoiding this is to explicitly switch to default display settings found in registry. MSDN documentation for ChangeDisplaySettingsEx states:

Passing NULL for the lpDevMode parameter and 0 for the dwFlags parameter is the easiest way to return to the default mode after a dynamic mode change.
2014-05-31 12:21:55 -07:00
Sam Lantinga
2e08cc3154 Fixed Direct3DCreate9Ex prototype 2014-05-31 11:53:19 -07:00
Sam Lantinga
aca4c9a8c5 Fixed cast 2014-05-31 11:48:52 -07:00
Sam Lantinga
f3610a5334 Use D3D9Ex when available
This hopefully works around crashes in Intel D3D9 support in Windows 8.1.
2014-05-31 11:37:12 -07:00
Sam Lantinga
e2b7a79112 Fixed SDL error when filtering events after shutdown.
This can happen when restoring video modes during video system shutdown
2014-05-31 11:33:25 -07:00
Ryan C. Gordon
e224148df5 Fixed up SDL_CaptureMouse() on Windows to work like I expected.
This would have been a one-line patch to the documentation (specifying that
 captures only work as long as the left mouse button is pressed), but I didn't
 like that, so I got a little crazy about this instead.
2014-05-30 01:51:13 -04:00
Ryan C. Gordon
bfba1a1a4f Fixed hit-testing on Windows.
Needed to convert from screen to client coords.
2014-05-30 01:49:26 -04:00
Ryan C. Gordon
724a3607f6 Make some printf() calls into SDL_Log() so I can see them on Windows. :) 2014-05-30 01:48:08 -04:00
Ryan C. Gordon
910fb4584e First shot (not even compiled) at Windows hit-testing support. 2014-05-29 13:39:02 -04:00
Ryan C. Gordon
7af1c6e050 Changed drag area API to a hit-testing API.
There were several good arguments for this: it's how Windows works with
 WM_NCHITTEST, SDL doesn't need to manage a list of rects, it allows more
 control over the regions (how do you use rects to cleanly surround a circular
 button?), the callback can be more optimized than a iterating a list of
 rects, and you don't have to send an updated list of rects whenever the
 window resizes or layout changes.
2014-05-28 01:22:47 -04:00
Ryan C. Gordon
dd0cdeab8b Don't hardcode an 8 here. 2014-05-27 15:47:25 -04:00
Ryan C. Gordon
7fd9f9483d Some updates for the X11 drag areas work. 2014-05-27 15:40:03 -04:00
Damian Kaczmarek
b185490238 Initial work on X11 implementation of SDL_SetWindowDragAreas(). 2014-05-27 14:41:16 -04:00
Ryan C. Gordon
6146fd1f61 First shot at SDL_SetWindowDragAreas().
Only Cocoa implemented right now.
2014-05-27 01:27:42 -04:00
Ryan C. Gordon
5ddd54af38 Fixed stack overflow in X11_CreateWindow() (thanks, rapha and Brad!).
This should be a "long" which on a 64-bit system is likely to be > 32-bits,
 causing XGetICValues() to write past the end of the variable (and stack).

Fixes Bugzilla #2513.
2014-05-24 21:06:40 -04:00
Ryan C. Gordon
9a71f85bb4 Flip this around to do the simpler condition first. 2014-05-24 18:23:56 -04:00
Ryan C. Gordon
c33376b028 Implement SDL_CaptureMouse() for Mac OS X. 2014-05-24 18:23:39 -04:00
Ryan C. Gordon
c28b3364b0 Implemented SDL_CaptureMouse(). 2014-05-24 01:30:37 -04:00
Ryan C. Gordon
a8ae14cb57 Added some FIXMEs. 2014-05-24 01:27:19 -04:00
Ryan C. Gordon
e5626abaf2 Fixed whitespace. 2014-05-24 01:25:27 -04:00
Ryan C. Gordon
ac45f3149f Generated dynapi stuff for the new WinRT entry points. 2014-05-24 01:23:57 -04:00
stopiccot
17b9ef82d9 Fixing issues discovered by Philipp Wiesemann
--HG--
branch : apk
2014-04-23 03:42:32 +03:00
stopiccot
df6159bfef inital apk extension support
--HG--
branch : apk
2014-04-07 21:20:39 +03:00
Sam Lantinga
ea48adddc2 Fail if we couldn't create the specified renderer 2014-04-05 16:25:30 -07:00
Philipp Wiesemann
8cc0a1f080 Removed empty statements. 2014-04-05 23:50:09 +02:00
Philipp Wiesemann
bb9a20954a Fixed unused local variable warning. 2014-04-05 23:24:33 +02:00
Sam Lantinga
d349d6a1f2 Fixed the joystick side of XInput haptic detection on Windows 8 2014-03-31 10:38:26 -07:00
Sam Lantinga
4ad73f0dda Fixed XInput haptic support on Windows 8
It turns out the XBox 360 controller driver never reports force feedback capability, so we'll try to set 0 state and see if that succeeds.
2014-03-29 12:29:38 -07:00
Ryan C. Gordon
d32dbd8c76 Changed a C++ single-line comment to /* */ style. 2014-03-26 16:19:52 -04:00
Pierre-Loup A. Griffais
dc083d00e6 Remove the RaiseWindow call from OnWindowRestored for now.
It seems like a net improvement in all the scenarios Sam and I could
think of, and looking at hg history it was added for fullscreen
window management specifically. Much of that code has changed since
then, but maybe it needs to stay there for that and simply be moved
to a fullscreen condition check.

It would solve this issue:

https://bugzilla.libsdl.org/show_bug.cgi?id=2439

As well as cases where on SteamOS, we hide/show specific Steam
overlay windows while expecting them to stay in the background, since
changing the window stacking order really angers the NVIDIA driver.

CR: Sam.
2014-03-26 12:54:51 -07:00
Brandon Schaefer
aa7e41777e Ignore unused mir event functions, need headers in Ubuntu 14.04 to use them. 2014-03-25 15:24:43 -07:00
Brandon Schaefer
b41792e234 Remove two unused variables, causing compiler warnings. 2014-03-25 15:18:18 -07:00
David Ludwig
d93f789fbb WinRT: Call IDXGIDevice3::Trim before app-suspend, as required on Windows 8.1
Thanks to Sylvain Becker for pointing this out!
2014-03-24 22:51:03 -04:00
David Ludwig
6e0fa50ec3 WinRT: Line ending fixes (CRLF to LF) 2014-03-24 22:12:38 -04:00
Gabriel Jacobo
2294e19d3c Emit SDL_RENDER_DEVICE_RESET on Android when the GLES context is recreated 2014-03-24 11:04:42 -03:00
Ryan C. Gordon
0ebcbc0b61 Added an assert to help static analyzer. 2014-03-24 07:12:26 -04:00
Sam Lantinga
0097382ac2 Added an event SDL_RENDER_DEVICE_RESET, which is triggered on Direct3D 11 when the device has been lost and all textures need to be recreated. 2014-03-23 23:09:22 -07:00
Sam Lantinga
f4d37a4f09 Fixing Alt-Enter handling, submitted by Nader Golbaz
I encountered a little issue: DXGI monitors application's message queue and this behavior interferes with SDL if the application already handles Alt-Enter sequence. I think it is necessary to disable this behavior.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb174540%28v=vs.85%29.aspx
2014-03-23 22:53:50 -07:00
David Ludwig
fa99d8d41d WinRT: Implemented SDL_ShowMessageBox for Windows 8.x/RT hosts
This change does not include message box support for Windows Phone 8, which does
not offer the same message box APIs that Windows 8.x/RT does.
2014-03-23 22:07:01 -04:00
Ryan C. Gordon
1815bbc77f Tossed in some SDL_asserts to make static analyzer happier.
(Most of its complaints here are that these ints can be negative, although
they wouldn't been in sane cases. Checking sanity is what assertions do, and
it placates the analyzer appropriately.)
2014-03-23 18:56:47 -04:00
David Ludwig
9673d63c34 D3D11: Fixed a crash after a GPU device-reset on Win32 2014-03-23 16:08:32 -04:00
David Ludwig
11f0da91e4 D3D11: Added code to handle GPU-device-removed scenarios
These scenarios can happen when a GPU is switched, its driver updated, or in
some virtual machines (such as Parallels) are suspended and then resumed.  In
these cases, all GPU resources will already be lost, and it's up to the app to
recover.

For now, SDL's D3D11 renderer will handle this by freeing all GPU resources,
including all textures, and then sending a SDL_RENDER_TARGETS_RESET event.
It's currently up to an app to intercept this event, destroy all of its
textures, then recreate them from scratch.
2014-03-23 13:48:16 -04:00
Sam Lantinga
f45d05f0bb Better keyboard detection when some of the keys are remapped, thanks to Lewis Wall 2014-03-23 09:44:04 -07:00
David Ludwig
a12e329d7b WinRT: Miscellaneous app-backgrounding/restoring event fixes and additions
SDL_WINDOWEVENT_FOCUS_LOST is now sent when an app's native window is hidden.
Likewise, SDL_WINDOWEVENT_FOCUS_GAINED is sent when an app's window is shown.
This mimicks behavior seen on iOS and Android.

SDL_WINDOWEVENT_MINIMIZED and SDL_WINDOWEVENT_RESTORED are now sent when the
app's native window is hidden and shown.  Previously, these were sent when an
app was suspended and resumed.  On Windows 8.x/RT, an app may be sent to the
background without being suspended, which previously meant that
SDL_WINDOWEVENT_MINIMIZED might never have been sent.  (On Windows Phone 8,
however, this seems to be different, whereby apps sent to the background appear
to always get suspended.)
2014-03-23 11:04:47 -04:00
David Ludwig
e0f9ea226b WinRT: Made app-backgrounded events get sent at separate, distinct times.
SDL_APP_WILLENTERBACKGROUND is now sent as soon as the app is told that it is
about to go to the background.  SDL_APP_DIDENTERBACKGROUND is sent via a WinRT
'deferral operation', which is how WinRT gives apps a bit of extra time
(multiple seconds worth) to prepare for an app-backgrounding.

The distinction may be important as the deferral operation's code is always run
in a separate thread.  For Direct3D-only apps, this means that between the
two SDL app-backgrounded events, SDL_APP_WILLENTERBACKGROUND will be the only
one run from the main thread.  Given that some WinRT operations can only be done
on the main thread (operations to the CoreWindow fall into this category), this
could be important.

It is important to note that pre-deferral code may only have a very short bit of
time to execute code, less so than code run in the deferral operation (where
SDL_APP_DIDENTERBACKGROUND is sent from), which usually gets several seconds to
run.
2014-03-23 08:56:52 -04:00
David Ludwig
17a8325240 WinRT globals cleanup: Removed WINRT_GlobalSDLVideoDevice 2014-03-22 21:08:05 -04:00
David Ludwig
0982adf8fd WinRT: Got OpenGL ES 2 working with the latest version of ANGLE/WinRT.
SDL/WinRT did have support for OpenGL ES 2 via an older version of ANGLE/WinRT,
however its API changed a few months ago, and SDL/WinRT would crash when trying
to use it.  It would also occasionally crash when using the older version.

This changeset should make SDL/WinRT work with the latest version, as
available via MS Open Tech's git repository of it at
https://github.com/msopentech/angle

Older versions of ANGLE/WinRT (from either https://github.com/stammen/angleproject
or https://bitbucket.org/DavidLudwig/angleproject) will need to be updated to
MS Open Tech's latest version.
2014-03-22 20:48:18 -04:00
Ryan C. Gordon
5901fc9f84 Static analysis fix: more cleanups of unused variables, etc, in blitters. 2014-03-21 10:40:15 -04:00
Ryan C. Gordon
6d0646555a Static analysis fix: more dead stores. 2014-03-21 00:57:43 -04:00
Ryan C. Gordon
49030ac00b Patched to compile on C89 compilers, removed more streamer code. 2014-03-20 18:00:41 -04:00
Ryan C. Gordon
dd3608ac1f Static analysis fix: clean up unused variables and dead stores in blitters. 2014-03-20 17:55:24 -04:00
Ryan C. Gordon
5995d23c5c #ifdef'd out the audio streamer code.
It's been hardcoded out forever now, but I've now forcibly removed it with
the preprocessor so static analysis doesn't complain about it for now.

Eventually I want to rewrite or remove this code.
2014-03-20 17:00:33 -04:00
Ryan C. Gordon
e1ae251343 Static analysis fix: Removed unused variable.
(We don't care if closing the device fails anyhow).
2014-03-20 16:56:37 -04:00
Ryan C. Gordon
798fd9ae6b Static analysis fix: uninitialized data.
(This is Clang not knowing that SDL_SetError() always returns -1.)
2014-03-20 16:54:20 -04:00
Ryan C. Gordon
4669d7bdb4 Static analysis fix: uninitialized data.
(Clang doesn't know that "_this" was already checked for NULLness elsewhere.)
2014-03-20 16:25:30 -04:00
Ryan C. Gordon
29ddc0d96f Static analysis fix: uninitialized value.
(A false positive: clang doesn't know SDL_SetError() always returns -1.)
2014-03-20 16:23:18 -04:00
Ryan C. Gordon
cadaaa5221 Static analysis fix: leaking Objective-C object. 2014-03-20 16:05:57 -04:00
Ryan C. Gordon
7d5396a146 Static analysis fix: dereference of a NULL pointer. 2014-03-20 11:22:57 -04:00
Ryan C. Gordon
27c0634bd6 Static analysis fix: let clang know _this->displays isn't NULL. 2014-03-20 11:14:02 -04:00
Ryan C. Gordon
6e4667b331 Static analysis fix: division by zero. 2014-03-20 11:14:44 -04:00
Ryan C. Gordon
c950d2e608 Static analysis fix: uninitialized variables.
This is actually a false-positive, in this case, since Clang doesn't know
 that SDL_SetError() only ever returns -1. Feature request to improve that,
 with explanation about these specific SDL patches, is here:

   http://llvm.org/bugs/show_bug.cgi?id=19208
2014-03-20 10:41:47 -04:00
Ryan C. Gordon
3dee50f912 Static analysis fix: Fixed leaking Objective-C object. 2014-03-20 10:04:23 -04:00
Ryan C. Gordon
87d3426c78 Static analysis fix: bad release.
(object is already init'd at this point, so -[obj init] destroys
 existing reference count.)
2014-03-19 23:19:34 -04:00
Andreas Schiffler
353b516a34 Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite 2014-03-19 21:39:55 -07:00
Ryan C. Gordon
42b41b0cdd Static analysis fix: division by zero. 2014-03-19 18:25:21 -04:00
Ryan C. Gordon
d5a865d065 Static analysis fix: Value stored to '[bcd]' is never read. 2014-03-19 16:55:38 -04:00
Ryan C. Gordon
37f1a0a596 Static analysis fix: "Value stored to 'p' is never read" 2014-03-19 16:52:26 -04:00
Ryan C. Gordon
1a43e1cd11 Don't overwrite SDL_dynapi.h in checker-buildbot.sh. 2014-03-19 16:02:25 -04:00
Ryan C. Gordon
2be5efc8ad Fixed SDL_HapticNewEffect() failing on various DirectInput devices. 2014-03-18 17:16:28 -04:00
Ryan C. Gordon
5f04095886 Fixed PS4 game controller config on Windows. 2014-03-18 12:53:01 -04:00
Ryan C. Gordon
8f66b9ecc9 Whitespace fix. 2014-03-18 12:52:51 -04:00
Ryan C. Gordon
91cea37295 Fixed SDL_HapticOpenFromJoystick() with DirectInput devices. 2014-03-17 19:11:18 -04:00
Sam Lantinga
b13efe2755 Fixed iOS build 2014-03-15 19:30:52 -07:00
Sam Lantinga
9a71f76f31 Fixed bug 2450 - Crosscompiling for Win32 with MinGW fails due to WM_UNICHAR undeclared 2014-03-15 16:32:45 -07:00
Sam Lantinga
a6a5d25d08 Only show the window if it's supposed to be shown. 2014-03-15 16:27:06 -07:00
Ryan C. Gordon
75a2f78766 Mac: Make sure window is still showing when we exit a fullscreen space. 2014-03-15 15:35:15 -04:00
David Ludwig
3b082a24b3 Fixed broken rotation detection routines on WinRT
Rotation detection and handling should now work across all, publicly-released,
WinRT-based platforms (Windows 8.0, Windows 8.1, and Windows Phone 8.0).
2014-03-15 14:54:23 -04:00
David Ludwig
40ab193a0d Fixed a crash on Windows Phone 8 that occurred after rotating a device
This changeset prevents IDXGISwapChain::ResizeBuffers from being invoked on
Windows Phone 8, a function that isn't available on the platform (but is
available on other Windows platforms).  The call would fail, which ultimately
led to a crash.

This changeset also attempts to make sure that the D3D11 swap chain is created
at the correct size, when using Windows Phone 8.

Still TODO: make sure rotation-querying works across relevant Windows
platforms (that support Direct3D 11.x).
2014-03-15 13:27:18 -04:00
David Ludwig
8c3e6e0078 Fixed a build error when including WinRT's SDLmain file directly in an app 2014-03-15 10:37:40 -04:00
Sam Lantinga
bd5d79473a Fixed Mac OS X window level when leaving fullscreen mode 2014-03-14 18:06:09 -07:00
David Ludwig
4da0b83806 Added a missing file related to WinRT power management/reporting. 2014-03-14 01:36:05 -04:00
Sam Lantinga
b0e0446659 Added missing copyright notices 2014-03-13 21:21:26 -07:00
Sam Lantinga
6800e72d96 Fixed the copyright date on files contributed by David Ludwig 2014-03-13 00:40:08 -07:00
David Ludwig
2936e82ff8 Fixed line endings (CRLF to LF) in WinRT source code 2014-03-12 12:14:47 -04:00
David Ludwig
4ba15b7979 Merged various WinRT build fixes 2014-03-12 12:12:20 -04:00
David Ludwig
55712a534c Fixed various build and runtime errors when using WinRT with VS2012. 2014-03-12 11:57:15 -04:00
Sam Lantinga
846b841569 Fixed compiling Windows RT code on Visual Studio 2013 2014-03-12 07:26:07 -07:00
David Ludwig
3195c8a91a Fixed compiler errors in the D3D11 renderer when building for WinRT
Still TODO: fix other build errors, especially linker errors, when building
SDL/WinRT, then fix any runtime errors that pop up.
2014-03-11 12:40:31 -04:00
David Ludwig
6183af20ef Made VS2012 build the D3D11 renderer
This change is currently limited to Win32/Windows-Desktop builds.  Build fixes
for WinRT + VS2012 are still pending.
2014-03-10 22:53:03 -04:00
Andreas Schiffler
147451d2ca Fix bug/add test coverage for SDLTest_GenerateRunSeed helper; improve test harness adding output of repro steps for failures; improve negative test for SDL_GetError/SDL_SetError 2014-03-11 07:17:56 -07:00
Sam Lantinga
b2c1d1118a Fixed Mac OS X OpenGL context creation to match other backends, where we only care about the actual version we request if it's 3.0 or newer or a special profile context.
Eventually we'll probably move the version checking to higher level code and report the actual version of context that got created, but to avoid breakage we'll leave it like this for now.
2014-03-10 19:59:06 -07:00
Sam Lantinga
117af822d0 Fixed regression causing the renderer to recreate its window since it's not getting an OpenGL 2.1 context anymore. 2014-03-10 18:45:07 -07:00
David Ludwig
3fe569fba7 build fixes for most WinRT-related files
Still TODO: getting the D3D11 renderer back up and running in VC 2012.
2014-03-10 21:21:35 -04:00
Sam Lantinga
757405f2e2 Fixed D3D9 initialization on Windows 8, which doesn't have D3DX 2014-03-10 17:19:19 -07:00
Sam Lantinga
ba9226f22c Implemented fullscreen <-> windowed transition on Windows 8 2014-03-10 15:00:59 -07:00
Sam Lantinga
e4b5491e76 Fixed line endings 2014-03-10 14:35:37 -07:00
Sam Lantinga
279247db34 Fixed creating the rendering context on a specific device 2014-03-10 12:49:15 -07:00
Sam Lantinga
4d18b48a5b Implemented YV12 and IYUV texture support for the D3D11 renderer 2014-03-10 05:44:34 -07:00
Sam Lantinga
bceba2662d Minor style tweaks 2014-03-10 02:13:44 -07:00
Sam Lantinga
6b5a5ea12a Converted David Ludwig's D3D11 renderer to C and optimized it.
The D3D11 renderer is now slightly faster than D3D9 on my Windows 8 machine (testsprite2 runs at 3400 FPS vs 3100 FPS)
This will need tweaking to fix the Windows RT build.
2014-03-10 01:51:03 -07:00
Sam Lantinga
6de1873c6f Fixed renderer flags to include support for target textures after the renderer is created. 2014-03-09 22:48:38 -07:00
Ryan C. Gordon
0568a0661e Removed unused variable. 2014-03-10 00:48:41 -04:00
Ryan C. Gordon
9675bd556e Drop the default requested OpenGL version to 1.2.
Fixes default context creation on Mac OS X <= 10.6.
2014-03-10 00:01:14 -04:00
Sam Lantinga
f7af97f800 Fixed 64-bit warnings 2014-03-09 12:27:31 -07:00
Sam Lantinga
0ae88759fb Integrated David Ludwig's support for Windows RT 2014-03-09 11:36:47 -07:00
Sam Lantinga
32547d0c59 Fixed line endings on WinRT source code 2014-03-09 11:06:11 -07:00
Sam Lantinga
c75b319a11 Updated SDL to version 2.0.3 2014-03-09 10:38:30 -07:00
Ryan C. Gordon
7e7abde3f9 Patched to compile with MingW64 on case-sensitive systems (thanks, Martin!).
Fixes Bugzilla #2440.
2014-03-09 11:52:52 -04:00
Ryan C. Gordon
b35e2ffdab Patched to compile on C89 compilers. 2014-03-08 15:34:54 -05:00
Sam Lantinga
f638a095bd Fixed bug 2430 - Missing initialization of the variable 'centroid' inside SDL_GestureAddTouch
klose

File: SDL_gesture.c
Method: SDL_GestureAddTouch

When a new SDL_GestureTouch element is added to the global SDL_gestureTouch array the variable 'centroid' of the new element is not initialized.

The problem is that this variable is read isndie SDL_GestureProcessEvent when a SDL_FINGERDOWN event occurs.
2014-03-06 20:02:17 -08: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
Ryan C. Gordon
c6602d0b70 Mac: Added a hint to opt-out of new Spaces code. 2014-03-03 21:25:16 -05:00
Ryan C. Gordon
9a65153564 Removed unused variable. 2014-03-02 22:55:12 -05:00
Ryan C. Gordon
cc7258fa99 Mac: Don't lose the menu/dock when switching back to a resizable window Space. 2014-03-02 22:51:31 -05:00
Ryan C. Gordon
b86c040f6d Mac: only programmatically create Spaces if we're FULLSCREEN_DESKTOP.
(coming back from fullscreen in any state is okay).
2014-03-02 22:16:49 -05:00
Ryan C. Gordon
98d76187a1 A bunch of fixes for the new Spaces code. 2014-03-02 16:36:40 -05:00
Sam Lantinga
1dcae21b5c Fixed dictionary initialization 2014-03-02 13:06:51 -08:00
Sam Lantinga
749ddbf9b6 Updated to build on Mac OS X 10.7 with Xcode 4.6 2014-03-02 12:58:00 -08:00
Ryan C. Gordon
21438382f0 Mac: Manage menubar and dock as FULLSCREEN_DESKTOP windows become/resign key. 2014-03-02 15:35:24 -05:00
Bastien Nocera
1c7af18290 Add support for the freedesktop.org Idle Inhibition specification,
as per:
http://people.freedesktop.org/~hadess/idle-inhibition-spec/

This makes screensaver inhibition work with GNOME 3 and other
desktop environments that implement the specification.

https://bugzilla.libsdl.org/show_bug.cgi?id=2169
2014-03-02 14:59:06 -05:00
Sam Lantinga
a172285d7d Backed out changeset a6493ee0c9b5 2014-03-02 11:10:00 -08:00
Sam Lantinga
f737bed1b1 Make sure we return version 0 if XInput detection fails 2014-03-02 11:08:05 -08:00
Ryan C. Gordon
71e036e946 Reworked fullscreen policy on Mac OS X.
- SDL_WINDOW_FULLSCREEN works as always (change resolution, lock to window).
- SDL_WINDOW_FULLSCREEN_DESKTOP now puts the window in its own Space, and
  hides the menu bar, but you can slide between Spaces and Command-Tab between
  apps without the window minimizing, etc.
- SDL_WINDOW_RESIZABLE windows will get the new 10.7+ "toggle fullscreen"
  window decoration and menubar item. As far as the app is concerned, this is
  no different than resizing a window, but it gives the end-user more power.
- The hint for putting fullscreen windows into the Spaces system is gone,
  since Spaces can't enforce the requested resolution. It's a perfect match
  for FULLSCREEN_DESKTOP, though, so this is all automated now.
2014-03-02 12:45:51 -05:00
Ryan C. Gordon
7b668fae21 Better attempt to detect available X11 XInput2 features.
Fixes Bugzilla #2306.
2014-03-02 02:00:40 -05:00
Ryan C. Gordon
e3cdc782d7 Windows: Fixed crash if quitting without closing an XInput haptic device. 2014-03-02 00:02:56 -05:00
Ryan C. Gordon
e9ec71b8cd Added a FIXME. 2014-03-01 22:27:21 -05:00
Ryan C. Gordon
ce5a1c500a Fixed a typo in a comment. 2014-03-01 22:27:13 -05:00
Ryan C. Gordon
cddbb68413 Dynamically load glGetString(), to avoid direct dependency on OpenGL. 2014-03-01 21:33:48 -05:00
Ryan C. Gordon
322faffb4e Added some FIXMEs. 2014-03-01 20:59:43 -05:00
Ryan C. Gordon
aeca2b5cee Mac OS X: Make OpenGL context selection more robust, avoid software fallback.
Fixes Bugzilla #2197.
2014-03-01 20:46:45 -05:00
Ryan C. Gordon
a2dcb239e0 Force Windows version of SDL_GetPrefPath() to Unicode, create missing dirs.
Fixes Bugzilla #2273.
2014-03-01 20:28:40 -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
Sam Lantinga
a3680acb4a Changed SDL_HINT_ACCEL_AS_JOY to SDL_HINT_ACCELEROMETER_AS_JOYSTICK to be more clear. 2014-03-01 12:21:15 -08:00
Sam Lantinga
5720d883b5 Fixed compiler warning 2014-03-01 11:42:12 -08:00
Sam Lantinga
66d7bf9e8a Fixed compiler warning 2014-03-01 11:40:41 -08:00
Sam Lantinga
375fd97935 Fixed bug 2368 - Security Software is blocking RegisterRawInputDevices()
Yamagi

A customer of mine had the strange problem, that SDL_SetRelativeMouseMode() was failing for him on Windows 7. Luckily he was willing to provide some debug informations. We could track this problem down to RegisterRawInputDevices() failing due to security software running on his system (Norton Internet Security to be precise, but there are reports of similar problems with other products. For example [1]). Working around this issue with SDL_WarpMouseInWindow() is easy, and while I don't think that SDL2 can provide an internal workaround it would be really nice and helpfull if this could be documentated somewhere.

1: http://forums.codeguru.com/showthread.php?498374-How-to-run-a-very-long-SQL-statement
2014-03-01 09:59:06 -08:00
Sam Lantinga
34d80ff6f0 Fixed bug 2423 - timeBeginPeriod & timeEndPeriod mismatch
Coriiander

In src\timer\windows\SDL_systimer.c there is an error with regards to timeBeginPeriod and timeEndPeriod. These functions typically get called when no high resolution timer is available, and GetTickCount is not used.

According to MSDN (link: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757624(v=vs.85).aspx), for every call to timeBeginPeriod a subsequent call to timeEndPeriod is required. While SDL is currently doing this, it fails to call timeEndPeriod when cleaning up/shutting down SDL. Please note that these functions affect things on a system level. Failing to call timeEndPeriod, disables applications for using WINMM-timers after usage&shutdown of SDL, as effectively they the mechanism is now broken.

Solution:
Ensure this code gets called when shutting down the timer subsystem:

#ifndef USE_GETTICKCOUNT
if (!hires_timer_available)
{
    timeSetPeriod(0);
}
#endif
2014-03-01 09:50:52 -08:00
Sam Lantinga
a22f31f4e8 Null termnate the pUserMappings variable to prevent memory corruption. 2014-02-28 16:24:41 -08:00
Sam Lantinga
ef7c0b7e35 Added a hint to enable the screensaver by default 2014-02-28 14:23:41 -08:00
Ryan C. Gordon
cd05b015bc Disable the screensaver by default.
Fixes Bugzilla #2218.
2014-02-27 22:06:41 -05:00
Gabriel Jacobo
296eeedbcc Improve window recreation logic in OpenGL* renderers 2014-02-27 20:21:46 -03:00
Jørgen P. Tjernø
532dccfbc1 Mac: Forgot return value in last commit. 2014-02-26 16:27:03 -08:00
Jørgen P. Tjernø
6492cbd011 Mac: Don't disassociate cursor if window is moving / doesn't have focus.
Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396
2014-02-26 16:10:52 -08:00
Jørgen P. Tjernø
027b16bfb4 Mac: Redo cursor warp handling.
This fixes bugs related to getting unnaturally large xrel/yrel for
SDL_MOUSEMOTION after warps and enabling / disabling relative mode.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=1836
2014-02-26 11:35:02 -08:00
Jørgen P. Tjernø
d348541bf0 Mac: Improve moving relative mode windows.
This makes it possible to move windows by their title bar, even if they're in
relative mode, if you click the title bar when the window does not have focus.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396
2014-02-25 17:27:41 -08:00
Jørgen P. Tjernø
2ccfd3e029 Mac: Fix error message for haptic subsystem.
We were calling SDL_Error instead of SDL_SetError when the haptic subsystem
wasn't initialized.
2014-02-25 17:25:49 -08:00
Jørgen P. Tjernø
50c4b640c0 Mac: Immediately update current OpenGL context's shape.
Previously we were postponing our -[NSOpenGLContext update] call to the next
SDL_GL_SwapWindow, even if the context was current on the current thread. This
changes it so that we will do the update immediately if it's the current
context.

If you're rendering on another thread, you need to call SDL_GL_SwapWindow once
after a resize event to ensure your drawable will produce non-garbage data.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2339
2014-02-25 15:28:12 -08:00
Gabriel Jacobo
0b4a7a6d0d Fixes #2308, recreate window if GL requirements for the renderer are not met
If the window has been created with values for SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION not matching those
required by the renderer, attempt to recreate the window.
This is needed on platforms where both GL and GLES 1/2 surfaces are supported
by the video backend, requiring that the window be recreated when switching
between context types.
2014-02-25 17:42:34 -03: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