Commit Graph

641 Commits (50ee99ecb2638b8660f857a210c729d3a519492a)

Author SHA1 Message Date
Ryan C. Gordon 69d85ff563 Bumped copyright date on Mir code. 2014-02-03 11:01:32 -05:00
Ryan C. Gordon 435b80b9a3 Disable some minor things that need newer Mir dev headers.
These headers apparently aren't default in Ubuntu 13.10 yet.
2014-02-02 23:55:51 -05:00
Ryan C. Gordon 6bc2977043 Added some SysWM bits for Mir. 2014-02-02 23:53:48 -05:00
Ryan C. Gordon 8674b7aeee Cleaned up headers and footers on Mir code. 2014-02-02 23:54:10 -05:00
Ryan C. Gordon 19f8c6224f Added Mir video target (thanks, Brandon!). 2014-02-02 23:41:46 -05:00
Philipp Wiesemann e8f5e010ad Fixed including SDL_internal.h twice for DirectFB. 2014-02-02 20:58:46 +01:00
Sam Lantinga 58edac3e69 Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Sam Lantinga 3bd0e9002e Fixed bug 2376 - no SDL_HasAVX
Haneef Mubarak

AVX is the successor to SSE* and is fairly widely available. As such, it really ought to be detectable.

This functionality ought to be trivial to implement, and not having it means being forced to write an ugly workaround to check for AVX (so that normal SSE can be used if AVX is not available).

Here is an example on detecting AVX from SO (it actually shows ways to cehck for all of teh fancy instructions):

http://stackoverflow.com/questions/6121792/how-to-check-if-a-cpu-supports-the-sse3-instruction-set
2014-02-02 00:33:31 -08:00
J?rgen P. Tjern? 338bf9cc6c Add SDL_GL_ResetAttributes. 2014-01-29 18:38:13 -08:00
Sam Lantinga d76c2cc1da Add a new hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that allows SDL_CreateWindowFrom() to set the pixel format of another SDL_Window (and also will set the SDL_WINDOW_OPENGL flag on the window created with SDL_CreateWindowFrom()).
The reasoning behind this change is that source2 in -tools mode has a single OpenGL context that is used with multiple different windows.  Some of those windows are created outside the engine (i.e. with Qt) and therefore we need to use SDL_CreateWindowFrom() to get an SDL_Window for those.  The requirement for sharing an OpenGL context across multiple different windows is that each window has the same pixel format.  To facilitate this, I now set SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT for the main window before calling SDL_CreateWindowFrom().  When I do this, SDL_CreateWindowFrom() will:

1. Set the pixel format of the returned window to the same pixel format as this SDL_Window passed in with the hint
2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for OpenGL rendering.

I only currently implemented this for Win32/WGL so implementing it for other platforms (i.e. X11) remains a TODO.

CR: SamL

Some pseudocode that shows how this is used in Source2:

HWND hExternalHwnd; // HWND that was established outside of SDL

// Create main window (happens inside platwindow.cpp)
SDL_Window *mainWindow = SDL_CreateWindow( , SDL_WINDOW_OPENGL .. );
// Create GL context, happens inside rendersystemgl
SDL_GLContext onlyContext = SDL_GL_CreateContext( mainWindow );

// Now I need to create another window from hEternalHwnd for my swap chain that will have the same pixel format as mainWindow, so set the hint
SDL_SetHint( SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, CFmtStr( %p, mainWindow) );

// Create the secondary window.  This returned window will have SDL_WINDOW_OPENGL set and share a pixel format with mainWindow from the hint
SDL_Window *secondaryWindow = SDL_CreateWindowFrom( hExternalHwnd );

// To render to the main window:
SDL_GL_MakeCurrent( mainWindow, onlyContext );
// Do some rendering to main window

// To render to the secondary window:
SDL_GLMakeCurrent( secondaryWindow, onlyContext );
// Do some rendering to secondary window
2014-01-30 12:30:40 -08:00
Sam Lantinga dbd4a917e0 Document Michael's changes adding TranslateMessage() back to the SDL message loop. 2014-01-30 12:27:24 -08:00
Sam Lantinga 5c58bd6877 * Added TranslateMessage call to SDL default message pump - was causing problems in S2 tools mode apps that used Qt. Qt relies on the WM_CHAR message generated by TranslateMessage and keyboard input was showing up in the UI as mixed-case. (Depending on which message pump got a given message - both SDL and Qt pump messages for the entire process.) Sam will review and possibly tweak this change before propagating to public SDL, but I'm checking this version in so I can integrate into S2 and fix the issue there. 2014-01-30 12:27:00 -08:00
J?rgen P. Tjern? 366b1727bb Mac: [NSApp keyWindow] is not valid in windowDidBecomeKey:
This fixes weird behavior on Mac where our first responder reverts to the window
itself, rather than the SDLTranslatorResponder, after the window has lost focus
once. This causes Escape to call cancelOperation: on the NSWindow, which by
default removes our fullscreen-ness.

When someone has turned off SDL_TEXTINPUT we should probably set another initial
responder that handles the Escape behavior, so that SDL_TEXTINPUT doesn't change
fullscreen behavior (and possibly other behavior) like it does now.
2014-01-29 18:37:23 -08:00
dbrady 109fe0e0dc fixed hat code validation. 2014-01-28 15:28:20 -08:00
Philipp Wiesemann 68f2fe6499 Fixed spaces in source file license comment. 2014-01-29 00:29:14 +01:00
Philipp Wiesemann 62b17e7edb Fixed comments in joystick implementation files claiming to be headers.
It seems comments were originally copied from SDL_sysjoystick.h.
2014-01-29 00:27:54 +01:00
Gabriel Jacobo f52d7f5eea [Wayland] Fixes segfault when mouse enters window 2014-01-28 11:39:37 -03:00
J?rgen P. Tjern? 2efa2dc227 X11: Don't redraw dialog box when mouse moves.
This fixes bug #2343. (https://bugzilla.libsdl.org/show_bug.cgi?id=2343)

