Commit Graph

914 Commits

Author SHA1 Message Date
Sam Lantinga 1b3d4e6d0e 565 textures have higher priority than 555 textures 2014-06-22 09:42:43 -07:00
Sam Lantinga d65ac7785f Restore window OpenGL state if creating an OpenGL renderer fails 2014-06-22 02:48:43 -07:00
Sam Lantinga b7b6d8ab7a Fixed crash initializing OpenGL ES renderer if OpenGL renderer fails 2014-06-22 02:30:36 -07:00
Sam Lantinga 5df11f8aa1 Made SDL_PIXELFORMAT_ARGB8888 the default texture format for consistency across renderer implementations. 2014-06-21 21:46:42 -07:00
Sam Lantinga 7b7828a46e You shouldn't get axis and hat events when your application doesn't have focus (unless you use the SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint) 2014-06-21 21:30:49 -07:00
Sam Lantinga f8b75b1a14 Fixed bug 2562 - SDL_hapticlist/_tail not set correctly
Zachary L

SDL_hapticlist and SDL_hapticlist_tail are not set correctly when quitting the subsystem. This matters because they are represented as global variables. In the case you quit and reinitialize the subsystems, problems with dangling pointers arise.

For instance, SDL_hapticlist_tail will not be null on second initialization and because of the check on line 298, it will fail to set SDL_hapticlist appropriately. This can cause a few things to go wrong, like feeding SDL_strcmp a null fname which can cause a segfault.
2014-06-21 20:40:00 -07:00
Sam Lantinga e8d84fbfaa Merged changes from Alexey Petruchik to support Android obb files
http://developer.android.com/google/play/expansion-files.html
2014-06-21 20:35:36 -07:00
Sam Lantinga b56b37cde6 Fixed warning when building without ibus 2014-06-21 17:25:59 -07:00
Sam Lantinga 62bdecc80c Fixed compiler warning with new OpenGL ES header files 2014-06-21 12:45:54 -07:00
Sam Lantinga d7924c73d6 Fixed bug 2563 - Remove obsolete code for supporting iOS < 5
Alex Szpakowski

Now that SDL for iOS requires at least iOS 5.1 at runtime, there are several old codepaths in the UIKit backend which can be removed. I've attached a patch which does so.
2014-06-21 12:43:57 -07:00
Sam Lantinga e8f8e6727a Fixed bug 2595 - Padded, non-contiguous YUV does not display correctly using OpenGL ES 2.0 renderer
Alvin

The new OpenGL ES 2.0 YUV Texture support does not correctly display padded, non-contiguous YUV data.

I am using SDL2 95bd3d33482e (as provided by 'hg id --id') from Mercurial.

The YUV data I am using is provided by the FFMPEG family of libraries. According to FFMPEG's documentation, "The linesize [pitch] may be larger than the size of usable data -- there may be extra padding present for performance reasons."

The dimensions of the video file that I am using are 480x360. What I get from FFMPEG is a Ypitch of 512, and Upitch and Vpitch are both 256.

When I pack new Y, U and V buffers with only the "usable" data (Ypitch is 480 and Upitch and Vpitch are both 240), and use those new buffers, the image is display correctly.

It appears that the Ypitch, Upitch and Vpitch parameters are not being used by SDL_UpdateYUVTexture().

I use SDL_PIXELFORMAT_YV12 for my YUV texture, however, the same results are seen when I use SDL_PIXELFORMAT_IYUV.

Not sure if this is related or not, but when I render the YUV texture (padded and unpadded) to a RGB24 texture, the resulting image is greyscale (or could by just the Y channel).

The URL field for this bug entry is set to my email (SDL mailing list archive) which includes an example image of what I see when rendering padded, non-contiguous YUV data.
2014-06-21 12:38:46 -07:00
Alex Baines 41a39837ca Add IBus IME Support, move DBus code to its own file. (v3.3 squashed) 2014-06-18 20:11:39 +01:00
Sam Lantinga 0d673844ac Fixed bug 2596 - SDL_SetError fails on on NULL on systems with vsnprintf
sfalexrog

