Commit graph

171 commits

Author SHA1 Message Date
Ryan C. Gordon
9b513dcd1a Intentionally breaking Windows and Raspberry Pi builds to test Buildbot change. 2013-10-20 20:02:02 -04:00
Ryan C. Gordon
8e7e52e3f3 Backed out hg changeset add2dbe99fe2. REFGUID is apparently a const type. 2013-10-20 16:03:11 -04:00
Ryan C. Gordon
851d584cac Patched to compile on non-C99 Microsoft compiler. 2013-10-20 16:02:24 -04:00
Ryan C. Gordon
4c61b66e11 Patched to compile on Windows. 2013-10-20 16:01:10 -04:00
Ryan C. Gordon
c774aeb135 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
9899cf8dcd 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
5f38eecab7 Don't bother calling SDL_SYS_HapticEffectType() at all for XInput devices. 2013-10-20 15:45:48 -04:00
Ryan C. Gordon
0f46c88d5c Fix adding of XInput devices (thanks, Mitchell!)
Partially fixes Bugzilla #2126.
2013-10-20 15:40:20 -04:00
Sam Lantinga
b8e37ecb4e It's okay to quit things more than once. 2013-10-20 10:39:26 -07:00
Sam Lantinga
83c2456ba1 Use vertex arrays for drawing points in addition to lines 2013-10-20 10:35:51 -07:00
Sam Lantinga
94a9160389 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
5032455fc3 Fixed compiling with the new X11 symbol wrapping 2013-10-20 09:58:37 -07:00
Stefanos Apostolopoulos
eefe43f86c 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
bd208d1e61 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
3f8bbc7e8d Fixed the XInput2 X11 symbols. 2013-10-18 10:56:45 -04:00
Sam Lantinga
cc7113cd3a 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
3fe757d859 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
bd35787ca1 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
76a9123566 Fixed 1598 - Mingwin build fails on src/audio/xaudio2/SDL_xaudio2.c 2013-10-17 23:15:27 -07:00
Sam Lantinga
56158d3b9e Removed redundant #ifdef 2013-10-17 23:05:40 -07:00
Sam Lantinga
e225c6a323 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
752afc0866 Don't supply duplicate X11 symbols inside SDL.
Fixes static linking when something else also uses X11.
2013-10-18 01:36:41 -04:00
Sam Lantinga
df094d9697 Fix to unbreak SDL_GetSystemRAM() on FreeBSD
Marcus von Appen

Revision eecbcfed77c9 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
a8f6e8f306 Fixed compiler warning if dynamic X11 loading isn't enabled. 2013-10-17 17:38:55 -07:00
Sam Lantinga
610c9e3ede Fixed using the wrong variable when reporting a missing SDL scancode mapping. 2013-10-17 17:37:23 -07:00
Sam Lantinga
1669b466da Fixed compiling on Mac OS X, added a system RAM test 2013-10-17 11:56:33 -07:00
Sam Lantinga
d509ea94dd The _SC_PHYS_PAGES method of calculating RAM works on Linux. 2013-10-17 11:32:14 -07:00
Sam Lantinga
983a114efa Added an API to get the amount of system RAM 2013-10-17 11:32:56 -07:00
Sam Lantinga
d7558521b7 Backed out revision fb5ab0e91c56, the platform specific messagebox functions don't have the right prototype since they're designed to be used standalone. 2013-10-14 09:12:30 -07:00
Sam Lantinga
fe533f5d04 For some reason, trying to raise the window programmatically while it's alt-tabbed away will minimize it. Added a workaround for this. 2013-10-14 08:56:55 -07:00
Sam Lantinga
ed1c6aaefa Fixed the windows message debug output so it works without HAVE_LIBC 2013-10-14 08:56:50 -07:00
Sam Lantinga
2d866e7a42 Added support for SDL_PIXELFORMAT_UYVY surfaces on Mac OS X 2013-10-14 08:56:37 -07:00
Sam Lantinga
75a0dc20b5 Fixed accumulating mouse wheel motion for the Microsoft Wireless Mouse 5000 2013-10-13 19:59:40 -07:00
Sam Lantinga
1b65c50cff Added an assert to catch init/quit call mismatch that might bite people. 2013-10-13 19:48:45 -07:00
Gabriel Jacobo
53ceeb94f0 Prevent keystrokes from leaking through to the console when using evdev.
This uses the same method Weston and X use. Sadly, to be fully effective when
launching remotely, this needs root permissions.
2013-10-13 17:15:43 -03:00
Gabriel Jacobo
fa34e8d946 Fixes X11 video backend compilation when no GL is available
For example, in our Raspberry Pi sysroot.
2013-10-12 16:29:34 -03:00
Sam Lantinga
02eded2276 Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
Sam Lantinga
11e8447008 Report joystick added/removed events even if we don't have udev.
T. Joseph Carter

