Commit Graph

881 Commits (db1dd7560e29e5017d8a1309ca16fdeade7560b8)

Author SHA1 Message Date
Sam Lantinga 441f7d8d63 Fixed Mac PS4 controller entry, added Linux OUYA controller entry 2014-02-14 11:38:59 -08:00
Sam Lantinga 268071d16f Added the new function at the end so we don't break the ABI 2014-02-13 11:08:12 -08:00
Sam Lantinga baf2dd4c7e Back out changelist 1951976 2014-02-13 11:05:34 -08:00
Sam Lantinga f5d1559b51 Back out changelist 2026006 2014-02-13 11:05:32 -08:00
Sam Lantinga c52c91056b Added SDL_DXGIGetOutputInfo which returns the adapter and output indices that are used to create DX10 and DX11 devices and swap chains on a particular display.
CR: SamL
2014-02-13 11:05:30 -08:00
Sam Lantinga e34da6801f Fixed lost mouse button when in relative mouse warp mode and you click on the title bar, entering a modal move/resize loop.
Testing:
* Set the SDL_HINT_MOUSE_RELATIVE_MODE_WARP hint true, run testsprite2, press Ctrl-R to enter relative mode, alt tab away from the window, then click on the title bar of the window. Didn't get the mouse button release before, and we do now.

CR: Yahn + Alfred
2014-02-13 11:05:28 -08:00
Sam Lantinga 567b5ba8e9 As part of Jorgen's code review of this function I added a call to LoadLibrary so the refcounts would be consistent between Windows and Posix. Then I forgot to include the check that the thing was actually loaded and caused it to be loaded all the time. Oops.
CR: AaronL
2014-02-13 11:05:26 -08:00
Sam Lantinga 1fa4939a38 Added SDL_GetLoadedModule to do the equivalent of GetModuleHandle/dlload(NOLOAD)
CR: Jorgen
2014-02-13 11:05:24 -08:00
Sam Lantinga 076a14b263 Fixed crash if render target textures are used while the device is lost 2014-02-10 13:40:02 -08:00
Sam Lantinga ae05f178c2 Recreate render target textures when the D3D device is being reset, and notify the application using the SDL_RENDER_TARGETS_RESET event when this happens. 2014-02-10 10:02:51 -08:00
Sam Lantinga 9f2509da79 Exposed the font character size and SDLTest_DrawCharacter() to make it easier to do custom debug text layout 2014-02-10 10:02:42 -08:00
Sam Lantinga a396841f8d Fixed bug where a window created fullscreen and hidden would get activated and "shown" but never actually be visible.
This is the case with the Steam In-Home Streaming client.
2014-02-10 10:02:18 -08:00
Ryan C. Gordon f38c1f05f5 Fixed DualShock 4 controller config on Mac OS X. 2014-02-10 12:47:26 -05:00
Sam Lantinga 853334afed Updated SDL to version 2.0.2 2014-02-09 03:09:56 -08:00
Sam Lantinga 8cabd44f36 Fixed the OUYA controller mapping on Windows 2014-02-09 03:09:04 -08:00
Sam Lantinga c8c3911e0d Added Windows entry for the bluetooth OUYA controller 2014-02-09 02:42:59 -08:00
Sam Lantinga 3ab3ea642d Fixed bug 2385 - error: unknown type name 'IDirect3DDevice9'
Sandu Liviu Catalin

I'm unable to compile the latest SDL (directly from the repository) even though I disabled every DirectX option since I don't need DirectX.

I allways het these errors:
D:\DevLibs\SDL\src\render\direct3d\SDL_render_d3d.c:1897:1: error: unknown type name 'IDirect3DDevice9'
D:\DevLibs\SDL\src\render\direct3d\SDL_render_d3d.c:1898:25: error: unknown type name 'SDL_Renderer'
2014-02-09 01:56:41 -08:00
Sam Lantinga b331ada815 Fixed bug 2354 - [ES 2.0] SDL_RenderClear clears render target with wrong color
ny00

SDL_RenderClear clears a render target with the wrong color, if the opengles2 renderer driver is used and the target texture's format is SDL_PIXELFORMAT_ARGB8888.

