Commit graph

6862 commits

Author SHA1 Message Date
Sam Lantinga
165ad7a5e6 Fixed bug 2015 - surface getting leak in SDLTest_ScreenShot function
Nitz 2013-08-06 03:53:41 UTC

In function SDLTest_ScreenShot() surface pointer getting leak while return
2013-10-21 00:30:05 -07:00
Sam Lantinga
297b7e9f3b Fixed bug 2012 - Algorithm logic getting wrong in ComputeOutCode
Nitz

I was going through the SDL_IntersectRectAndLine function and wondered to see the ComputeOutCode function implementation.

The problem in this algo is, x and y axis are getting check with respect to 0, Which is wrong, it should be get checked with respect to rectangle x and y axis.
2013-10-21 00:25:43 -07:00
Sam Lantinga
01cfa82f08 Fixed bug 2061 - SDL_filesystem API not built using cmake
Marcus von Appen

The SDL_filesystem API does not get built properly on Unix and BeOS using cmake due to not including the correct C files.
2013-10-21 00:22:07 -07:00
Sam Lantinga
9eaceb18a0 Fixed bug 2072 - Make OS X's filesystem calls use -[NSString fileSystemRepresentation]
C.W. Betts

The recommended way of getting a file name that POSIX file APIs can open in OS X when using an NSString is -[NSString fileSystemRepresentation]. However, the current filesystem API in hg uses -[NSString UTF8String].
2013-10-21 00:20:27 -07:00
Sam Lantinga
f00b8b1fb4 Better cleanup if OpenGL initialization fails 2013-10-21 00:15:24 -07:00
Sam Lantinga
e8d2a8b3b8 Fixed bug 2156 - Android: Accelerometer values fed to joystick driver are inverted for the X axis and wrong for Z
Denis Bernard

Background information: http://developer.android.com/reference/android/hardware/SensorEvent.html#values

Steps to reproduce: compile testjoystick.c as an android app (change screen size according to your device). While running the app, also run:

adb logcat -c; adb logcat -s 'SDL:*' 'SDL/APP:*'

When tilting the device left/right, the joystick moves in the opposite direction of what one would expect. Or at least, the behaviour is not consistent with the Y axis.

Also when the device sits on a table (obviously not moving), the Z axis value oscillates between -32000 and +32000 (by overflow):

I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32511
I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32575
I/SDL/APP ( 1994): Joystick 0 axis 2 value: 32383
I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32386
I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32450
I/SDL/APP ( 1994): Joystick 0 axis 2 value: -32578

This is caused by the accelerometer yielding a constant value around 9.81 for Z and feeding something like 0.9 to 1.1 to the joystick driver, resulting in the overflow.

Proposed fix in SDLActivity.java (swap X and subtract G from Z reading)
2013-10-20 23:52:02 -07:00
Sam Lantinga
5548931ed6 Fixed a crash initializing Android touch IDs 2013-10-20 23:23:25 -07:00
Sam Lantinga
042962f130 Fixed the status bar visibility in iOS 7 2013-10-20 23:05:53 -07:00
Sam Lantinga
d3ebd00978 Fixed Y axis inversion on iOS; positive is up, negative is down. 2013-10-20 22:23:09 -07:00
Sam Lantinga
44dbed38ac Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings
Andreas Ertelt