Thanks to Melker Narikka for the patch.
2014-01-27 13:43:04 -08:00
Ryan C. Gordon aff44ccdb5 Patched to compile...uh, everywhere. :) 2014-01-27 16:13:13 -05:00
Ryan C. Gordon 87cfee27d0 Patched to compile on Windows when not supporting Direct3D. 2014-01-27 16:10:15 -05:00
Gabriel Jacobo 33479316c7 [Android] Fixes Bug 2370, don't send accelerometer changes when
Android_JNI_GetAccelerometerValues return SDL_FALSE (thanks to Jairo Luiz)
2014-01-27 17:59:19 -03:00
Gabriel Jacobo 50befa6201 Bug 2358 - [Android] Joystick Button Mappings are strange (fix by David Brady) 2014-01-23 08:44:25 -03:00
Ryan C. Gordon ecc0df0661 Fix detection of iOS for disabling dynamic API. 2014-01-22 12:39:34 -05:00
Gabriel Jacobo b131e74be4 Fixes 2356, [Android] SDL_JoystickGetAttached does not function
Also fix a potential NULL pointer access in android/SDL_SYS_JoystickGetGUID
2014-01-21 18:20:12 -03:00
Gabriel Jacobo cf9828a2a6 Move Wayland driver above dummy, check for driver availability before creation 2014-01-20 20:25:43 -03:00
Ryan C. Gordon 2ddd0c58c9 Patched to compile if Wayland is disabled via SDL_config.h (thanks, Martin!).
Fixes Bugzilla #2351.
2014-01-20 12:53:44 -05:00
Sam Lantinga 9e90acdfcf Make sure you clean up the associated renderer when destroying a window. 2014-01-18 11:47:03 -08:00
Gabriel Jacobo 129640af7a Fixes prototype declaration for wl_proxy_marshal_constructor [Wayland 1.4] 2014-01-16 15:02:41 -03:00
Gabriel Jacobo 838e76c699 Fix to compile against the Wayland v1.4 headers 2014-01-16 11:33:39 -03:00
J?rgen P. Tjern? 12e7fdcbb6 Don't minimize fullscreen windows when destroying them.
Previously, we'd minimize fullscreen windows (if
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS was set) during SDL_DestroyWindow if they
had keyboard focus, because we call SDL_SetKeyboardFocus(NULL) which yields a
OnWindowsFocusLost event.

Related to https://bugzilla.libsdl.org/show_bug.cgi?id=1840
2014-01-15 11:34:03 -08:00
J?rgen P. Tjern? bc92383eea Mac: Don't give windows focus back when we're closing them.
Fixes bug #1840 (https://bugzilla.libsdl.org/show_bug.cgi?id=1840)
2014-01-15 11:31:56 -08:00
J?rgen P. Tjern? a0c9e649f5 Allow switching between FS and desktop FS.
This should fix bug #2057 (https://bugzilla.libsdl.org/show_bug.cgi?id=2057)
2014-01-15 11:17:09 -08:00
J?rgen P. Tjern? a442f121e6 Test: Add Shift-Enter to switch between FS and desktop FS. 2014-01-15 11:08:55 -08:00
J?rgen P. Tjern? a6a56af91b Tests: Refactor key modifier checking. 2014-01-15 10:40:14 -08:00
J?rgen P. Tjern? 8f660a4627 Mac: Trigger SDL_FINGERUP for all touches.
Fixes bug #2348. Thanks to Alex Szpakowski for the patch!
2014-01-14 17:33:24 -08:00
Gabriel Jacobo c0d86b9237 Make EGL loading more resilient.
Lesson learned while trying to run L4D2 under Wayland :)
2014-01-14 21:29:38 -03:00
Gabriel Jacobo 272ebb8efb Dynamic loading support for Wayland 2014-01-09 13:56:21 -03:00
Edward Rudd 5fd5567c4c define a font-size for the "unicode" message box font so the text isn't unreadable on linux systems 2014-01-08 14:53:08 -05:00
Ryan C. Gordon d75665c776 Maybe fix Cygwin. 2014-01-08 01:07:57 -05:00
Ryan C. Gordon 960458e58c Patched to compile on Cygwin. 2014-01-08 00:58:03 -05:00
Ryan C. Gordon e9689e8df6 Another Android fix. 2014-01-08 00:51:31 -05:00
Ryan C. Gordon d16e630160 Updated Dynamic API jumptable. 2014-01-08 00:46:39 -05:00
Ryan C. Gordon afd0f32314 Patched to compile on Android (I think). 2014-01-08 00:40:48 -05:00
Ryan C. Gordon d5c977adb7 Patched to compile on OpenBSD. 2014-01-08 00:31:19 -05:00
David Ludwig 446a270487 WinRT: fixed bug: SDL_RenderReadPixels didn't work with certain orientations of the physical display 2013-12-10 22:34:08 -05:00
Ryan C. Gordon 090327e76e Implemented the Dynamic API magic. 2013-12-09 16:03:18 -05:00
David Ludwig b6f80d855e WinRT: enable the OpenGL ES 2 SDL_Renderer backend, if and when OpenGL ES 2 support is compiled in 2013-11-29 00:19:46 -05:00
David Ludwig ecfbb3f5dc WinRT: got the SDL-official OpenGL ES 2 changes working, in an experimental state 2013-11-28 22:59:21 -05:00
David Ludwig 7b5887b271 WinRT: implemented SDL_DetachThread() for WinRT 2013-11-28 22:24:13 -05:00
David Ludwig 46740a5a1c WinRT: merged with latest SDL 2.x/HG code
SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library.  The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
2013-11-28 22:09:21 -05:00
David Ludwig da0c0a4a33 WinRT: fixed bug: touch input coordinates weren't normalized [0..1]
Thanks to Pierre-Yves for pointing this out and providing a fix!
2013-11-28 21:15:05 -05:00
Sam Lantinga 9fa4da1353 Fixed windows build with conflict resolve 2013-11-28 02:31:32 -08:00
Sam Lantinga dee481350c Added alternative XBox 360 controller GUID on Linux
Leszek Godlewski

