Commit graph

6111 commits

Author SHA1 Message Date
Jørgen P. Tjernø
187143d618 SDL_GL_DeleteContext would leave an invalid current_glctx.
Calling SDL_GL_DeleteContext wouldn't update current_glctx, so you could
end up with use-after-free and other goodies when you deleted a context.
2013-04-22 18:15:08 -07:00
Jørgen P. Tjernø
5a4c9c40f2 Forgot to add this file to Mac crash fix. 2013-04-22 18:15:00 -07:00
Jørgen P. Tjernø
f7032de060 Send mouse leave updates for Windows and X11.
We now generate a final SDL_MOUSEMOTION before the cursor leaves the
window, followed by a SDL_WINDOWEVENT_LEAVE.
2013-04-22 18:14:55 -07:00
Jørgen P. Tjernø
c7fb60a46b Make Cocoa_ShowMessageBox work in background threads. 2013-04-22 18:14:32 -07:00
Jørgen P. Tjernø
be8f97cb6a Fix Mac crash when creating fullscreen window introduced in 9d43403e9fc5.
makeKeyAndOrderFront: was sending three KVO transitions for isVisible,
for false -> true, true -> false, and then false -> true. This was
causing an infinite recursion.

We now suspend monitoring of the KVO before makeKeyAndOrderFront, then
resume afterwards and send any changes in isVisible's state.
2013-04-22 18:14:26 -07:00
VALVE\alfred@alfredlinux.valvesoftware.com
3bf28ba7c8 - make sure to send a joy removed event even if the joystick wasn't opened under OSX 2013-04-22 15:24:35 -07:00
Jørgen P. Tjernø
7849e997f6 Mac no longer loses OpenGL context when window is hidden.
This fixes an issue that would arise when you minimize / order out an
OpenGL window on Mac, where the window would lose it's window device.
Without a window device, you cannot render to the window.