The problem in question is caused by changeset 7771 (http://hg.libsdl.org/SDL/rev/4434498bf4b9 / https://bugzilla.libsdl.org/show_bug.cgi?id=2121)

The redefinition of __inline__ (introduced by the addition of begin_code.h:128's "|| __STRICT_ANSI__") results in mingw's gcc throwing multiple

   warning: always_inline function might not be inlinable [-Wattributes]

as well as a whole bunch of redefinitions of mingw internals which break linking of projects including the SDL2 headers.
2013-10-20 21:56:15 -07:00
Sam Lantinga
4e8f81ab6e Prevent conflicts when linking both SDL2 and SDL2_gfx 2013-10-20 21:34:38 -07:00
Sam Lantinga
4d7a5efe31 Fixed windows compile 2013-10-20 20:49:36 -07:00
Sam Lantinga
367ffcc3af Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values.
Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
2013-10-20 20:42:55 -07:00
Sam Lantinga
84561c952a Added __WINDOWS__ to reflect both 32 and 64-bit windows platforms 2013-10-20 20:41:30 -07:00
Ryan C. Gordon
8d51830d7b Fix some edge cases in XInput haptic timing. 2013-10-20 23:38:19 -04:00
Ryan C. Gordon
a8de1da24d Disable Win32 thread naming again. See Bugzilla #2089. 2013-10-20 23:08:45 -04:00
Ryan C. Gordon
7a0350ba09 Added SDL_GL_FRAMEBUFFER_SRGB_CAPABLE (thanks, David!).
Fixes Bugzilla #1985.
2013-10-20 21:18:05 -04:00
Ryan C. Gordon
197b270ca8 Backed out changeset c8a0b7c05db8, done testing Buildbot changes. 2013-10-20 20:24:00 -04:00
Ryan C. Gordon
cfcf5384b7 Intentionally breaking Windows and Raspberry Pi builds to test Buildbot change. 2013-10-20 20:02:02 -04:00
Ryan C. Gordon
e9b771e52a Backed out hg changeset b92b8c52946c. REFGUID is apparently a const type. 2013-10-20 16:03:11 -04:00
Ryan C. Gordon
ed8a935593 Patched to compile on non-C99 Microsoft compiler. 2013-10-20 16:02:24 -04:00
Ryan C. Gordon
613246f860 Patched to compile on Windows. 2013-10-20 16:01:10 -04:00
Ryan C. Gordon
4d56787378 Allow XInput haptics to run for SDL_HAPTIC_INFINITY time (thanks, Mitchell!).
Partially fixes Bugzilla #2126.
2013-10-20 15:55:47 -04:00
Ryan C. Gordon
0c739575a3 Fixed goofy logic in haptic device comparison code.
Mitchell Keith Bloch did the research on this bug, and came up with a slightly
 different patch than this.

Partially fixes Bugzilla #2126.
2013-10-20 15:49:52 -04:00
Ryan C. Gordon
da32e8f576 Don't bother calling SDL_SYS_HapticEffectType() at all for XInput devices. 2013-10-20 15:45:48 -04:00
Ryan C. Gordon
cc7596fc7e Fix adding of XInput devices (thanks, Mitchell!)
Partially fixes Bugzilla #2126.
2013-10-20 15:40:20 -04:00
Sam Lantinga
58b5460692 It's okay to quit things more than once. 2013-10-20 10:39:26 -07:00
Sam Lantinga
c3ae637f37 Use vertex arrays for drawing points in addition to lines 2013-10-20 10:35:51 -07:00
Sam Lantinga
bf136121da Fixed bug 1392 - Debian patch: do not propagate -lpthread
manuel.montezelo

Since the bug report[1] in 2006 Debian is shipping the patch attached.

[1] http://bugs.debian.org/375822

Maybe nowadays you don't propagate that library for linking, so maybe the patch should be dropped, but at the moment I do not have an easy/quick way to check it.

So I am submitting this report in the case that you consider it useful (even if maybe the patch itself has to be reworked), or otherwise learn if the patch is unneeded or even harmful.
2013-10-20 10:19:51 -07:00
Sam Lantinga
2a5e664b39 Fixed bug 2158 - Pixel missing in SDL_RenderDrawLines
Sean McKean

I am running Ubuntu 12.04 (GL version 1.4 Mesa 8.0.4) , and on drawing a set of lines through the renderer through SDL_RenderDrawLines() (looped or not) or SDL_RenderDrawRect() I notice a pixel missing. For RenderDrawLines() it seems to be the second point in the sequence; for RenderDrawRect() it is the lower-right. This can be fixed by specifying SDL_RenderDrawPoint(s), but wouldn't it be easier to specify each pixel in a GL_POINTS glBegin/End loop in the OpenGL code, just to make sure?

I also ran the same program on Android; the rendering seemed to be correct, which uses glDrawArrays.
2013-10-20 10:10:14 -07:00
Sam Lantinga
d914072403 Fixed compiling with the new X11 symbol wrapping 2013-10-20 09:58:37 -07:00
Stefanos Apostolopoulos
4d8c9bdc1f Fix bug 1300 by querying current border size in ConfigureNotify, and adjusting window coordinates accordingly. 2013-10-20 17:23:43 +02:00
Sam Lantinga
473d52d092 Fixed bug 2162 - SDL_RenderClear not clearing entire render target
Kevin Wells

Overview:
SDL_RenderClear is only clearing part of a texture when it is the render target and a different size than the screen.

Steps to Reproduce:
1) This only occurs with the render driver set to direct3d, so: SDL_SetHint(SDL_HINT_RENDER_DRIVER,"direct3d")
Also, my window was 1280x720.

2) Create a texture for a render target with a resolution of 1024x1024:
texture=SDL_CreateTexture(main_window.renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET,1024,1024);
SDL_SetTextureBlendMode(texture,SDL_BLENDMODE_BLEND);