On systems with vsnprintf call SDL_SetError fails when passed a NULL as an argument. SDL's implementation checks for NULL (as seen in the commit: https://hg.libsdl.org/SDL/rev/835403a6aec8), but system implementation may crash.
2014-06-21 11:52:53 -07:00
Sam Lantinga 80e401ab08 Added NaCl to SDL_GetPlatform() 2014-06-21 11:48:12 -07:00
Sam Lantinga 8ef5651185 Fixed compiler warning 2014-06-21 11:36:00 -07:00
Gabriel Jacobo 3b217eefd7 Fix another NaCl warning 2014-06-20 11:50:31 -03:00
Sam Clegg 7e52722dfd Fix compiler warnings in Native Client and Linux builds. 2014-06-20 11:10:16 -03:00
Gabriel Jacobo 6c5cb5400f Ooops, code that resists erasure, I've seen that in a movie. 2014-06-20 11:01:05 -03:00
Gabriel Jacobo 553cc07e9d Initialize nacl_io, removes SDL_NaClMount/Umount
It's just easier to use nacl_io's mount/umount directly.
2014-06-20 10:59:51 -03:00
Gabriel Jacobo 715a9829b9 Fix file name typo, thanks Sam Clegg! 2014-06-18 10:04:21 -03:00
Gabriel Jacobo ab238dc6e4 Assorted fixes for NaCl. Hat tip to Sylvain Becker 2014-06-16 09:54:33 -03:00
Gabriel Jacobo 9e55ace818 Fixes #2583, clean up EGL initialization 2014-06-16 09:47:23 -03:00
Sam Lantinga 260549d1ca Fixed bug 2567 - x11: Local dropped files are not URI-decoded
Melker Narikka

Local files that are dropped onto a window under X11
are not going through a URI decoding step, resulting in the following
in my test application:

Dropped file /home/meklu/Pictures/Screenshot%20from%202013-10-30%2014:04:50.png
Couldn't load /home/meklu/Pictures/Screenshot%20from%202013-10-30%2014:04:50.png

Expected result:

Dropped file /home/meklu/Pictures/Screenshot from 2013-10-30 14:04:50.png
Loaded /home/meklu/Pictures/Screenshot from 2013-10-30 14:04:50.png successfully

I've attached a patch that fixes the issue by doing URI decoding in-place on
the file string buffer.
2014-06-15 18:31:30 -07:00
Sam Lantinga af50403e50 Fixed bug 2575 - Current GL context tracking fails
Ronie Salgado

The GL Renderer current context tracking fails when one window is used with an SDL renderer but another separate window is used with a user handled OpenGL context.

Attached is a small program that reproduces this bug, at least in some Linux machines where an OpenGL renderer is provided by default.

Expected Output:
-"First window" should be blue.
-"Second window" should be green.

Gotten Output:
- "First window" black.
- "Second window" blue.

What happened:
The renderer created for the "first window" ends rendering into the "second window" OpenGL context.

Bug location:

SDL_render_gl.c - line 286 on hg:
static SDL_GLContext SDL_CurrentContext = NULL;

When making SDL_GL_MakeCurrent from the user perspective, that variable or the GL renderer is not notified about the OpenGL context change.

Solution proposal:
- Move the current GL context cache into another place global.
2014-06-15 18:09:39 -07:00
Sam Lantinga 2a082c07f6 Fixed bug 2580 - sndio backend improvements
Brad Smith

Attached is patch from the OpenBSD ports tree to add 24-bit support to the sndio backend and to make use of the sio_open() option SIO_DEVANY.
2014-06-15 17:26:30 -07:00
Sam Lantinga 6146fe85cc Fixed 2584 - Memory leak in Cocoa_GetDisplayName
Diego

The Xcode Instruments Leak tool reports a leak from IODisplayCreateInfoDictionary in Cocoa_GetDisplayName.
This happened after upgrading to Xcode 5.
2014-06-15 17:18:05 -07:00
Sam Lantinga 54771080f3 Add controller mapping for Bluetooth DualShock 4 controllers on Linux
Frank Praznik

Add a gamepad mapping entry for Bluetooth DualShock 4 controllers on Linux.
The button mapping is the same as the USB controller, but the GUID is
different.
2014-06-15 13:05:30 -07:00
Ryan C. Gordon 39bad809c3 Mac: Fixed crash when returning from a fullscreen Space on shutdown. 2014-06-15 11:59:16 -04:00
Ryan C. Gordon 446d19c4de Removed SDL_SYS_JoystickNeedsPolling().
It was simpler to just have the polling (actually: hotplug detection)
 functions return immediately if it's not an appropriate time to poll.