As described in the other thread
(http://lists.libsdl.org/pipermail/sdl-libsdl.org/2013-November/091997.html),
I've run into a case of SDL2 not recognizing a wireless Xbox 360
controller receiver properly on Debian Linux amd64 testing.
Apparently, the generated GUID is slightly different.

Device in question:
Bus 001 Device 015: ID 045e:0291 Microsoft Corp. Xbox 360 Wireless
Receiver for Windows
2013-11-27 10:29:43 -08:00
Sam Lantinga d2511d9ef9 Fixed bug 2260 - SDL_SetCursorGrab() is buggy on Windows
BurnSpamAddress

Steps to reproduce:
1. Grab the cursor with SDL_SetCursorGrab()
2. Alt-tab away from the window
3. Click on the titlebar of the window

This will cause the window to disappear underneath the taskbar!

This appears to be a general issue with ClipCursor() on windows, i.e. I am getting the same behavior if I call ClipCursor() directly.

It is caused by a feedback loop between the ClipCursor function and the modal resize/move event loop that handles mouse-based sizing on Windows.
2013-11-27 10:29:38 -08:00
Sam Lantinga fa4e4a643a Fixed large relative mouse motion when iconifying the SDL window.
Windows will move the window to -32000,-32000 when it is iconified, so we don't want to send mouse motion for iconic windows.
2013-11-27 10:29:32 -08:00
Sam Lantinga 2bb344d6dc Don't crash when no WM is present.
CR: Sam Lantinga.
2013-11-27 10:29:27 -08:00
Sam Lantinga 8574c0815c Fixed bug 2274 - SDL_ceil is incorrectly implemented when HAVE_LIBC is not defined
Ghassan Al-Mashareqa

The SDL_ceil function is implemented incorrectly when HAVE_CEIL is not defined (HAVE_LIBC not defined).

The following code:

    double val = SDL_ceil(2.3);
    printf("%g", val);

prints "2.0", as STD_ceil is defined as:

    double
    SDL_ceil(double x)
    {
    #ifdef HAVE_CEIL
        return ceil(x);
    #else
        return (double)(int)((x)+0.5);
    #endif /* HAVE_CEIL */
    }

This functions is used in the SDL_BuildAudioResampleCVT function of the audio subsystem (SDL_audiocvt.c), and causes a bug in that function.
2013-11-27 00:29:46 -08:00
Gabriel Jacobo 1ad0d24828 [Android] Fixes #2228, reworked touch code
Lets Android take care of which is the primary pointer (the one acting as the
mouse in SDL), reorganized the Java side code as well to make it easier to
understand.
2013-11-25 12:28:09 -03:00
Ryan C. Gordon 7e1289af32 Make internal SDL sources include SDL_internal.h instead of SDL_config.h
The new header will include SDL_config.h, but allows for other global stuff.
2013-11-24 23:56:17 -05:00
Ryan C. Gordon 31caa22d30 Patched stdlib changes to compile on Windows. 2013-12-09 13:30:35 -05:00
Ryan C. Gordon e769374096 Added SDL_vsscanf(). 2013-11-24 23:35:38 -05:00
Ryan C. Gordon 928b494630 Moved atomic API implementation out of headers. 2013-11-24 21:04:51 -05:00
Sam Lantinga b44e7470de Fixed display mode calculations for applications which are not DPI aware.
If your application wants to have access to the full resolution even when the system has DPI scaling enabled, call SetProcessDPIAware() before calling SDL_Init()

e.g.
	typedef BOOL (WINAPI *SetProcessDPIAware_t)(void);
	HMODULE hMod = LoadLibrary("user32.dll");
	if ( hMod ) {
		SetProcessDPIAware_t pSetProcessDPIAware = GetProcAddress( hMod, "SetProcessDPIAware" );
		if ( pSetProcessDPIAware ) {
			pSetProcessDPIAware();
		}
		FreeLibrary( hMod );
	}
2013-12-30 12:49:15 -08:00
Sam Lantinga 6915319683 Switch back to apartment threaded COM initialization, which was the previous default.
We do succeed now if the application previously initialized COM in multi-threaded mode.
2013-12-27 10:18:19 -08:00
Sam Lantinga 6f6c76a6a5 Make sure our window has mouse focus before processing raw input events.
This happens rarely, but not reproducibly, where we get raw input events for the window even though it doesn't have focus.
2013-12-27 10:18:18 -08:00
Sam Lantinga 27779311b4 Bump SDL to build with 10.7 SDK.
This also bumps the minimum requirement for building SDL to 10.7, and
removes some checking we no longer need.

CR: saml
2013-12-27 10:18:11 -08:00
Gabriel Jacobo fce6257c49 Implements touch support on QTWayland. Contributed by Thomas Perl. 2013-12-27 09:29:39 -03:00
Philipp Wiesemann 54a1f61a17 Changed return -1 after SDL_SetError() to return SDL_SetError(). 2013-12-25 17:02:15 +01:00
Philipp Wiesemann 87ad7a1c50 Fixed pointer from integer warning and bug if compiled without EGL. 2013-12-25 16:57:59 +01:00
Philipp Wiesemann b97e077e47 Fixed unused local variable warning in joystick source for Android. 2013-12-24 20:00:58 +01:00
Philipp Wiesemann 28309c1d13 Fixed implicit declaration of SDL_Log() warning in joystick source for Android. 2013-12-24 19:59:35 +01:00
Sam Lantinga 2521e49769 Setting the mouse in relative mode implies grabbing the mouse.
This fixes getting mouse button events in raw input relative mode on X11.
2013-12-23 17:55:06 -08:00
Sam Lantinga 7aef2350cf Added a relative mouse mode that uses mouse warping instead of raw input.
To enable this, set the environment variable SDL_MOUSE_RELATIVE_MODE_WARP to "1"

When mouse relative mode is disabled, put the cursor back where the application expects it to be, instead of where it was when relative mode was enabled.
2013-12-23 17:37:22 -08:00
Sam Lantinga 7fe277cd6a Fixed float to int conversion warning, which was a legitimate bug. 2013-12-23 17:15:32 -08:00
Sam Lantinga 8e0dfef153 Print events with SDL_Log() so they show up in Visual Studio debug output
Added some joystick and controller events to the set that are printed out.
2013-12-23 15:55:47 -08:00
Sam Lantinga 03aece5452 Generate SDL_CONTROLLERDEVICEADDED events for controllers connected at startup 2013-12-23 15:10:03 -08:00
Sam Lantinga 746928350f Added support for double-clicks, through a new "clicks" field in the mouse button event. 2013-12-23 12:17:52 -08:00
Sam Lantinga 3666c1f7ca Explicitly initialize COM with multi-threaded support.
This is the safest option for applications that use COM, multi-threaded or not.
2013-12-23 10:54:27 -08:00
Gabriel Jacobo ec1cb49eab Wayland support
Based on the original port to Wayland by: Joel Teichroeb, Benjamin Franzke, Scott Moreau, et al.

Additional changes in this commit, done by me:

* Wayland uses the common EGL framework
* EGL can now create a desktop OpenGL context
* testgl2 loads GL functions dynamically, no need to link to libGL anymore
* Assorted fixes to the Wayland backend

Tested on the Weston Compositor (v1.0.5) that ships with Ubuntu 13.10,
running Weston under X. Tests ran: testrendercopyex (all backends), testgl2, testgles2,testintersections
2013-12-14 20:18:43 -03:00
Gabriel Jacobo 4a8c296712 Context sharing for EGL 2013-12-13 09:48:12 -03:00
Gabriel Jacobo 2159de66c4 [Android] Poll joysticks every three seconds 2013-12-12 14:55:33 -03:00
Sam Lantinga 35ab76d083 Fixed bug 2050 - Obvious bugs in SDL_ltoa and SDL_lltoa
pjz

SDL_ltoa(-2147483648,s,10) only returns "-" because there is a bug in the code:

    if ( value < 0 ) {
        *bufp++ = '-';
        value = -value;
    }

but -(-2147483648) is still -2147483648 (0x80000000) as signed int (or long), so the following loop doesn't run at all. Similar bug are also in SDL_lltoa.

BTW, there is no sanity check for radix.
2013-12-11 21:17:24 -08:00
Gabriel Jacobo bfcd28c1e6 [Android] Hotplugging support for joysticks 2013-12-10 16:24:11 -03:00
Ryan C. Gordon d01ad02be7 Hook up SDL_acos and SDL_asin properly. 2013-12-09 15:17:20 -05:00
Sam Lantinga 5e656f8950 Associate the environment with any thread that calls Android_JNI_GetEnv(), in case it's been manually created with pthread_create() or C++11. 2013-12-07 11:19:52 -08:00
Sam Lantinga 44afc2a305 Fixed crash if no window has keyboard focus 2013-12-06 16:12:18 -08:00
Sam Lantinga 4ab350d4f2 Fixed detecting the wired XBox 360 controller on Linux
Also added some more debug output to detect issues
2013-12-06 09:13:31 -08:00
Sam Lantinga c78476dadc Fixed compiler warning on Visual Studio 2013-12-06 08:24:00 -08:00
Sam Lantinga 7afb76824e Added code missed in the resolve 2013-12-05 09:29:04 -08:00
Sam Lantinga 43825e275a Clean up the cursor clipping area when quitting SDL.
This fixes the cursor being clipped after the streaming client quits when streaming Dungeons of Dredmor
2013-12-05 09:14:56 -08:00
Gabriel Jacobo 6c495a806a [Android] Signal the resume semaphore after pushing the relevant events
Ref: Request in #2242
2013-12-03 12:09:58 -03:00
Gabriel Jacobo 5ac1813451 Adds SDL_GameControllerAddMappingsFromRW, updates controllermap
SDL_GameControllerAddMappingsFromFile is now a convenience macro.

controllermap can now skip bindings by pressing space or clicking/touching the
screen.
2013-12-03 12:01:28 -03:00
Sam Lantinga 013d99823d Fixed error return value in SDL_EGL_CreateSurface(), thanks to Mike Kasprzak 2013-12-02 23:54:35 -08:00
Gabriel Jacobo 95ec90aa8a Adds controllermap utility to test suite. 2013-12-02 19:35:04 -03:00
Gabriel Jacobo 45ae148aef Adds SDL_GameControllerAddMappingsFromFile 2013-12-02 19:34:08 -03:00
Gabriel Jacobo 7d9e42f28c Select EGL config when creating the EGL surface 2013-12-02 10:08:57 -03:00
Gabriel Jacobo f848adff5f Improve Android pause/resume behavior. 2013-11-29 10:06:08 -03:00
Philipp Wiesemann c933166401 Fixed bug 2258 - Crash when using Android clipboard
chw

The Android clipboard manager methods must be called from the UI thread,
otherwise crashes of the dalvikvm happen.
2013-11-23 23:38:16 +01:00
Philipp Wiesemann 01acbd389b Fixed spaces in license comment. 2013-11-23 18:34:27 +01:00
Philipp Wiesemann 2aa4974bf9 Removed include of no more needed header. 2013-11-23 18:29:36 +01:00
Gabriel Jacobo 7a18a6747b [Android] Fixes #2264, handle joystick open/closed state properly 2013-11-23 09:47:25 -03:00
Sam Lantinga a3bb007ee5 Fixed double-free of the window shape path 2013-11-23 02:02:29 -08:00
Gabriel Jacobo 4abeed93c7 Fixes compilation on Mingw. 2013-11-22 14:19:52 -03:00
Gabriel Jacobo 61959aa67b OpenGL ES support for Windows 2013-11-22 13:24:53 -03:00
Ryan C. Gordon a218717111 Query version for X11 XInput2 multitouch separately from base XInput2. 2013-11-20 21:17:26 -05:00
Gabriel Jacobo 9095952ac4 Clean up X11 OpenGL ES backend
If you really need to switch between OpenGL and GLES context types, just issue
a SDL_GL_UnloadLibrary manually.
2013-11-20 12:51:18 -03:00
Gabriel Jacobo 131a072503 Find the best EGL config available between those returned by eglChooseConfig
This existed in the old Android Java code, it got lost in the migration to the
commong EGL code.
2013-11-19 11:04:05 -03:00
Gabriel Jacobo fdfea4ad1f [Android] Try to improve handling of DPAD|GAMEPAD + KEYBOARD devices
It seems some devices report themselves as DPAD or GAMEPAD and KEYBOARD as well,
and we need to route different keycodes to different parts of SDL.
2013-11-19 10:00:05 -03:00
Sam Lantinga 48954ba194 Accidentally committed debug code 2013-11-18 20:22:36 -08:00
Sam Lantinga d75498f6be Textures need to be freed before renderers 2013-11-18 20:21:45 -08:00
Philipp Wiesemann 48cffe33f9 Added missing resource release in test source. 2013-11-18 23:45:46 +01:00
Philipp Wiesemann 3cba79970c Fixed unreachable return statement warning in gamecontroller source. 2013-11-18 23:43:15 +01:00
Philipp Wiesemann b5c6811108 Fixed implicit function declaration warning in joystick source for Android. 2013-11-18 23:38:59 +01:00
Sam Lantinga 9dd923fb9a When the mouse is grabbed it's constrained to the client area, not the window frame. 2013-11-16 21:19:16 -08:00
Sam Lantinga e4146267fa Fixed bug 2245 - add SDL_acos and SDL_asin
Sylvain

Here's some code to add arc cosine, and arc sin functions to SDL_stdlib.c
There are plainly written using SDL_atan.
2013-11-16 18:56:02 -08:00
Sam Lantinga 4e1ee55739 Fixed bug 2231 - Move src/input/evdev into src/core/linux
Ryan C. Gordon

To keep the directory layout sane, we should probably move this one piece of source to the linux catch-all directory, instead of making it look like this is part of an SDL "input" subsystem.
2013-11-16 12:02:09 -08:00
Sam Lantinga 3b52058f6c Fixed bug 2241 - SSE intrinsic in fillrect MMX path
norfanin

The MMX path in SDL_fillrect.c uses the SSE intrinsic _mm_stream_pi. The function or symbol provided by the compiler will not be present because the SSE header may not get included. The linker will complain about an undefined reference.

Since this is the only intrinsic used here (and someone forgot to create one for MOVQ), I think the MMX path can be removed completely. At least I don't see another way to move 64-bits from an MMX register to memory.
2013-11-16 11:54:16 -08:00
Sam Lantinga 8093cfd8ce Better fix for bug 2207 - SDL_RenderSetViewport behavior is different/incorrect on OpenGL renderer vs DirectX renderer
At least, it works better here on my Mac. :)
2013-11-15 22:07:35 -08:00
Sam Lantinga 30f7e86882 Added space in the common state structure for render targets 2013-11-15 22:01:58 -08:00
Ryan C. Gordon 4f39f0115b Fix viewport being upside down in OpenGL renderer.
Fixes Bugzilla #2207.
2013-11-15 23:20:50 -05:00
Sam Lantinga 4295a92f97 Fixed bug 2240 - On OS/X after calling SDL_SetWindowBordered right mouse clicks no longer register
philhassey