3) Target the texture for rendering: SDL_SetRenderTarget(main_window.renderer,texture);

4) Set the draw color to whatever you want (problem occurs with both 0,0,0,0 and 0,0,0,255 among others) and then clear the render target:
SDL_SetRenderDrawColor(main_window.renderer,0,0,0,0);
SDL_RenderClear(main_window.renderer);

Actual Results:
Only about the top 3/4s of the texture gets cleared on calling SDL_RenderClear. The bottom 1/4 or so does not clear.

Expected Results:
Entire render target should be cleared.
2013-10-19 01:29:23 -07:00
Ryan C. Gordon
54a9270523 Fixed the XInput2 X11 symbols. 2013-10-18 10:56:45 -04:00
Sam Lantinga
8f23826dcc Fixed bug 2108 - CMake does not set X11 includes properly for sdl2-config and friends
Marcus von Appen

The autotools-based code uses X_CFLAGS and some hackish x_includes code to add some necessary includes to SDL_CFLAGS for proper X11 and OpenGL include handling.

At the moment, the cmake-baed build code does not do that. Below is a patch, which provides the necessary changes to add a proper include to the SDL_CFLAGS.
2013-10-18 00:49:59 -07:00
Sam Lantinga
ef02b8a4ce Fixed bug 2123 - SDL_BlitScaled crashes in src/video/SDL_blit_N.c:2145
We need to reset the blit function when switching between scaled and unscaled blits.
2013-10-18 00:47:22 -07:00
Sam Lantinga
6cdb720c67 Fixed bug 2139 - SDL_CreateWindow/WIN_GL_LoadLibrary fails due to external iconv not being able to convert path
Jānis Rūcis

Brief history:

We recently ported a game from SDL 1.2 to SDL 2. While doing Windows testing, I soon discovered that the game exits without opening a window with my cross-compiled SDL2.dll, but works great with the SDL2.dll from the MinGW SDK on libsdl.org. It was as simple as swapping out the DLLs to make it work.

Running the game in Wine showed that the game actually does run, up until the call to SDL_CreateWindow, which fails and leads the game to print out an error:

Failure to create window (LoadLibrary("OPENGL32.DLL"): (null))

Which basically says that there was no error, but maybe that's a Wine quirk.

The error string originates in SDL_windowsopengl.c, in WIN_GL_LoadLibrary, which contains this piece of code:

    wpath = WIN_UTF8ToString(path);
    _this->gl_config.dll_handle = LoadLibrary(wpath);
    SDL_free(wpath);
    if (!_this->gl_config.dll_handle) {
        char message[1024];
        SDL_snprintf(message, SDL_arraysize(message), "LoadLibrary(\"%s\")",
                     path);
        return WIN_SetError(message);
    }

After some digging, I discovered the culprit: WIN_UTF8ToString returns NULL. Why? Because it calls iconv_open from an iconv.dll that does not support the UCS-2-INTERNAL encoding. Why does the official SDL2.dll work? Because it calls no external iconv functions at all.

It turns out that the Fedora MinGW infrastructure (from which I obtained the conventiently prebuilt iconv.dll) does not provide a DLL from libiconv, but instead provides a DLL from a minimal Windows library called win-iconv. Which knows a good bit, but doesn't know anything about UCS-2-INTERNAL:

http://code.google.com/p/win-iconv/source/browse/trunk/win_iconv.c#155

So there are two problems here:

1) The error message is clearly useless, because LoadLibrary is an innocent bystander. Instead wpath should probably checked for NULL, and a more appropriate error should be set. Ideally something that makes it clear than an external iconv is causing trouble.
2) SDL doomed itself at the ./configure step, by finding an existing iconv and happily using it without confirming support for the mandatory encodings required by SDL.

There are certainly a few easy ways out of the situation (although I didn't yet manage to figure out how to prevent ./configure from looking for external iconv), but this had me completely stomped for a good while, so I figured it's worth writing down if anything.

(Search also found this, which talks a little about using UTF-16LE instead of UCS-2-INTERNAL: https://bugzilla.libsdl.org/show_bug.cgi?id=2075)
2013-10-18 00:13:51 -07:00
Sam Lantinga
84d3120257 Fixed bug 2155 - automatically remap accelerometer coordinates according to screen orientation on Android
Denis Bernard

Background information: http://android-developers.blogspot.fr/2010/09/one-screen-turn-deserves-another.html and http://developer.android.com/reference/android/hardware/SensorEvent.html

Right now, the Android accelerometer event handler feeds raw accelerometer data  to the SDL Joystick driver. The result is that for landscape-only applications, the axis need to be swapped if running on a portrait device (like a phone), and vice-versa: running a portrait only app on a landscape device like a tablet.

The purpose of this patch is to perform coordinate remapping of the accelerometer data before feeding it to the SDL joystick driver so that the X axis of the joystick is always aligned with the X axis of the display, same for the Y axis.

This has been tested on applications that support screen orientation changes as well as applications with fixed screen orientations, both on phones and tablets.
2013-10-17 23:44:30 -07:00
Sam Lantinga
4a8f77da84 Fixed bug 2069 - Device addition/removal queries all USB devices rather than only HID devices.
Andreas Ertelt
SDL_dxjoystick.c is setting the classguid for device (dis)connect events to USB Devices in general:
    dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;

Wouldn't it make more sense to have it just subscribe to Hid device events? This would mean less meaningless events reaching the application.
2013-10-17 23:40:13 -07:00
Sam Lantinga
6c8cb100a0 Fixed 1598 - Mingwin build fails on src/audio/xaudio2/SDL_xaudio2.c 2013-10-17 23:15:27 -07:00
Sam Lantinga
26b26c8f01 Removed redundant #ifdef 2013-10-17 23:05:40 -07:00
Sam Lantinga
a999af88e9 Fixed building using MinGW
Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
2013-10-17 23:02:29 -07:00
Ryan C. Gordon
bf877ba691 Don't supply duplicate X11 symbols inside SDL.
Fixes static linking when something else also uses X11.

--HG--
extra : rebase_source : 8b913c842dd9793a3dbad68f070878d5931a8a94
2013-10-18 01:36:41 -04:00
Sam Lantinga
22648bd334 Fix to unbreak SDL_GetSystemRAM() on FreeBSD
Marcus von Appen

Revision c47ae79f0de8 of the SDL hg repo introduces the new
SDL_GetSystemRAM() function, which breaks the build on FreeBSD. Find
attached a patch, which unbreaks the build and also should (for most
cases) properly implement the sysctl support it.
2013-10-17 20:49:30 -07:00
Sam Lantinga
0e2c364251 Fixed compiler warning if dynamic X11 loading isn't enabled.
--HG--
extra : rebase_source : fa6d88273a5c3ab0f501f90bb98340bfedf5a086
2013-10-17 17:38:55 -07:00
Sam Lantinga
277d7b5c2c Fixed using the wrong variable when reporting a missing SDL scancode mapping.
--HG--
extra : rebase_source : addd6c5ccfe203f744ba50a120ebe5a1ca77476e
2013-10-17 17:37:23 -07:00
Sam Lantinga
308e51f9a2 Fixed compiling on Mac OS X, added a system RAM test 2013-10-17 11:56:33 -07:00
Sam Lantinga
73ef0c776e The _SC_PHYS_PAGES method of calculating RAM works on Linux. 2013-10-17 11:32:14 -07:00
Sam Lantinga
a04ca13c2d Added an API to get the amount of system RAM 2013-10-17 11:32:56 -07:00
Sam Lantinga
dc7ffa873c Merged 2013-10-14 09:15:41 -07:00