Commit graph

7268 commits

Author SHA1 Message Date
Sam Lantinga
02e2f45a96 Fixed bug 2502 - Memory leak inside SDL_x11events.c -> X11_DispatchEvent(_THIS)
bojko_1000

Code @566:
            if (data->xwindow) {
                Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0);
                Atom type = None;
                int format;
                unsigned long nitems = 0, bytes_after;
                unsigned char *property;
                X11_XGetWindowProperty(display, data->xwindow,
                    _net_frame_extents, 0, 16, 0,
                    XA_CARDINAL, &type, &format,
                    &nitems, &bytes_after, &property);

                if (type != None && nitems == 4)
                {
                    border_left = ((long*)property)[0];
                    border_right = ((long*)property)[1];
                    border_top = ((long*)property)[2];
                    border_bottom = ((long*)property)[3];
                }
            }

Code after _the fix_:
            if (data->xwindow) {
                Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0);
                Atom type = None;
                int format;
                unsigned long nitems = 0, bytes_after;
                unsigned char *property;
                X11_XGetWindowProperty(display, data->xwindow,
                    _net_frame_extents, 0, 16, 0,
                    XA_CARDINAL, &type, &format,
                    &nitems, &bytes_after, &property);

                if (type != None && nitems == 4)
                {
                    border_left = ((long*)property)[0];
                    border_right = ((long*)property)[1];
                    border_top = ((long*)property)[2];
                    border_bottom = ((long*)property)[3];
                }
                X11_XFree(property);
            }

I have found that leak with valgrind.
2014-04-17 20:02:11 -07:00
Sam Lantinga
6ed15e04e5 Fixed bug 2503 - Loop indexing and event union errors in SDL_gesture.c
Lasse Öörni

While enabling $1 gesture support in the Urho3D engine which uses SDL2 I detected some errors in the gesture code in SDL_gesture.c:

- In the function SDL_SaveAllDollarTemplates() the following line should use index variable j instead of i:

    rtrn += SaveTemplate(&touch->dollarTemplate[i], dst);