On OS/X after calling SDL_SetWindowBordered right mouse clicks no longer register.

Steps to Reproduce:

1. Open a windowed window on OS/X.  (With the border on.)

2. e.button.button will give values 1,2,3 depending on which mouse button I click.

3. Call SDL_SetWindowBordered to disable the border.

4. e.button.button will only give values 1,2.  3 (right mouse button) stops coming through.

Expected result:

I expect all mouse buttons to register.
2013-11-14 22:26:49 -08:00
Sam Lantinga ef97aab9cf Backed out changeset 6c59f7c8ec17 - it didn't actually do anything useful 2013-11-14 21:39:54 -08:00
Ryan C. Gordon b2f8b351d4 Fixed comment typo. 2013-11-14 20:24:40 -05:00
Gabriel Jacobo 35915d4f99 Clean up the EGL related video backends (X11, Android, RPi) 2013-11-14 20:14:02 -03:00
Ryan C. Gordon e899f0c4e0 Haiku: fixed uninitialized variable. 2013-11-14 14:42:20 -05:00
Ryan C. Gordon 00003e8c00 Renamed things named after BeOS to be named after Haiku instead. 2013-11-14 11:51:24 -05:00
Ryan C. Gordon dd325b9762 Patched to compile on Haiku. 2013-11-14 01:00:08 -05:00
Ryan C. Gordon 8d6e03f353 Added SDL_DetachThread() API. 2013-11-14 00:52:39 -05:00
Ryan C. Gordon 7550ddcc05 Started BeOS removal: merged BeOS thread and pthread code.
Haiku uses most of the standard pthread API, with a few #ifdefs where we
still need to fallback onto the old BeOS APIs.