The bug is *not* reproduced if SDL_PIXELFORMAT_ABGR8888 is used as the texture format (the first from the renderer's list).
It is further not reproduced using any of the following renderer drivers: opengl, opengles (apparently powered by Gallium3D), software.
Finally, the correct color can be drawn using SDL_RenderFillRect (instead of SDL_RenderClear).

A few details about the current setup:
- OS: Ubuntu 12.04 for x86_64
- GPU: GeForce GTX 460
- GPU driver version: 331.20-0ubuntu1~xedgers~precise1 (from the xorg-edgers PPA)


---

Seth Williams

Sam,

It appears that the clear just needs to take the render target format into consideration.

Seth.
2014-02-09 01:49:01 -08:00
Edward Rudd fff7503b6a ignore hot plugs in mac haptic layer IF hap tics hasn't been initialized. 2014-02-07 09:35:13 -05:00
Ryan C. Gordon c2f6ab0cc1 Added DualShock 4 game controller config for Windows, Mac, and Linux. 2014-02-06 21:28:11 -05:00
Ryan C. Gordon 7033e597b5 Fixed crash on Windows if haptic isn't initialized when controllers are added. 2014-02-06 21:26:41 -05:00
Ryan C. Gordon 56979749e9 Fixed a typo. 2014-02-06 10:00:45 -05:00
Edward Rudd a09548eb00 Fix device counting in HapticMouse and JoystickOpen routines. 0 is the first item in the list not the last 2014-02-06 09:35:44 -05:00
Edward Rudd f3e6a0a71b fix indentation and spaces 2014-02-06 09:11:05 -05:00
Ryan C. Gordon e42d46b463 Wired up haptic hotplugging for Windows DirectInput/XInput code. 2014-02-06 07:37:20 -05:00
Ryan C. Gordon 9cf8c49c39 Fixed memory leak. 2014-02-05 20:07:25 -05:00
Ryan C. Gordon ccbf6943e7 Make SDL_SYS_HapticMouse() count device indexes like HapticByDevIndex(). 2014-02-05 18:36:40 -05:00
Ryan C. Gordon 7f94268805 Cleanup some vi footer comments, rename new PRIVATE_* funcs to MacHaptic_*. 2014-02-05 01:02:09 -05:00
Edward Rudd b352698d99 Implement new backend methods for haptic and hot plugging on OS X 2014-02-04 18:17:16 -05:00
Edward Rudd 4da8829812 implement new backend method for Haptics in dummy driver 2014-02-04 16:50:34 -05:00
Edward Rudd 5fb0be3079 Rework haptic backend to properly support hotplugging of haptic devices.
* currently only linux backend updated.
2014-02-04 15:44:09 -05:00
Brandon Schaefer 25fcc1959e * Remove android based workaround, it is handled in SDL_EGL_GetProcAddress. 2014-02-04 12:28:35 -08:00
Ryan C. Gordon c2b5da9733 Added SDL_GetAssertionHandler() and SDL_GetDefaultAssertionHandler(). 2014-02-04 11:38:40 -05:00
Ryan C. Gordon e719158cb4 Fixed some compiler warnings from the latest Clang, cleaned up some things. 2014-02-03 14:45:38 -05:00
Ryan C. Gordon bd01a9c914 Unload Wayland libs if memory allocation fails during init. 2014-02-03 11:53:21 -05:00
Ryan C. Gordon 89fd0faf5e Hooked up dynamic loading for Mir. 2014-02-03 11:52:54 -05:00
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
Sam Lantinga 6435a82d08 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 4b603abfd7 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 fea2699c25 Fixed the windows message debug output so it works without HAVE_LIBC 2013-10-14 08:56:50 -07:00
Sam Lantinga 06cab8575e Added support for SDL_PIXELFORMAT_UYVY surfaces on Mac OS X 2013-10-14 08:56:37 -07:00
Sam Lantinga 8ec3ba3829 Fixed accumulating mouse wheel motion for the Microsoft Wireless Mouse 5000 2013-10-13 19:59:40 -07:00
Sam Lantinga a7b2db05cd Added an assert to catch init/quit call mismatch that might bite people. 2013-10-13 19:48:45 -07:00
Gabriel Jacobo e9d2133934 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 074a1c4c63 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 a7e1fdddea Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
Sam Lantinga 15682c0c5f 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? 2568a367c8 Mac: Better handling when someone else is the app delegate. 2013-10-07 16:01:40 -07:00
Ryan C. Gordon f7e0a9b2b0 Patched to compile in C90 mode. 2013-10-10 02:21:41 -04:00
Gabriel Jacobo 89131435f8 Adds gl_profile_mask to test framework, uses it in testgles 2013-10-10 00:49:57 -03:00
Gabriel Jacobo d0fddfab84 Fixes Bug 2134 - [Android] Black screen after resume (sometimes) 2013-10-10 00:30:03 -03:00
J?rgen P. Tjern? c455f7291c 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 cca094225a 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 11c45c4ede Removed unused variables (thanks Joseph!) 2013-10-06 13:50:36 -07:00
Sam Lantinga 8f46bcfd6d Check for NULL joystick in SDL_JoystickGetGUID() 2013-10-06 13:49:23 -07:00
Sam Lantinga 90a219a375 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 529664278f 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 0db36f51aa 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 36b759174f Do a 32-bit compare on RGBA values. Thsi should be inlined in optimized builds. 2013-10-05 12:29:05 -07:00
Ryan C. Gordon 5607cc45c5 Avoid redundant state changes in the GLES2 renderer. 2013-10-05 00:29:57 -04:00
Ryan C. Gordon 500e4f6f9a Removed "u_colorTable" uniform from the GLES2 renderer. It's not used anywhere. 2013-10-04 11:25:14 -04:00
Gabriel Jacobo 9c489c7c0d Fix EGL/OpenGL ES paths 2013-10-04 08:23:37 -03:00
Sam Lantinga 509898460c Added optional error checking for OpenGL ES 2.0 in the same style as the OpenGL renderer.
You can enable it like this: SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
2013-10-03 20:48:52 -07:00
Sam Lantinga e5ef978e13 Fixed a potential double-free bug if glGenTextures() failed. 2013-10-03 20:42:43 -07:00
Gabriel Jacobo b39a4daf04 SDL_TEXTINPUT support for EVDEV 2013-10-03 10:28:10 -03:00
Sam Lantinga 1f21484bdd Fixed const/non-const warning 2013-10-03 03:31:05 -07:00
David Ludwig 6004b764d8 WinRT: added missing files 2013-09-22 23:17:25 -04:00
David Ludwig 58dd086487 WinRT: unified the two, public, app-init functions
This function, SDL_WinRTRunApp, can be used to help launch either XAML or non-XAML/Direct3D-only based apps.
2013-09-22 12:26:53 -04:00
David Ludwig aeaa05054b WinRT: ugh, at least one file in an app's project seems to require C++/CX compilation.
Assuming this is true, that file might as well be the one that contains WinMain.
2013-09-16 22:43:12 -04:00
David Ludwig efb3cdca19 WinRT: renamed SDL_winrt_main.cpp to indicate that it should only be used in non-XAML apps
This can break builds of existing SDL/WinRT apps.  To fix, remove the reference to SDL_winrt_main.cpp, then add a reference to the renamed file, SDL_winrt_main_NonXAML.cpp.  If you get a build error about a missing .winmd file, enable the /ZW compiler flag for that one file (at minimum).
2013-09-16 22:27:30 -04:00
David Ludwig fff83d8e52 WinRT: reduced the size of SDL_winrt_main.cpp by a little bit 2013-09-16 21:09:58 -04:00
David Ludwig 0022dbf261 WinRT: made SDL_GetWindowWMInfo return window data in a slightly easier-to-use format
Having the window pointer available as a WinRT IInspectable should make it a bit easier to use in conjunction with WRL-based weak references.
2013-09-16 11:02:18 -04:00
David Ludwig fa45a9c953 WinRT: fixed a line-rendering bug in the D3D 11.1 backend 2013-09-16 00:31:01 -04:00
David Ludwig c72a4fa311 WinRT: made SDL_winrt_main.cpp not have to be compiled as C++/CX (via the /ZW compiler flag)
This file can still be compiled as C++/CX, however that is now optional/not-required.
2013-09-15 23:53:51 -04:00
David Ludwig 34722465d1 WinRT: code cleanup: attempted to make it more clear what code is specific to what app type (plain Direct3D or XAML) 2013-09-06 21:13:15 -04:00
David Ludwig de8d9dbb93 WinRT: minor code cleanup regarding events
Some event handling functions got sorted in a somewhat consistent manner, and
in some cases, were also segregated a bit from app-lifecycle code.
2013-09-06 21:00:52 -04:00
David Ludwig 9de76eb526 WinRT: removed chunks of C++ hack code from SDL_xaudio2.c 2013-09-06 19:23:42 -04:00
David Ludwig fff780818d WinRT: made SDL_xaudio2.c compile as C code when building for WinRT
XAudio2 2.8's header file, xaudio2.h, doesn't compile in plain C code for WinRT
apps, not automatically at least.  Initially, this file was adapted to compile
as C++, however these changes are now deprecated in favor of some preprocessor
based hacks that should get xaudio2.h to compile (while making sure XAudio2
still works).
2013-09-06 19:07:15 -04:00
David Ludwig ac6e5a69ce WinRT: minor code cleanup in SDL_xaudio2.c 2013-09-04 20:20:36 -04:00
David Ludwig 8fc04cc76e WinRT: renamed a mouse-related header file for naming-consistency's sake 2013-09-02 15:29:46 -04:00
David Ludwig 7e06b806ac WinRT: misc code cleanups regarding touch and mouse events, and also SDL-internal globals 2013-09-02 15:23:33 -04:00
David Ludwig a94e41854a WinRT: added touch input event support for Windows 8/RT devices 2013-09-01 10:20:17 -04:00
David Ludwig dbdc4b84ec WinRT: added touch-event support for Windows Phone devices
Support for touch events in Windows 8/RT is pending on further R+D.
2013-08-29 10:32:16 -04:00
David Ludwig 1d5082d815 WinRT: corrected SDL_MOUSE* coordinates in non-Portrait modes
Thanks to Pierre-Yves Gueniffey for proper pointer geometry transform code!
2013-08-28 16:51:07 -04:00
David Ludwig 13c87e712b WinRT: made simulated-mouse (via touch) input work on Windows Phone in Portrait mode
Proper SDL_MOUSE* event support for non-Portrait orientations in Windows Phone is pending.
2013-08-28 16:14:27 -04:00
David Ludwig 31235b4b99 WinRT: made rendering work with orientation changes on Windows Phone
Pointer event geometry still needs to be adjusted on Windows Phone, to note.
2013-08-28 15:27:01 -04:00
David Ludwig 91b039027f WinRT: removed a comment regarding a dealt-with TODO 2013-08-28 12:45:43 -04:00
David Ludwig 8e3886a279 WinRT: rendering orientation fixes for Windows Phone, part 1
This change should allow apps to render correctly in Portrait mode, at minimum,

Support for orientation changes is pending.

Thanks to Pierre-Yves for assistance!
2013-08-28 12:38:30 -04:00
David Ludwig 44755f8a6a WinRT: fixed a potential memory-related crash in SDL_Renderer on Windows Phone 2013-08-28 11:46:02 -04:00
David Ludwig 2cafee9de1 WinRT: experimental and preliminary support for XAML-based overlays on Windows 8/RT
The XAML support here is still rudimentary.  Bugs do exist.  You've been warned.

XAML support in Windows Phone 8 is not yet available (in SDL/WinRT).
2013-08-27 21:21:09 -04:00
David Ludwig 86ea4c4edf WinRT: made all WinRT-related TODO comments use the same prefix, "TODO, WinRT" 2013-08-27 13:03:43 -04:00
David Ludwig 17ca1d00b5 WinRT: code cleanup wrt. display mode(s) 2013-08-27 12:56:49 -04:00
David Ludwig f860141aa6 WinRT: renamed "windowsrt" directories to "winrt" 2013-08-27 12:33:36 -04:00
David Ludwig fa229f3790 WinRT: fixed a crash that occurred on device rotation (oops!) 2013-08-27 12:22:02 -04:00
David Ludwig 1e78c4a5d1 WinRT: more "Windows RT" to "WinRT" renaming 2013-08-27 12:20:35 -04:00
David Ludwig 3070086431 WinRT: took out a deprecated TODO-comment 2013-08-27 12:16:42 -04:00
David Ludwig 6dc2a410eb WinRT: moved the WinRT SDL_VideoDevice out of SDL_WinRTApp
This was done to help pave the way for XAML support.
2013-08-27 12:13:45 -04:00
David Ludwig 253b9aae89 WinRT: moved the pointer to the global SDL_Window to a separate variable
This is a cleanup that is being done to help with WIP XAML support.  It may be reverted in the future.
2013-08-27 11:51:17 -04:00
David Ludwig 7be2ad71c9 WinRT: renamed SDL_SYSWM_WINDOWSRT to SDL_SYSWM_WINRT
This is part of an overall effort to use the name, "WinRT", rather than "WindowsRT" (or "Windows RT"), as the shorthand name often seems to mean something different than the longhand name.  (WinRT is an API, Windows RT is a product name)
2013-08-27 11:44:43 -04:00
David Ludwig 3e83fd784c WinRT: misc code cleanups 2013-08-27 11:39:44 -04:00
David Ludwig f8e80edf09 WinRT: removed more hack-code that attempted to help have non-standard window sizes
"Non-standard" is defined here as any window size that differs from that provided by WinRT's CoreWindow.
2013-08-27 11:00:52 -04:00
David Ludwig 80abfc4d60 WinRT: minor function and variable name cleanup 2013-08-27 10:57:55 -04:00
David Ludwig 065b2cf470 WinRT: made all SDL_Windows get sized to the WinRT-defined window size
This change removes some code that attempted to allow non-standard window sizes, the idea of which was to do display scaling, and a hackish one at that.  If display scaling is needed, use SDL_Renderer as appropriate.
2013-08-27 10:56:10 -04:00
David Ludwig 409d9b1ce7 WinRT: removed a deprecated hack regarding window resizing and Direct3D viewports 2013-08-27 09:53:58 -04:00
David Ludwig d78b26ed69 WinRT: moved most platform-specific keyboard and mouse code to shared locations 2013-08-26 17:17:53 -04:00
David Ludwig 73dfcdcfe1 WinRT: removed some old debugging code from SDL_mutexP and SDL_mutexV 2013-08-20 22:18:48 -04:00
David Ludwig dcb1689fb2 WinRT: made a note that WinRT doesn't appear to support modifying a thread's priority 2013-08-20 22:16:09 -04:00
David Ludwig 6300b3606f WinRT: made SDL_ThreadID() return the native thread ID, rather than a fake one 2013-08-20 22:04:09 -04:00
David Ludwig 90a9278f9d WinRT: made the C++11-based threading backend only try to catch exceptions that it knows it (the threading APIs) might throw, rather than all exceptions 2013-08-20 21:54:34 -04:00
David Ludwig 19a168b4b3 WinRT: file naming and placement cleanup
- moved SDL_WinRTApp.* from src/video/windowsrt/ to src/core/winrt/, and renamed them to SDL_winrtapp.* (to mimick case-sensitivity used elsewhere in SDL)
- renamed all "windowsrt" directories (in src) to "winrt", as the shorthand name is used more often (and, IMO, "WinRT" != "Windows RT", not entirely at least)
2013-08-20 21:22:32 -04:00
David Ludwig eaf26ff66a WinRT: added a stub implementation of UpdateClipRect to the D3D 11.1 renderer 2013-08-13 20:33:15 -04:00
David Ludwig 45ef345df0 WinRT: fixed a crash in some display orientation hint code 2013-08-13 20:28:48 -04:00
David Ludwig d41fdc94d6 WinRT: build fixes and additional WinRT-related integrations with SDL 2.0.0 2013-08-13 20:09:52 -04:00
David Ludwig f7049b93d5 WinRT: merged with SDL 2.0.0 codebase (aka. SDL hg rev d4ce48ff30d1) 2013-08-12 22:29:55 -04:00
Sam Lantinga 1ad936eb29 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow()
Rainer Deyke

I'm running Linux Mint 15 with the Cinnamon window manager.  SDL_DestroyWindow consistently locks up for me when the window if fullscreen.
2013-08-11 19:56:43 -07:00
Sam Lantinga 1df1e69691 Added the platform specific messagebox function to the video function list 2013-07-14 11:28:44 -07:00
Sam Lantinga 8fbd7dc735 Fixed bug 2130 - Two members of Windows WindowData not initialized
norfanin

SetupWindowData in SDL_windowswindow.c doesn't initialize two members of SDL_WindowData with NULL. This is an issue because other parts of the SDL code seem to make the assumption that this is the case. WIN_DestroyWindowFramebuffer for example uses data->mdc and data->hbm if they're not NULL.
2013-10-03 00:54:58 -07:00
Ryan C. Gordon ce45fa28e2 SDLK_DELETE should probably be SDLK_BACKSPACE on iOS.
The key on the software keyboard works like backspace, at least. Not sure
 what happens with a bluetooth keyboard here.
2013-10-02 22:18:04 -04:00
Ryan C. Gordon 958640e5d1 Get rid of glGetError() calls in GLES2 renderer.
It's not usually useful, and it causes pipeline stalls.
2013-10-02 22:16:11 -04:00
Gabriel Jacobo 57e09318dd Uses SDL_UDEV for Linux joystick hotplugging 2013-10-01 08:47:06 -03:00
Sam Lantinga 69a4351eb0 Fixed bug 2121 - GCC throws error on SDL_FORCE_INLINE when compiling with -ansi 2013-09-30 22:35:32 -07:00
Sam Lantinga 22a972a440 Fixed bug 2122 - SDL_CreateTexture allows illegal texture sizes
Lloyd Bryant

SDL_CreateTexture() is succeeding (i.e. returning a valid pointer) when the requested horizontal or vertical size of the texture exceeds the maximum allowed by the render.  This results in hard-to-understand errors showing up when later attempting to use that texture (such as with SDL_SetRenderTarget()).
2013-09-30 22:16:14 -07:00
Gabriel Jacobo 889b6bd794 Removes unused property use_egl from internal structure gl_config 2013-09-28 19:23:59 -03:00
Gabriel Jacobo c691de00c5 Fix: SDL_EVDEV_device_removed does not need UDEV 2013-09-28 19:17:27 -03:00
Sam Lantinga 202528a48f Call AddRef() on the device so it doesn't accidentally get released from underneath the caller. 2013-09-28 14:07:17 -07:00
Sam Lantinga 25f607a3c2 Make it clear we're just returning a D3D9 device, allowing for new functions to get other D3D versions 2013-09-28 14:07:14 -07:00
Sam Lantinga cf5e5a8360 Added a hint to create the D3D device in thread-safe mode: SDL_HINT_RENDER_DIRECT3D_THREADSAFE 2013-09-28 14:07:08 -07:00
Sam Lantinga 803965bcc2 Added platform specific call: SDL_RenderGetD3DDevice() 2013-09-28 14:07:05 -07:00
Sam Lantinga 9f390e7967 Moved SDL_Direct3D9GetAdapterIndex() to SDL_windowsvideo.c since it doesn't belong in the window code. 2013-09-28 14:06:59 -07:00
Sam Lantinga 89c31bb42a Implemented SDL_UpdateYUVTexture() for Direct3D 2013-09-28 14:06:55 -07:00
Sam Lantinga 17c9ff85e2 Added missing SDL_assert.h 2013-09-28 14:06:51 -07:00
Sam Lantinga 57bd514707 Added optimized YUV texture upload path with SDL_UpdateYUVTexture() 2013-09-28 14:06:47 -07:00
Sam Lantinga d0a57ea2b5 Rolled back my LoadLibrary change. The first failed call causes a dialog to pop up in Windows apps (but not console apps) and that's really bad. I'll have to deal with this in my app. 2013-09-28 14:06:39 -07:00
Sam Lantinga dfa53e7e3c SDL_LoadObject on Windows now calls LoadLibrary a second time in its EX form whenever the first load fails. This second call uses the "altered" search path for DLL dependencies, which includes searching the directory that the DLL itself lives in. 2013-09-28 14:06:31 -07:00
Sam Lantinga b6be1435c5 Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Added a reference to SDL_Direct3D9GetAdapterIndex to SDL_test_common.c so SDL will fail to compile if the new symbol isn't included properly.

CR: Jorgen
2013-09-28 14:06:20 -07:00
Gabriel Jacobo 1ccbad9603 Do not use UDEV references in EVDEV if UDEV has not been detected 2013-09-28 15:48:32 -03:00
Gabriel Jacobo 9ceed73db4 Raspberry Pi support (also unified UDEV and EVDEV support) 2013-09-28 13:28:19 -03:00
Philipp Wiesemann 90afb94ec6 Corrected name of SDL_Color field from unused to a. 2013-09-28 12:48:26 +02:00
Sam Lantinga 8b6ad7ffba Fixed bug 2101 - CWBackPixel causes weird window flickering on window resize
aBothe

I tried to experiment a bit with SDL2 and OpenGL today and noticed that something caused some weird flickering when resizing my nicely drawn SDL2/OpenGL window:
Just after resizing, the background went black and I had to let my OpenGL code redraw the contents..
However, after some hours spent with googling I found out that in OpenGL examples where this CWBackPixel flag was not used when creating X windows, there was no flickering while resizing the window.

See http://www.sbin.org/doc/Xlib/chapt_04.html @ "The Window Background" for more info.
2013-09-27 23:47:57 -07:00
Sam Lantinga b9567776d7 # User Darren Salt <devspam@moreofthesa.me.uk>
# Date 1379621782 -3600
#      Thu Sep 19 21:16:22 2013 +0100
Work around a false-positive in the X11 mouse wheel code

This false positive occurs when one particular button on my mouse is
pressed. The kernel which I'm using is patched to cause a release event to
be synthesised immediately when the mouse says that this button is pressed
because the mouse doesn't signal release until the button is next pressed.

(Also documents a false negative, observed with the horizontal scroll wheel
on the same mouse.)
2013-09-27 23:35:17 -07:00
Sam Lantinga c95761e00a Fixed bug 2100 - directfb fails to build 2013-09-27 23:29:05 -07:00
Edward Rudd 869a707612 add in High DPI support (aka Retina)
- based on J?rgen's patch with a few bug fixes
2013-09-20 13:43:00 -04:00
Sam Lantinga 0103bc0bff Default to OpenGL ES 2.0 instead of 1.0 when it's available. 2013-09-27 22:09:51 -07:00
Sam Lantinga d3d6f9ad19 Fixed syntax error in C style block comment. 2013-09-14 11:25:52 -07:00
Ryan C. Gordon bfe1b1d066 Don't incorrectly report success for negative swap intervals on Mac OS X. 2013-09-14 01:30:57 -04:00
Sam Lantinga fae4190dca Added SDL_Direct3D9GetAdapterIndex(), which returns the adapter index you would pass into CreateDevice to get your device on the right monitor in full screen mode. This fixes the default adapter in SDL_render_d3d.c, which means that tests will work fullscreen off the main monitor now.
CR: Sam
2013-09-13 17:42:46 -07:00
Sam Lantinga 49d64d52d5 Fix X11_RestoreWindow() and X11_RaiseWindow() to properly do window activation.
X11_RestoreWindow() had a call ordering problem that prevented activation, and X11_RaiseWindow() wasn't attempting activation. Windows and OS X both activate in these cases.

CR: saml
2013-09-13 17:42:38 -07:00
Sam Lantinga 67c02a282a Mac: Translate Ctrl-Left click to right click. 2013-09-13 17:42:31 -07:00
Sam Lantinga e231d5b450 Mac: Turn off momentum-based scrolling. 2013-09-13 17:41:17 -07:00
Sam Lantinga 37509cf3e3 Mac: Fix cast warning. 2013-09-13 17:40:41 -07:00
pgriffais a9166450f4 [SDL] X11+GL: Allow Visual override for GL windows.
SDL provides an SDL_VIDEO_X11_VISUALID environment variable that lets you override
window visuals, but it wasn't being checked for OpenGL windows.

CR: Sam.
2013-09-10 18:25:13 -07:00