- In the function SDL_SaveDollarTemplate() the following code should use index variable j instead of i:

    if (touch->dollarTemplate[i].hash == gestureId) {
        return SaveTemplate(&touch->dollarTemplate[i], dst);

- In the function SDL_SendGestureDollar() the x & y coordinates are being written to the mgesture structure, which results in garbage due to dgesture and mgesture being different data structures inside the union. The coordinates should be written to dgesture.x & dgesture.y respectively
2014-04-17 19:52:15 -07:00
Sam Lantinga
7f986f36f2 Updated configure with Brandon Schaefer's changes 2014-04-17 17:24:27 -07:00
Brandon Schaefer
c8df715775 Add DIRECTFB_CFLAGS to SDL_CFLAGS so its cflags will get added to the sdl2.pc 2014-04-17 14:02:21 -07:00
Brandon Schaefer
5355c554b2 Add MIR_CFLAGS to SDL_CFLAGS so these cflags are added to the sdl2.pc file. 2014-04-17 13:58:39 -07:00
David Ludwig
96c1989ddb WinRT: keyboard VirtualKey translation improvements from Sylvain Becker
Changes included:
- adding support for a few, additional, VirtualKey constants
- removing accesses to 'windows_scancode_table', as the table's contents
don't line up with WinRT virtual keys.  Using Windows older VK_* constants
may, however, be a good alternative in a future update.
2014-04-17 12:43:51 -04:00
Gabriel Jacobo
73340e35e6 Comment out eglWaitGL from Android_GLES_SwapWindow
Let's hope for the best! If anyone has a device affected by this removal,
please file a bug!
2014-04-17 12:44:08 -03:00
Ryan C. Gordon
184e944eee Minor change to a README to test Mercurial server.
--HG--
extra : rebase_source : 0d64ff8c5d705f5615a6aa525336905b98de271f
2014-04-12 17:40:55 -04:00
David Ludwig
d13884bf35 Added a README file regarding WinRT support
To note, this file is currently formatted with CRLF line endings, rather than
LF, to allow the file to be viewed with Notepad.
2014-04-09 21:29:19 -04:00
Sam Lantinga
4d9b83a876 Fail if we couldn't create the specified renderer 2014-04-05 16:25:30 -07:00
Philipp Wiesemann
e68f76da43 Removed empty statements. 2014-04-05 23:50:09 +02:00
Philipp Wiesemann
bbfa480b80 Fixed names of four hint environment variables. 2014-04-05 23:32:41 +02:00
Philipp Wiesemann
5e41b5887c Fixed unused local variable warning. 2014-04-05 23:24:33 +02:00
Philipp Wiesemann
274ec047ed Fixed typos in header comments. 2014-04-05 23:22:21 +02:00
Philipp Wiesemann
8158274826 Removed unused variable from test program. 2014-04-04 23:56:15 +02:00
Philipp Wiesemann
75fb3c2c6c Fixed doxygen comment in header. 2014-04-04 23:52:23 +02:00
David Ludwig
78755d7572 WinRT: "SDL" to "SDL2", both for .dll output files, and for MSVC project names.
All WinRT builds of SDL will now output, "SDL2.dll".  Previously, the Windows
8.x/RT builds would output, "SDL.dll", and Windows Phone 8 builds would output,
"SDL_WinPhone.dll".  The change to "SDL2.dll" puts WinRT dll naming in-line with
that seen on Win32.

SDL/WinRT's MSVC project files will now appear as either "SDL2-WinRT" or
"SDL2-WinPhone", when displaying in MSVC.

This set of changes should not break any older WinRT or Windows Phone 8 app
builds that rely on MSVC's Project-to-Project reference system to build SDL2 for
the correct platform(s), and to install SDL2 dll files into the apps' output
packages.  App builds that reference SDL dll files directly should, however,
now reference "SDL2.dll".

--HG--
extra : rebase_source : cab688db2d74f9a60f7937fa1ab53475cbd59229
2014-03-30 11:50:59 -04:00
Sam Lantinga
d6d4c108fd Fixed the joystick side of XInput haptic detection on Windows 8 2014-03-31 10:38:26 -07:00
Sam Lantinga
492dbb3124 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
Sam Lantinga
07f74cbbcc Fixed assertion loading button.bmp in testgamecontroller 2014-03-29 12:27:27 -07:00
Sam Lantinga
b2f1b89fbd Added testrumble to the Visual Studio 2013 solution 2014-03-29 12:27:02 -07:00
Ryan C. Gordon
ee2b15aebc Raspberry Pi builds should upload as .tar.xz instead of .tar.bz2.
Makes the archive about 40-50% smaller!

--HG--
extra : rebase_source : adac7393b54fb8c05cb868858c968da87f3d7199
2014-03-28 09:59:32 -04:00
Ryan C. Gordon
c36617ceb6 Changed a C++ single-line comment to /* */ style. 2014-03-26 16:19:52 -04:00
Pierre-Loup A. Griffais
6f15c8a12c 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
a08cc19712 Ignore unused mir event functions, need headers in Ubuntu 14.04 to use them. 2014-03-25 15:24:43 -07:00
Brandon Schaefer
61f0c01d38 Remove two unused variables, causing compiler warnings. 2014-03-25 15:18:18 -07:00
Brandon Schaefer
fdf9b30018 Re-enable Mir/Wayland support now that 2.0.3 has been released. 2014-03-25 14:33:34 -07:00
David Ludwig
0755238527 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
710797c3dd WinRT: Line ending fixes (CRLF to LF) 2014-03-24 22:12:38 -04:00
Gabriel Jacobo
e79e6a8637 Fixes #2456, controllermap's undo does not work correctly (by Bogdan Marinov) 2014-03-24 11:42:09 -03:00
Gabriel Jacobo
5d949ece7b Emit SDL_RENDER_DEVICE_RESET on Android when the GLES context is recreated 2014-03-24 11:04:42 -03:00
Ryan C. Gordon
b515741ed4 Added an assert to help static analyzer. 2014-03-24 07:12:26 -04:00
Sam Lantinga
c0e9a9afaf 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
4d02b5b07d Fixed warning on Mac OS X 2014-03-23 23:08:26 -07:00
Sam Lantinga
ce92ee5307 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.
bb174540%28v=vs.85%29.aspx
2014-03-23 22:53:50 -07:00
David Ludwig
0e9811178e 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.

--HG--
extra : rebase_source : 2047c915117c6711c7cfdc2c1ba3f89450435b8e
2014-03-23 22:07:01 -04:00
Ryan C. Gordon
11f6490bf5 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.)

--HG--
extra : rebase_source : 26cde4bbb2ae5fc232d49493c5b9775dcb52c9d7
2014-03-23 18:56:47 -04:00
David Ludwig
519432a55f D3D11: Fixed a crash after a GPU device-reset on Win32 2014-03-23 16:08:32 -04:00
David Ludwig
48ecbf8800 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
2876cd7415 Better keyboard detection when some of the keys are remapped, thanks to Lewis Wall 2014-03-23 09:44:04 -07:00
David Ludwig
9898ec50d5 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
6fb0bd3874 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
325241ac85 WinRT globals cleanup: Removed WINRT_GlobalSDLVideoDevice 2014-03-22 21:08:05 -04:00
David Ludwig
65440f863b 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.

--HG--
extra : rebase_source : 4dbab8a703aaa1d9820bd45297ebbb1ccc895883
2014-03-22 20:48:18 -04:00
Ryan C. Gordon
a433ec8983 Static analysis fix: more cleanups of unused variables, etc, in blitters. 2014-03-21 10:40:15 -04:00
Ryan C. Gordon
3fcb7daf2b Static analysis fix: more dead stores. 2014-03-21 00:57:43 -04:00
Ryan C. Gordon
1f04999dcd Patched to compile on C89 compilers, removed more streamer code. 2014-03-20 18:00:41 -04:00
Ryan C. Gordon
ebc9d00ccb Static analysis fix: clean up unused variables and dead stores in blitters. 2014-03-20 17:55:24 -04:00
Ryan C. Gordon
828d505ab7 #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
45e017fadd Static analysis fix: Removed unused variable.
(We don't care if closing the device fails anyhow).

--HG--
extra : histedit_source : 10cc228c321d46e93ff27225d8cacf91fbf5fa30
2014-03-20 16:56:37 -04:00