BeOS, however, does not support pthreads (or maybe doesn't support it well),
so I'm unplugging support for the platform with this changeset. Be Inc went
out of business in 2001.
2013-11-13 22:35:26 -05:00
Sam Lantinga b36d98bd9c Diagonal flipping with RenderCopyEx
Ivan Rubinson

As it turns out, it was impossible to render a texture flipped diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
2013-11-13 21:50:59 -08:00
Gabriel Jacobo 5b8b403e3e [Windows] Fixes bug #1555, handle ALT+F4 on Windows 2013-11-13 11:18:37 -03:00
Sam Lantinga 397f5a850d Retain the high dpi flag when recreating the window (e.g when creating a renderer context) 2013-11-12 02:18:52 -08:00
Sam Lantinga 12961352d3 Fixed build error with SDK < 10.7 2013-11-12 02:04:12 -08:00
Sam Lantinga 253b9ba815 We still want to generally minimize on focus loss, but not when we're in a fullscreen space on Mac OS X. 2013-11-12 02:02:12 -08:00
Sam Lantinga 75145ea023 Added a hint SDL_HINT_VIDEO_FULLSCREEN_SPACES to specify that windows go fullscreen into their own spaces on Mac OS X. 2013-11-12 01:52:54 -08:00
Sam Lantinga 5f8a0b18d3 Fullscreen space naming cleanup to avoid confusion with normal fullscreen mode 2013-11-12 00:32:29 -08:00
Sam Lantinga 7459b159e0 Made sure the window had the correct border when manually being brought back from fullscreen mode. 2013-11-11 23:42:43 -08:00
Sam Lantinga cb190b8270 Fixed assertion when quickly toggling from fullscreen back to fullscreen:
"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'backgroundWindows not nil in enterFullScreenTransitionWithOptions:animated:activatingIt:'"

To reproduce this, run testsprite2, press Alt-Enter once, again while it's animating to fullscreen, and then again while it's animating out of fullscreen.
2013-11-11 22:43:05 -08:00
Sam Lantinga 8f8070db42 Fixed window resizing when entering and leaving fullscreen mode 2013-11-11 21:38:11 -08:00
Sam Lantinga 7cf76ffbe0 Fixed assertion failure when minimizing a fullscreen window. 2013-11-11 21:21:18 -08:00
Sam Lantinga 75a23d99a5 Fixed bug 2212 - SDL_SetTextInputRect has no effect on iOS
philhassey

Overview: While SDL_SetTextInputRect works perfectly to move my window out of the way of the virtual keyboard using SDL2/Android, on iOS this function has no effect.

Steps to Reproduce: Call SDL_SetTextInputRect with a rect near the bottom of the screen before calling SDL_StartTextInput.

Actual Results: The iOS virtual keyboard is displayed after calling SDL_StartTextInput, but the screen is not shifted to reveal the TextInputRect region.

Expected Results: The screen should be shifted to reveal the TextInputRect region (like with SDL2/Android.)

This patch implements SDL_SetTextInputRect for uikit/iOS.

It sets up notification handlers to respond to changes in the display of the keyboard.  These handlers then change the frame of the view so it is moved out of the way of the keyboard as per SetTextInputRect.
2013-11-11 20:51:19 -08:00
Sam Lantinga cb31a80d82 Properly handle toggling fullscreen state when another fullscreen state change is in progress. 2013-11-11 20:42:59 -08:00
Gabriel Jacobo 819148a844 [X11] Fix up compilation when EGL headers are not present. 2013-11-11 19:17:32 -03:00
Gabriel Jacobo 45a88b6ade [Android] Fixes bug 2217, better joystick axes handling on Android. 2013-11-11 10:15:35 -03:00
Sam Lantinga f0692d656f Fixed compiling with older Mac OS X SDK 2013-11-11 03:29:11 -08:00
Sam Lantinga 2384ad5b9e Fixed compiling with ISO C90 2013-11-11 03:12:50 -08:00
Sam Lantinga 2ceeb74e25 Don't minimize by default when in fullscreen desktop mode.
This fixes behavior with the new Mac OS X fullscreen space code, as well as improve behavior on Linux desktops.
The default for normal fullscreen mode is still to minimize because we're likely doing a mode switch and don't want to stick around as a borderless window in the background.
2013-11-11 03:02:42 -08:00
Sam Lantinga 4c1322f693 Added support for new style fullscreen transitions on Mac OS X 2013-11-11 02:53:00 -08:00
Sam Lantinga 6ec3e69045 Fixed whitespace style 2013-11-11 01:59:40 -08:00
Sam Lantinga 77a0d3fe2a Toggling fullscreen now takes fullscreen flags 2013-11-11 01:59:20 -08:00
Sam Lantinga 893afbaf3b Fixed pool memory leak 2013-11-10 19:19:44 -08:00
Sam Lantinga b30e396ba1 Fixed bug 1965 - Mac: dead code for supporting OS 10.4
Alex Szpakowski

The new patch removes all the truly obsolete code I could find. I tested on OS 10.8 and OS 10.5.
2013-11-10 17:56:07 -08:00
Sam Lantinga 5821466c05 Fixed bug 2176 - SDL_CreateWindow(w=INT_MAX, h=INT_MAX) causes program to hang
Catch exceptions generated when trying to create a Cocoa window.
2013-11-10 17:40:35 -08:00
Gabriel Jacobo 15a3bbcbd9 [X11] Ignore both NotifyGrab and NotifyUngrab modes in FocusIn/FocusOut events 2013-11-10 20:38:50 -03:00
Gabriel Jacobo d21640e92a Fixes bugs #2213 and #2214, improves the Android joystick code button handling 2013-11-10 20:13:27 -03:00
Sam Lantinga 9228c84576 Fixed issue with dead key press/release events being filtered out. 2013-11-10 14:48:44 -08:00
Sam Lantinga 0d39d09076 Hopefully fixed focus problems when handling a global hotkey on X11.
See this thread for details:
https://bugzilla.mozilla.org/show_bug.cgi?id=578265
2013-11-10 14:33:01 -08:00
Sam Lantinga e19f15ddd5 Fixed bug 2067 - Window size limit calculation issue when exiting fullscreen on Windows
Also fixed minimize and maximize state detection for Windows.
2013-11-10 14:10:00 -08:00
Philipp Wiesemann aa3379802b Added a new unused key code from Android 4.4 (API 19). 2013-11-10 14:50:37 +01:00
Philipp Wiesemann 0ab7624cde Changed function to return -1 through SDL_Error() instead of plain -1. 2013-11-10 14:47:05 +01:00
Philipp Wiesemann 82b3e7d229 Changed function to be static.
The function keycode_to_SDL() is only used in this file.
2013-11-10 14:44:50 +01:00
Philipp Wiesemann 6e3558cf99 Removed unused local variable to fix warning. 2013-11-10 14:42:41 +01:00
Philipp Wiesemann 3f2e942fa0 Fixed implicit function declarations by including the missing header. 2013-11-10 14:39:38 +01:00
Philipp Wiesemann bd1e1a93f2 Corrected source comment. 2013-11-10 14:36:41 +01:00
Sam Lantinga 247313174a Updated notes about building with the Windows 8 SDK: Get the DirectX SDK. 2013-11-09 01:15:17 -08:00
Sam Lantinga 33cf925c15 Fixed signed/unsigned warning 2013-11-09 01:08:21 -08:00
Sam Lantinga 550676d08d Fixed signed/unsigned warning 2013-11-09 00:56:05 -08:00
Sam Lantinga 976c876924 Fixed bug 2172 - Window loses maximized state when activated
I still haven't figured out why my application is being minimized when I try to raise, it but my previous workaround is causing issues.

For now the correct way to raise and/or restore the window is as follows:

	if ( !(SDL_GetWindowFlags( window ) & SDL_WINDOW_MINIMIZED) )
	{
		SDL_RaiseWindow( window );
	}
	if ( SDL_GetWindowFlags( window ) & SDL_WINDOW_MINIMIZED )
	{
		SDL_RestoreWindow( window );
	}

I will investigate the window state change rules more fully in the future.

CR: Alfred Reynolds
2013-11-08 14:05:23 -08:00
Sam Lantinga 7c7a9b7f89 Added a Linux game controller mapping for the Valve Streaming Gamepad 2013-11-08 14:05:19 -08:00
Sam Lantinga 3523b409bc Made helper window creation depend on initializing the Haptics or Joystick subsystems. 2013-11-08 14:05:15 -08:00
Sam Lantinga faebe94c56 Mac: Fix a crash with SDL_MAC_NO_SANDBOX.
When we get a kCGEventTapDisabledByTimeout or
kCGEventTapDisabledByUserInput, the event tap would perform an invalid
memory access. void pointers are so fun.

This code only runs if you explicitly build with SDL_MAC_NO_SANDBOX.
2013-11-08 14:05:08 -08:00
Sam Lantinga e3e24bded7 Make sure the joystick count is correct when the added and removed events are dispatched, in case someone is watching for them with an event filter. 2013-11-08 14:04:59 -08:00
Sam Lantinga 621c7f8f1f Added SDL_HINT_CTRL_CLICK_EMULATE_RIGHT_CLICK hint which controls whether ctrl+click should emulate a right click on OSX. 2013-11-08 14:04:51 -08:00
Sam Lantinga 493fadd5c1 Fixed spot where SDL was assuming that two displays having the same origin means they're the same display. Changed it to check for the same extents instead.
(Sam actually wrote this, I'm just reviewing and checking it in.)
2013-11-08 14:04:35 -08:00
Sam Lantinga 95c67ed9a7 Fixed bug 2219 - BMP loader do not handle big BITMAPINFOHEADER structure
Patrice Mandin

I encountered a problem trying to load a 8-bit paletted BMP file using SDL. This file was generated using GIMP 2.8. It has a big BITMAPINFOHEADER (0x6c bytes for biSize field), and thus the palette is incorrectly setup.
2013-11-07 19:15:58 -08:00
Sam Lantinga 48e44f7fcb Fixed Windows compile error 2013-11-06 23:59:24 -08:00
Sam Lantinga 3b050fc953 Horizontal wheel support in windows
Lorenzo Pistone

this patch adds support for the horizontal wheel in Windows. It is shamelessly copied off the vertical wheel code, but I guess that that is a value added in consistency.
2013-11-06 23:35:08 -08:00
Gabriel Jacobo 22770a8f40 [Android] Fixes Bug 2041 - can't get SDL_QUIT event...
Thanks to Denis Bernard!

Also, changed the Android manifest so the app doesn't quit with orientation
changes, and made testgles.c exit properly on Android.
2013-11-06 11:23:24 -03:00
Gabriel Jacobo e27248c27e Fixes Bug 1944 - Linux events, joysticks having only hat are not read 2013-11-06 09:48:45 -03:00
Sam Lantinga 1c9cc8c9b7 Fixed performance regression caused by the fix for bug 2158 2013-11-05 21:01:25 -08:00
Gabriel Jacobo 0b7c69fe12 Adds Joystick support for Android
This bumps the build SDK level to 12 (up from 10). Runtime requirements remain
the same (at API level < 12 joystick support is disabled).

Also enables building SDL for armv7 and x86.
2013-11-05 20:07:39 -03:00
David Ludwig 749117acd9 WinRT: added experimental OpenGL ES 2.0 support
A port of the ANGLE library (OpenGL ES 2.0 for Direct3D) to WinRT, via https://github.com/stammen/angleproject, is used as a base.

To enable, clone 'angleproject' into the directory one above where SDL/WinRT is, open the file SDL/include/SDL_config_winrt.h, and uncomment the #defines that begin with 'SDL_VIDEO_OPENGL'.  From there, apps can create an OpenGL capable SDL_Window via the flag, SDL_WINDOW_OPENGL, and an OpenGL ES 2 context via SDL_GL_CreateContext.  The Direct3D 11.1 renderer cannot be used alongside SDL_WINDOW_OPENGL.  Only Windows 8/8.1 is supported for now.  Shaders may need to be precompiled, in some (all?) cases.
2013-11-04 19:54:29 -05:00
Sam Lantinga 517886a7f1 Fixed bug 2205 - SDL_GetAudioDeviceName returns default-device name on invalid index for default-device only drivers
norfanin

The audio_enumerateAndNameAudioDevicesNegativeTests test in testautomation_audio.c reports a failure for SDL_GetAudioDeviceName when called on a driver that has only the default device. SDL_GetNumAudioDevices reports 1, but SDL_GetAudioDeviceName does not check if the index passed by the caller is in that range in this case. For positive numbers anyway.

This can be reproduced with the dummy driver on Windows and Linux.
2013-11-03 11:13:06 -08:00
Sam Lantinga f2224e1fc7 Fixed bug 1990 - focus/keyboard events not generated correctly for multiple windows
Mai Lavelle

I've recently tried to create multiple windows and process key events for them, and found that key events weren't being generated for most of the windows. After some investigating I've observed the following effects. All but the most recently created window experience these effects...

- a focus lost event is generated immediately after the focus gained event, even tho window still has focus
- key events report window id 0 rather than the id of the window which has focus, SDL thinks no window has focus?
- giving focus to a non SDL window and then selecting an SDL window causes events to be generated as expected, but only until focus changes again

Focus change events are queued and delayed (200 ticks) before they are dispatched.  The problem occurs when a focus out and focus in event are received on the same tick.  When these delayed events are dispatched they will be sent in the order determined by the window list rather than the order in which they are received.

The focus out dispatch is implemented by calling SDL_SetKeyboardFocus(NULL).  This will remove focus from any window, regardless of whether it is the one originally targeted by the X11 event.

Since SDL_SetKeyboardFocus() will always dispatch a focus lost event as needed, the easiest solution is simply to only call SDL_SetKeyboardFocus(NULL) when SDL_GetKeyboardFocus() matches the target window.
2013-11-03 09:55:27 -08:00
Philipp Wiesemann cd37485e3c Changed parameter name for gesture template save functions from "src" to "dst". 2013-11-02 12:07:21 +01:00
Philipp Wiesemann 95bbf5f443 Removed unreachable return statement in gesture source. 2013-11-02 11:51:23 +01:00
Philipp Wiesemann 4e270de15d Changed function to return -1 through SDL_Error() instead of plain -1. 2013-11-02 11:46:43 +01:00
Philipp Wiesemann 0f8d9995fe Corrected typo in source comment. 2013-11-02 11:42:00 +01:00
David Ludwig 7cc0951637 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY 2013-11-01 22:54:39 -04:00
Gabriel Jacobo e651ab12b6 Fixes Bug #2191,incorrect test for egl_context validity
Thanks David Binderman!
2013-10-31 10:02:21 -03:00
Ryan C. Gordon 804e5799ad Fixed common test usage string (was "hidpi", should be "highdpi"). 2013-10-30 16:39:35 -04:00
Ryan C. Gordon d36c7363dd Updated GL version tests for Mac OS X 10.9 ("Mavericks").
They changed the name of their GL 3.2 enum, added the GL 4.1 core profile.
2013-10-28 22:43:39 -04:00
David Ludwig ea12ff9faf WinRT: added a comment regarding the lack of SHGetFolderPath on WinRT 2013-10-28 15:52:04 -04:00
David Ludwig 3236fc3a9f WinRT: implemented SDL_GetBasePath and SDL_GetPrefPath 2013-10-28 15:41:22 -04:00
David Ludwig 1704af5b02 WinRT: build fixes, post SDL 2.0.1 update 2013-10-27 23:03:11 -04:00
David Ludwig 69c5d21d7d WinRT: merged with SDL 2.0.1 codebase 2013-10-27 21:26:46 -04:00
David Ludwig e64e3d8c27 WinRT: fixed two bugs regarding mouse events
The first bug had mouse motion events not getting sent out on non-touch devices, if and when a mouse button wasn't pressed.

The second bug caused virtual mouse motion events to get sent out-of-order on touch devices: the motion event would get sent after the touch occurred, rather than before.
2013-10-27 14:31:57 -04:00
David Ludwig 62c781eaff WinRT: made the Direct3D 11.x 'Debug Layer' be enable-able in any app via a hint
To enable the Debug Layer, set the hint, SDL_HINT_RENDER_DIRECT3D11_DEBUG to '1'.

The Debug Layer will be turned off by default, both in Release and Debug builds (of SDL).
2013-10-25 20:31:43 -04:00
Ryan C. Gordon 609b58e441 Fixed buffer overflow. 2013-10-24 00:00:10 -04:00
Ryan C. Gordon 72de99aed3 Initialize MEMORYSTATUSEX size before GlobalMemoryStatusEx() (thanks, Justin!).
Fixes Bugzilla #2177.
2013-10-23 19:52:14 -04:00
Pierre-Loup A. Griffais e0771482f6 Fix regression causing crashes when running without a window manager. 2013-10-23 13:43:17 -07:00
Ryan C. Gordon 965a0da901 Moved a SDL_SetError() call elsewhere to avoid triggering it needlessly.
Otherwise, the XInput path would always trigger it in a harmless manner.
2013-10-23 15:54:12 -04:00
Ryan C. Gordon 28aa076c8b SDL_GetPrefPath() now uses the organization on all platforms.
Even if that's not the general convention for a given platform.
2013-10-23 00:58:20 -04:00
Sam Lantinga 298d3d627a Fixed duplicate const warning 2013-10-22 21:54:52 -07:00
Sam Lantinga 2348e426c7 Fixed whitespace 2013-10-21 22:08:56 -07:00
Sam Lantinga bcf5472d16 Fixed bug 2073 - Mac: window moves unexpectedly when exiting SDL_WINDOW_FULLSCREEN_DESKTOP mode
Alex Szpakowski

In Mac OS X, when SDL_SetWindowFullscreen(window, 0) is called on a window which was in SDL_WINDOW_FULLSCREEN_DESKTOP mode, its original size is restored but its position is moved to the bottom of the screen.

I tracked down the issue to these two lines: http://hg.libsdl.org/SDL/file/fdd5cc9e9f90/src/video/cocoa/SDL_cocoawindow.m#l1034

I believe [nswindow setFrameOrigin:rect.origin] implicitly calls [nswindow constrainFrameRect:rect toScreen:screen], which will attempt to constrain the window to the screen, but at that point the window size is still full-screen rather than the restored window size, so the constrainFrameRect function operates on the wrong window size.

https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/constrainFrameRect:toScreen:

I resolved the issue by swapping the order of the function calls, like so:
[nswindow setContentSize:rect.size];
[nswindow setFrameOrigin:rect.origin];
2013-10-21 02:37:03 -07:00
Sam Lantinga b8b9bfbe5b Fixed some warnings building for 64-bit Windows 2013-10-21 01:16:16 -07:00
Sam Lantinga 11d38d696e 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 80930559a3 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 deb8086b08 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 360c3d853a Better cleanup if OpenGL initialization fails 2013-10-21 00:15:24 -07:00
Sam Lantinga a503dabe01 Fixed a crash initializing Android touch IDs 2013-10-20 23:23:25 -07:00
Sam Lantinga f8c11bb955 Fixed the status bar visibility in iOS 7 2013-10-20 23:05:53 -07:00
Sam Lantinga 85c2e2367c Fixed Y axis inversion on iOS; positive is up, negative is down. 2013-10-20 22:23:09 -07:00
Sam Lantinga 08fa8da77c 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/5486e579872e / 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 4ca34ad4a4 Prevent conflicts when linking both SDL2 and SDL2_gfx 2013-10-20 21:34:38 -07:00
Sam Lantinga aa86e05d21 Fixed windows compile 2013-10-20 20:49:36 -07:00
Sam Lantinga f5fa492e26 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
Ryan C. Gordon d710399671 Fix some edge cases in XInput haptic timing. 2013-10-20 23:38:19 -04:00
Ryan C. Gordon dddb878761 Disable Win32 thread naming again. See Bugzilla #2089. 2013-10-20 23:08:45 -04:00
Ryan C. Gordon 0e699eb5bb Added SDL_GL_FRAMEBUFFER_SRGB_CAPABLE (thanks, David!).
Fixes Bugzilla #1985.
2013-10-20 21:18:05 -04:00
Ryan C. Gordon d1bde399af Backed out changeset 737771c47c6f, done testing Buildbot changes. 2013-10-20 20:24:00 -04:00
Ryan C. Gordon df3680846b Intentionally breaking Windows and Raspberry Pi builds to test Buildbot change. 2013-10-20 20:02:02 -04:00
Ryan C. Gordon f28c7fe8a5 Backed out hg changeset add2dbe99fe2. REFGUID is apparently a const type. 2013-10-20 16:03:11 -04:00
Ryan C. Gordon c521ae84bc Patched to compile on non-C99 Microsoft compiler. 2013-10-20 16:02:24 -04:00
Ryan C. Gordon a614f18666 Patched to compile on Windows. 2013-10-20 16:01:10 -04:00
Ryan C. Gordon b285b60092 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 6e1169ddc2 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 54dce3f53a Don't bother calling SDL_SYS_HapticEffectType() at all for XInput devices. 2013-10-20 15:45:48 -04:00
Ryan C. Gordon 5e74299a83 Fix adding of XInput devices (thanks, Mitchell!)
Partially fixes Bugzilla #2126.
2013-10-20 15:40:20 -04:00
Sam Lantinga ade13fd741 It's okay to quit things more than once. 2013-10-20 10:39:26 -07:00
Sam Lantinga 20f5167d27 Use vertex arrays for drawing points in addition to lines 2013-10-20 10:35:51 -07:00
Sam Lantinga 82b8e6df87 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 a25b51923a Fixed compiling with the new X11 symbol wrapping 2013-10-20 09:58:37 -07:00
Stefanos Apostolopoulos 6a3478c235 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 e343273abb 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 b4a00144fb Fixed the XInput2 X11 symbols. 2013-10-18 10:56:45 -04:00
Sam Lantinga 379c0054dc 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 a329c7f1c9 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 7ad441a37c 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 3f8df1097c Fixed 1598 - Mingwin build fails on src/audio/xaudio2/SDL_xaudio2.c 2013-10-17 23:15:27 -07:00
Sam Lantinga 888d807a71 Removed redundant #ifdef 2013-10-17 23:05:40 -07:00
Sam Lantinga 12ca3ce3fa 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 a2bd897064 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 95dc9940a2 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 14e13e13c4 Fixed compiler warning if dynamic X11 loading isn't enabled. 2013-10-17 17:38:55 -07:00
Sam Lantinga 7db31223e6 Fixed using the wrong variable when reporting a missing SDL scancode mapping. 2013-10-17 17:37:23 -07:00
Sam Lantinga 2e6b4b960d Fixed compiling on Mac OS X, added a system RAM test 2013-10-17 11:56:33 -07:00
Sam Lantinga 852004a22a The _SC_PHYS_PAGES method of calculating RAM works on Linux. 2013-10-17 11:32:14 -07:00
Sam Lantinga 8b79cbadef Added an API to get the amount of system RAM 2013-10-17 11:32:56 -07:00