As discussed (possibly to death), the Linux joystick driver does not actually report events for added or removed joysticks when you haven't got udev support.

We simply cannot know about removed joysticks without udev.  But we can (and we should) report adding them.  This brings the legacy case in line with pretty much the rest of SDL's joystick drivers.
2013-10-10 20:58:20 -07:00
J?rgen P. Tjern?
02a42dfe23 Mac: Better handling when someone else is the app delegate. 2013-10-07 16:01:40 -07:00
Ryan C. Gordon
7bf33541e7 Patched to compile in C90 mode. 2013-10-10 02:21:41 -04:00
Gabriel Jacobo
9959bb23ac Adds gl_profile_mask to test framework, uses it in testgles 2013-10-10 00:49:57 -03:00
Gabriel Jacobo
1abeec401e Fixes Bug 2134 - [Android] Black screen after resume (sometimes) 2013-10-10 00:30:03 -03:00
J?rgen P. Tjern?
9bc46b25ed Fix SDL_SetWindowPosition on fullscreen windows.
This reverts http://hg.libsdl.org/SDL/rev/7cdeb64faa72 and fixes it in
the correct way. If you call SDL_SetWindowPosition on a fullscreen
window, it would update the x & y variables for the window, but not
actually move the window (since it was fullscreen). That would make the
internal state of the SDL_Window incorrect, causing
SDL_WarpMouseInWindow to offset incorrectly.

This makes it so SDL_SetWindowPosition updates the `windowed' x & y
coordinates, which take effect when you revert from fullscreen.
2013-10-07 14:16:38 -07:00
Sam Lantinga
dfbb16995a Only allocate a joystick instance ID once we know it's a joystick.
This fixes compatibility with code that assumes 0 based joystick instance IDs.
2013-10-06 20:39:23 -07:00
Sam Lantinga
7588797989 Removed unused variables (thanks Joseph!) 2013-10-06 13:50:36 -07:00
Sam Lantinga
5f6afe6eb0 Check for NULL joystick in SDL_JoystickGetGUID() 2013-10-06 13:49:23 -07:00
Sam Lantinga
d8bdf0cf4b Fixed bug where a Logitech wireless keyboard with built-in mouse touchpad didn't get recongized as both devices. 2013-10-05 21:15:55 -07:00
Sam Lantinga
8f92b6d857 Fixed bug 2132 - Tests may use invalid SDL_window pointers when windows are closed
norfanin

Some of the tests keep using the pointers of a destroyed SDL_Window when the common event handling handled the close event. The event handler itself does not NULL the pointer after the destruction.

The attached patch adds a loop in the handler that will assign NULL to the destroyed window. It also adds checks to some of the tests so they skip those windows by checking for NULL.
2013-10-05 19:09:03 -07:00
Philipp Wiesemann
f7c69a02c8 Added detection of touch devices before first touch events happen on Android.
On Android available touch devices are now added with video initialization (like
the keyboard). This fixes SDL_GetNumTouchDevices() returning 0 before any touch
events happened although there is a touch screen available. The adding of touch
devices after a touch event was received is still active to allow connecting
devices later (if this is possible) and to provide a fallback if the new init
did not work somehow. For the implementation JNI was used and API level 9 is
required. There seems to be nothing in the Android NDK's input header (input.h)
to implement everything on C side without communication with Java side.
2013-10-05 17:08:19 +02:00
Sam Lantinga
49f4ff7ac9 Do a 32-bit compare on RGBA values. Thsi should be inlined in optimized builds. 2013-10-05 12:29:05 -07:00