It does so by making two changes:
  - Windows are no longer "oneShot" (which caused their window device to
    get destroyed when they're minified or ordered out)
  - Windows are no longer "deferred" (which caused the OS to defer
    window device creation until the window is shown, which meant that
    we couldn't properly makeCurrent to it)

Thanks to http://www.mikeash.com/pyblog/nsopenglcontext-and-one-shot.html
2013-04-22 12:07:16 -07:00
Jørgen P. Tjernø
c59f7d106e Properly reflect hidden/shown windows on OSX.
This fixes a bug where windows would always be considered to be in the
shown/hidden state they were originally created in.
2013-04-22 12:07:13 -07:00
Gabriel Jacobo
53c00d6cad Fixes #1815, don't release the LocalRef returned by SDL_AndroidGetActivity 2013-04-22 11:18:45 -03:00
David Ludwig
cf8a84626b future-proofing for Microsoft's C++/CX extensions, whereby "generic" is a reserved keyword 2013-04-20 23:05:08 -04:00
Jørgen P. Tjernø
e4b6ac8025 Fix overflow in recent gamecontroller trigger change. 2013-04-19 16:02:16 -07:00
Jørgen P. Tjernø
12a26f7c35 Make gamecontroller triggers have values in 0 - 32767.
This changes the old behavior of having values in the -32768 - 32767
range, like regular joystick axis. Now "button as axis" triggers (like
on Logitech controllers) and regular axis triggers (like on Xbox
controllers) have the same resting value, 0.
2013-04-19 10:51:21 -07:00
Gabriel Jacobo
ba5fc3539a Fix for bug #1776 by Jonathan Dearborn 2013-04-19 14:40:39 -03:00
Gabriel Jacobo
be4412d0f2 Fixes bug #1709, pthread tests fixes for CMake (Thanks Scott Percival!) 2013-04-19 13:25:39 -03:00
Ryan C. Gordon
5c189f9803 Fixed using the event queue lock before the mutex was created.
This has the benefit of ending the otherwise-bogus complaints that
 SDL_GetError() reports "Passed a NULL mutex" if you call it instead of
 checking if SDL_CreateWindow() actually succeeded.  :)

--HG--
extra : rebase_source : 49ed52691094eab9dd4012bb97f32fbcc678551e
2013-04-19 11:58:38 -04:00
Ryan C. Gordon
8069b5a7f3 Cleaned up the const_cast mess a little.
--HG--
extra : rebase_source : d3ca36c9e2438c114afe339d1cbf704d318b6185
2013-04-16 01:38:08 -04:00
Ryan C. Gordon
71b29b3822 Don't use glDisable(GL_TEXTURE_2D) in GLES2 renderer.
Fixes Bugzilla #1799.

--HG--
extra : rebase_source : bdcc78e0cbdb2879c7ae24666bea567ce24dcd74
2013-04-17 11:45:50 -04:00
Andreas Schiffler
56c27c7be9 Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite 2013-04-17 08:09:11 -07:00
Andreas Schiffler
5bd319e5b5 Fix bug 1764: incorrect variable assignment in RenderDrawLinesWithRects 2013-04-17 07:35:30 -07:00
Sam Lantinga
090d061ff2 Fixed bug 1805 - Memory Leak issue in src/video/x11/edid-parse.c file
Nitz

In Function,

MonitorInfo *
decode_edid (const uchar *edid)

In this function "info" is going out of scope and leaks the storage it points to, if the first if condition get true:
if (!decode_header (edid))
        return NULL;

So while returning from this if statement there should be free for "info" pointer.
2013-04-17 01:38:59 -07:00
Sam Lantinga
a438cbd7fe Fixed bug 1804 - Memory leak issue in src/video/x11/SDL_x11mouse.c
Nitz

In SDL_x11mouse.c file there is function named
static Cursor
X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
{
  // Some code

  data_bits = SDL_calloc(1, surface->h * width_bytes);
  mask_bits = SDL_calloc(1, surface->h * width_bytes);
  if (!data_bits || !mask_bits) {
     SDL_OutOfMemory();
     return None;
  }

 // Some code

}

Here is the problem in if statement,
suppose if !data_bits is false and !mask_bits is true then,
data_bits will go out of scope and leaks the memory it points to.

Solution is that data_bits and mask_bits should be checked separately, not by using OR operator.
2013-04-17 01:35:10 -07:00
Sam Lantinga
eb97bff0bd Fixed bug 1802 - NULL pointer dereference in SDL_AllocRW() if out of memory.
Philipp Wiesemann

There is a NULL pointer dereference in SDL_AllocRW() if the system is out of memory. The "type" field is always written. This may be fixed with an early return.

Or an else{} or not writing the field and using slower SDL_calloc().

This fault was recently introduced (http://hg.libsdl.org/SDL/rev/681820ca0e78).
2013-04-17 01:32:06 -07:00
Sam Lantinga
226fdc16e6 BMP files don't contain alpha information in the palette, the fourth element is reserved and must be zero. 2013-04-16 09:33:33 -07:00
Ryan C. Gordon
969adca54c Removed C++-style single-line comments from a public header (thanks, Martin!).
Fixes Bugzilla #1803.
2013-04-16 01:05:32 -04:00
Ryan C. Gordon
19909e7dcb Maybe actually fix compiler warning this time. 2013-04-16 00:09:48 -04:00
Ryan C. Gordon
86b8376c2b Fixed a compiler warning on Visual Studio. 2013-04-15 22:49:23 -04:00
Ryan C. Gordon
6bda63934d Make the new SDL_RWops::hidden::unknown::data2 field a void*, not an int. 2013-04-14 18:05:14 -04:00
Ryan C. Gordon
c865461ef8 Added a data2 field to the SDL_RWops::hidden::unknown.
This shouldn't change the ABI, since this struct had space left in the union.

--HG--
extra : rebase_source : 773ba0aa2ed9242d2259ed63384d23b98c33376a
2013-04-13 20:43:32 -04:00
Andreas Schiffler
619405f9a3 Add test coverage for SDL_SetWindowData and SDL_GetWindowData to Video suite 2013-04-13 09:45:39 -07:00
Ryan C. Gordon
7c5943b1ee Fixed a typo (thanks, Ethan!). 2013-04-10 22:18:10 -04:00
Jørgen P. Tjernø
4bf8e7bd24 Numlock & pause fix from Alfred.
Fix numlock and pause keys not being pressable on win32, they both report under
the same scancode, so use the VK to tell them apart

--HG--
extra : histedit_source : ea129a468bd8ca3164b1aaea0fa143cf2e130b7b
2013-04-10 14:11:26 -07:00
Ryan C. Gordon
8d0b0c59bf More const_cast fixes for C++ apps using the public headers (thanks, Martin!). 2013-04-08 18:37:50 -04:00
Ryan C. Gordon
280675858c Fixed another infinite recursion accident in stdlib. 2013-04-05 16:34:59 -04:00
Ryan C. Gordon
45592bbbee Corrected some stdinc inline functions (thanks, Martin!).
qsort() returns void, so remove the "return" keyword, plus some C++
 const_casting magic.

 Fixes Bugzilla #1785.
2013-04-04 11:35:22 -04:00
Jørgen P. Tjernø
50a23e3026 Improve testgamecontroller output & robustness. 2013-04-03 16:48:23 -07:00
Jørgen P. Tjernø
cbd1884115 Add 3 Logitech gamecontroller mappings for Mac OS X. 2013-04-03 16:48:20 -07:00
Ryan C. Gordon
7641f6840f Fixed compiler warnings in Mac Xcode builds. 2013-04-03 11:58:04 -04:00
Ryan C. Gordon
569de57dd7 Another attempt at fixing compiler warnings for SDLTest_SurfaceImage_t. 2013-04-03 11:49:25 -04:00
Ryan C. Gordon
b58d643086 Compiler warning fixes for Windows message box code. 2013-04-03 11:48:03 -04:00
Ryan C. Gordon
9baec7cd8b Possibly fix compiler warnings, simplify SDLTest_SurfaceImage_t definition. 2013-04-03 11:38:05 -04:00
Ryan C. Gordon
7ffbc59786 Fixed compiler warnings. "leftFingerDown" doesn't need to be an SDL_FingerID. 2013-04-03 11:34:21 -04:00
Ryan C. Gordon
6bcac2ad67 Fixed infinite recursion (thanks, Rainer!). 2013-04-03 10:36:15 -04:00
Ryan C. Gordon
29399839e3 Check for a NULL pointer dereference.
--HG--
extra : rebase_source : 91c95190c0e39e48e79c1479e2c63bf096976867
2013-04-02 23:17:33 -04:00
Jørgen P. Tjernø
4926901d46 Add new controller mappings for Windows. 2013-04-02 18:09:30 -07:00
Andreas Schiffler
2b26967375 Add input validation and null checking to SDL_Get/SetWindowData [reported by Joseph T.] 2013-04-02 08:38:52 -07:00
Sam Lantinga
d197d674be Fixed bug 1780 - SDL_RWFromFile() sets an error on Android although a valid SDL_RWops pointer is returned.
Philipp Wiesemann

SDL_RWFromFile() sets an error to be queried with SDL_GetError() on Android although a valid SDL_RWops pointer is returned.

This happens if the fallback implemented in SDL_android.cpp is used to load compressed assets (see README.android in section "Loading assets") and results in a message like "java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed". I think this is confusing and not needed because the loading works as expected.

I attached a patch which changes SDL_android.cpp to not set an error if compressed assets are loaded. In this case also no Exception is queried and no additional string are created.
2013-04-02 07:57:37 -07:00
Sam Lantinga
25cefc7ef6 Fixed bug 1779 - SDL's Android project template has old default icons from Android.
Philipp Wiesemann

SDL's Android project template has old default icons from Android while iOS project template has custom icons with SDL's logo.

There is a Wizard in the Android Developer Tools to create "Android Icon Sets". As an example I created icons from the iOS loading screen and attached them in a ZIP archive. They are named "ic_launcher.png" instead of "icon.png" because that is the new name used in Android projects. To use them the AndroidManifest.xml needs to be changed to have "@drawable/ic_launcher" instead of "@drawable/icon". I do not know why there was no icon created for ldpi. Maybe it is deprecated.
2013-04-02 07:55:25 -07:00
Sam Lantinga
3bdfec9df0 Fixed bug 1781 - SDL sets an error for the initial touch on Android.
Philipp Wiesemann

SDL sets an error to be queried with SDL_GetError() for the initial touch on Android.

Android_OnTouch() in SDL_androidtouch.c uses SDL_GetTouch() to check if a touch device was already added. SDL_GetTouch() sets the error "Unknown touch device" for an out of range access because touch devices are added after initial touch. I think this error is confusing because it always happens by design.

I attached a patch which removes the call to SDL_GetTouch() and only uses SDL_AddTouch() which does the check (if already added) again and does not set an error (if not added yet).
2013-04-02 07:51:23 -07:00
Sam Lantinga
888d367270 Fixed bug 1782 - SDL_opengl.h header disabled on FreeBSD
q66

The SDL_opengl.h header contains this:

#ifdef __FreeBSD__  /* !!! FIXME: temp compiler warning fix... */
#define NO_SDL_GLEXT 1
#endif

However, I can't seem to find what kind of compiler warning it was and it makes it unusable to use on FreeBSD. If I comment out these lines on my machine, everything works fine - I use FreeBSD 9-STABLE (x86_64, gcc and clang both, the same in a x86 chroot). All I could find is that this was causing an error on FreeBSD 8, but I can't test that on my machine (maybe if I set up some FreeBSD 8 chroot).

I set up a 8.2 chroot and investigated the problem. Apparently this issue was fixed in Mesa 7.6 (and in Git, June 4 2009, but it didn't get into 7.5). By the time those lines were added, FreeBSD contained the libGL port version 7.4.4, which suffered from the issue, but on April 2012 the version was updated to 7.6, which is available for FreeBSD 8 and FreeBSD 9 alike, which means those three lines should be safe to remove (it'll work fine for everyone with sufficiently up to date ports).
2013-04-01 23:15:21 -07:00
Gabriel Jacobo
b39dd8c4e3 Backed out changeset: a500a9dbfb41 2013-04-01 13:21:23 -03:00