Note that previously, if any joystick/controller was opened, we would poll
 every time anyhow, skipping this function.
2014-06-14 23:31:23 -04:00
Ryan C. Gordon 9e5504f89d Mac: Run the CFRunLoop in joystick mode during SDL_SYS_JoystickNeedsPolling().
This fixes hotplugging failing to detect devices.
2014-06-13 14:52:26 -04:00
Alfred Reynolds 8c2c744ad5 - fixed crash if you removed a device twice, the deviceRef is invalid if removed from the removed device callback (added in http://hg.libsdl.org/SDL/rev/d4e4d0fcda03 ). 2014-06-13 10:50:24 -07:00
Ryan C. Gordon 2cce7b2ed3 Implemented Cocoa GetAbsoluteMouseState(). 2014-06-11 00:40:19 -04:00
Ryan C. Gordon 4676705de0 Implement Windows GetAbsoluteMouseState(). 2014-06-11 00:12:19 -04:00
Ryan C. Gordon c8c55a01f4 This should probably query async button state. 2014-06-11 00:12:06 -04:00
Ryan C. Gordon 8719a76535 Regenerated SDL_audiotypecvt.c with updated perl script. 2014-06-10 19:39:33 -04:00
Ryan C. Gordon 91b7fb00d0 Fix audio resampling in some cases.
Fixes Bugzilla #2389.
2014-06-10 19:37:59 -04:00
Gabriel Jacobo efa2d0581d Fixes audio for Native Client, and other fixes...
- SDL_NaClMount, SDL_NaClUmount
- Default mounting of https at / in SDL's main function
- More documentation in README-nacl.txt
2014-06-08 18:18:13 -03:00
Sam Lantinga 5ae12b46b5 The NaCL mount/unmount functions need to be in SDL_system.h and specific to NaCL 2014-06-08 12:05:17 -07:00
Philipp Wiesemann d2220917e0 Fixed typo in log message. 2014-06-08 13:03:45 +02:00
Sam Lantinga 47e0aa0e6a Fixed building on command line Mac OS X 2014-06-07 20:43:12 -07:00
Sam Lantinga 6101e4b20e Added SDL_sqrtf(), SDL_tan(), SDL_tanf() 2014-06-07 18:20:01 -07:00
Sam Lantinga 40538446d9 Fixed crash with SDL_SetError(NULL) 2014-06-07 17:31:50 -07:00
Sam Lantinga 9fb2cc10c0 dront78 implemented YUV texture support for OpenGL ES 2.0 2014-06-07 11:36:08 -07:00
Gabriel Jacobo 1e352d7929 Chrome's Native Client backend implementation 2014-06-06 15:45:59 -03:00
Brandon Schaefer 04a0836b1a Turns out visualstudio does not like PRIu64, soo lets just cast it to llu. 2014-06-05 15:37:33 -07:00
Brandon Schaefer 1f71676906 Fix warnings, only major one being an SDL_SetError not providing enough arguments. 2014-06-05 15:29:23 -07:00
Sam Lantinga 6671aa2a08 Code analysis annotations found a legitimate bug! 2014-06-05 09:49:45 -07:00
Ryan C. Gordon c8cf407ea3 Wired up Windows resize hit testing. 2014-06-05 00:54:43 -04:00
Ionut Leonte 2d38a71a1f Added SDL_HITTEST_RESIZE_*, and implemented for X11. 2014-06-05 00:45:16 -04:00
Ryan C. Gordon b861efde14 Implemented SDL_GetAbsoluteMouseState().
X11 only for now, but this should be doable on every platform, I think.
2014-06-05 00:03:33 -04:00
Ryan C. Gordon 264eb4bbed Added some (harmlessly) missing braces. 2014-06-05 00:02:42 -04:00
Brandon Schaefer d829af786e Assume all motion events are mouse events unless tool_type states otherwise. 2014-06-04 12:55:18 -07:00
Sam Lantinga 4fd03b9582 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 c15e26d77d 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 947a0b8bae 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/d54306e2b8a7
2014-06-04 10:57:12 -07:00
Sam Lantinga da6d9a9f2a Added annotations to help code analysis tools
CR: Bruce Dawson
2014-06-04 10:56:56 -07:00
Sam Lantinga 529bcf6293 Fixed bug 2526, but regressed delivering dead key presses 2014-06-04 10:56:43 -07:00
Sam Lantinga 4750fe7390 When the window fullscreen mode changes, update the display resolution 2014-06-04 10:56:37 -07:00
Sam Lantinga 707fd9f071 Fixed bug where changing the window border would change the window size on Windows. 2014-06-04 10:56:30 -07:00
Sam Lantinga 1e00c03f14 Fixed Mac OS X build 2014-06-04 10:56:17 -07:00
Sam Lantinga 45ed5ee494 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 3e3b34adc9 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 0d1f0fed71 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? d623c0b443 SDL_opengl: Fix Mac build with new glext.h 2014-06-04 09:59:10 -07:00
Sam Lantinga 65133ebc1b 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 16360b1979 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? c1e11f699e 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 ece2a9bf06 Hopefully really fixed the Android build 2014-06-02 09:20:09 -07:00
Sam Lantinga 5186be4a12 Fixed Android build 2014-06-02 09:12:51 -07:00
Sam Lantinga a8fcbc466a 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 6b90d7f58a 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 f6010ead184f) 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 32665131f6 Added a way to get the native Android window and EGL context 2014-06-02 09:01:26 -07:00
Sam Lantinga 3905b910f3 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 75c57f8db7 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 9d00f75a27 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 70df9cd0cd 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 18c31dec54 Fixed Direct3DCreate9Ex prototype 2014-05-31 11:53:19 -07:00
Sam Lantinga 0c6b99d576 Fixed cast 2014-05-31 11:48:52 -07:00
Sam Lantinga 49c53fd280 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 52222db255 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 bb7a27fadd 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 bcc2cc8722 Fixed hit-testing on Windows.
Needed to convert from screen to client coords.
2014-05-30 01:49:26 -04:00
Ryan C. Gordon 4ef6eddaf7 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 89ad793407 First shot (not even compiled) at Windows hit-testing support. 2014-05-29 13:39:02 -04:00
Ryan C. Gordon 98c03f391d 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 7a4ddcd8c6 Don't hardcode an 8 here. 2014-05-27 15:47:25 -04:00
Ryan C. Gordon 20ac4bae89 Some updates for the X11 drag areas work. 2014-05-27 15:40:03 -04:00
Damian Kaczmarek 2744c0195a Initial work on X11 implementation of SDL_SetWindowDragAreas(). 2014-05-27 14:41:16 -04:00
Ryan C. Gordon 3cbc83ef11 First shot at SDL_SetWindowDragAreas().
Only Cocoa implemented right now.
2014-05-27 01:27:42 -04:00
Ryan C. Gordon dd5277d65c 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 ded970f70f Flip this around to do the simpler condition first. 2014-05-24 18:23:56 -04:00
Ryan C. Gordon 668025c239 Implement SDL_CaptureMouse() for Mac OS X. 2014-05-24 18:23:39 -04:00
Ryan C. Gordon b7d2c0e9d6 Implemented SDL_CaptureMouse(). 2014-05-24 01:30:37 -04:00
Ryan C. Gordon 846a3e0776 Added some FIXMEs. 2014-05-24 01:27:19 -04:00
Ryan C. Gordon f0e0f4ca15 Fixed whitespace. 2014-05-24 01:25:27 -04:00
Ryan C. Gordon a2710516ef Generated dynapi stuff for the new WinRT entry points. 2014-05-24 01:23:57 -04:00
stopiccot 3cdae42d65 Fixing issues discovered by Philipp Wiesemann 2014-04-23 03:42:32 +03:00
stopiccot 612f4a69db inital apk extension support 2014-04-07 21:20:39 +03:00
Sam Lantinga d5c109b2f4 Fail if we couldn't create the specified renderer 2014-04-05 16:25:30 -07:00
Philipp Wiesemann 83200a3225 Removed empty statements. 2014-04-05 23:50:09 +02:00
Philipp Wiesemann 2d8b86bb07 Fixed unused local variable warning. 2014-04-05 23:24:33 +02:00
Sam Lantinga c3c24a335d Fixed the joystick side of XInput haptic detection on Windows 8 2014-03-31 10:38:26 -07:00
Sam Lantinga 764aa147ad 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 17a8d2934d Changed a C++ single-line comment to /* */ style. 2014-03-26 16:19:52 -04:00
Pierre-Loup A. Griffais 833cfe534a 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 8938c2b5db Ignore unused mir event functions, need headers in Ubuntu 14.04 to use them. 2014-03-25 15:24:43 -07:00
Brandon Schaefer 2298ed170f Remove two unused variables, causing compiler warnings. 2014-03-25 15:18:18 -07:00
David Ludwig a99bf4d705 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 cbf718461c WinRT: Line ending fixes (CRLF to LF) 2014-03-24 22:12:38 -04:00
Gabriel Jacobo 1f92c9dcac Emit SDL_RENDER_DEVICE_RESET on Android when the GLES context is recreated 2014-03-24 11:04:42 -03:00
Ryan C. Gordon dd81dad1ad Added an assert to help static analyzer. 2014-03-24 07:12:26 -04:00
Sam Lantinga 26823b1bb4 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 3317e4340d 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 119dff5546 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 6ab50a5e2e 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 46a80b04d8 D3D11: Fixed a crash after a GPU device-reset on Win32 2014-03-23 16:08:32 -04:00
David Ludwig 6ce684e92b 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 c3d1037665 Better keyboard detection when some of the keys are remapped, thanks to Lewis Wall 2014-03-23 09:44:04 -07:00
David Ludwig c2243092d7 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 50ee99ecb2 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 823bf72130 WinRT globals cleanup: Removed WINRT_GlobalSDLVideoDevice 2014-03-22 21:08:05 -04:00
David Ludwig b51a3206c8 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 cc52939853 Static analysis fix: more cleanups of unused variables, etc, in blitters. 2014-03-21 10:40:15 -04:00
Ryan C. Gordon 7bf36abfc0 Static analysis fix: more dead stores. 2014-03-21 00:57:43 -04:00
Ryan C. Gordon ba4b3aa944 Patched to compile on C89 compilers, removed more streamer code. 2014-03-20 18:00:41 -04:00
Ryan C. Gordon e177b1cc49 Static analysis fix: clean up unused variables and dead stores in blitters. 2014-03-20 17:55:24 -04:00
Ryan C. Gordon 6d6fba4b0a #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 a43dbfad0d 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 3aae0ed2c5 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 d7a253b5ec 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 93ba5bd899 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 a25bd63cc5 Static analysis fix: leaking Objective-C object. 2014-03-20 16:05:57 -04:00
Ryan C. Gordon 84b919a2a7 Static analysis fix: dereference of a NULL pointer. 2014-03-20 11:22:57 -04:00
Ryan C. Gordon b99a6253da Static analysis fix: let clang know _this->displays isn't NULL. 2014-03-20 11:14:02 -04:00
Ryan C. Gordon 415675bef0 Static analysis fix: division by zero. 2014-03-20 11:14:44 -04:00
Ryan C. Gordon b659c70080 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 1a2a3e9c8b Static analysis fix: Fixed leaking Objective-C object. 2014-03-20 10:04:23 -04:00
Ryan C. Gordon bcc2ed09b5 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 f018ca4694 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 e84fc5a368 Static analysis fix: division by zero. 2014-03-19 18:25:21 -04:00
Ryan C. Gordon 546cb8901e Static analysis fix: Value stored to '[bcd]' is never read. 2014-03-19 16:55:38 -04:00
Ryan C. Gordon faaaf6c572 Static analysis fix: "Value stored to 'p' is never read" 2014-03-19 16:52:26 -04:00
Ryan C. Gordon 7b893acdc1 Don't overwrite SDL_dynapi.h in checker-buildbot.sh. 2014-03-19 16:02:25 -04:00
Ryan C. Gordon 18c9a4e96b Fixed SDL_HapticNewEffect() failing on various DirectInput devices. 2014-03-18 17:16:28 -04:00
Ryan C. Gordon 2a2fb611d5 Fixed PS4 game controller config on Windows. 2014-03-18 12:53:01 -04:00
Ryan C. Gordon 978566a65b Whitespace fix. 2014-03-18 12:52:51 -04:00
Ryan C. Gordon 7eaf899796 Fixed SDL_HapticOpenFromJoystick() with DirectInput devices. 2014-03-17 19:11:18 -04:00
Sam Lantinga d4f2f01580 Fixed iOS build 2014-03-15 19:30:52 -07:00
Sam Lantinga 56b40ce046 Fixed bug 2450 - Crosscompiling for Win32 with MinGW fails due to WM_UNICHAR undeclared 2014-03-15 16:32:45 -07:00
Sam Lantinga 9245c93044 Only show the window if it's supposed to be shown. 2014-03-15 16:27:06 -07:00