Commit Graph

910 Commits

Author SHA1 Message Date
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
Ryan C. Gordon 83383c6527 Disable thread naming on Win64 for now.
We can't use _try/_except without the C runtime, and we can't use inline
 asm with the Win64 compiler. We'll need to move this to an .asm file or
 something later.
2013-09-07 13:47:14 -04:00
Sam Lantinga dc9ddf1f61 Fixed bug 2090 - Some joystick inputs are delayed on FreeBSD
kikuchan

Some joysticks with high sampling rate need to be read() more fast,
otherwise it delay user inputs due to internal queue.
Especially, an app that issues SDL_PollEvent() not so frequent
2013-09-06 20:54:14 -07:00
Sam Lantinga 10ffa28a28 Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time. 2013-09-06 20:45:08 -07:00
J?rgen P. Tjern? f06eeb013b Fix to buffer overrun in SDL_JoystickGetGUIDString(). 2013-09-05 15:49:57 -07:00
Sam Lantinga 4b942c5a07 Fixed bug 2076 - OpenGL doesn't work with --disable-threads
stepik-777

Thread local storage is used to store current window and current opengl context. OpenGL worked before this changeset: 7596 (45e5c263c096)
2013-09-05 07:15:26 -07:00
Sam Lantinga cefffd618f Fixed bug 2082 - SDL stdlib implementation does not force upper case for %X format specifier
norfanin

When SDL_vsnprintf handles the %x format specifier, a boolean is set to signal forced lower case. It also should be able to signal forced upper case for the %X specifier. A boolean is not sufficient anymore. The attached patch adds an enum for the three cases: lower, upper and no change.
2013-09-05 06:59:34 -07:00
Sam Lantinga 48aca0b2df Fixed bug 2084 - SDL_log xxx on Android outputs to Logcat with incorrect priority.
Pallav Nawani

This effects all SDL_Logxxx functions. On android, the debug output has a priority that is 1 higher than intended, ie, if you try SDL_LogInfo, the log has the priority of Warn instead.
2013-09-05 06:43:34 -07:00
Ryan C. Gordon b63d11ce9c The SDL_PixelFormat* passed to SDL_ConvertSurface() should be const. 2013-09-04 23:40:11 -04:00
Ryan C. Gordon 2bafbedac7 Enabled thread naming on Windows.
This is now done without compiler or C runtime support for __try/__except.

(Granted, it uses Visual Studio-style inline asm, but still...)
2013-08-31 01:36:38 -04:00
Gabriel Jacobo ace1e98a18 Fixes bug #2040, prepare SDL_GL_CONTEXT_EGL for deprecation on v2.1
SDL_GL_CONTEXT_EGL = 1 is now internally treated as profile_mask = SDL_GL_CONTEXT_PROFILE_ES
2013-08-29 15:02:32 -03:00
Gabriel Jacobo eec4710c53 Fixes bug #2074 - Thanks Sylvain!
SDL_syssem.c:159 comparison of unsigned expression >= 0 is always true
Solved by comparing unsigneds directly

SDL_systimer.c:164: warning: control may reach end of Compile
Solved by returning the default value if all else fails.

SDL_androidgl.c:41:1: warning: type specifier missing, defaults to 'int'
SDL_androidgl.c:47:1: warning: control reaches end of non-void function
Solved by adding void return type to the function implementation
2013-08-29 14:03:44 -03:00
Sam Lantinga e07d7e649c Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)). 2013-08-29 08:30:21 -07:00
Sam Lantinga 3e2930defe Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x) 2013-08-29 08:29:51 -07:00
Sam Lantinga f79fc33a39 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Sam Lantinga 1d2c7796ae Christoph Mallon: Correct indendation. 2013-08-29 08:27:25 -07:00
Sam Lantinga 7267ea8f8b Christoph Mallon: Use SDL_arraysize() 2013-08-29 08:26:55 -07:00
Sam Lantinga 9e23d17869 Christoph Mallon: Simplify assignment. 2013-08-29 08:26:24 -07:00
Sam Lantinga 67c10169ee Christoph Mallon: Report an error, if creating the directories in SDL_GetPrefPath() failed. 2013-08-29 08:25:54 -07:00
Sam Lantinga db7c92b4b4 Christoph Mallon: Remove lone /* if */ comment. 2013-08-29 08:25:24 -07:00
Sam Lantinga 321aa4ae10 Christoph Mallon: Simplify avoidance of duplicate / in SDL_GetPrefPath() 2013-08-29 08:24:43 -07:00
Ryan C. Gordon 257cef3024 Change order we enumerate Windows joysticks.
Make it so XInput devices are listed before DirectInput devices, and that the XInput
 devices are sorted by userid in ascending numeric order (so device 0 comes first).
2013-08-28 22:09:17 -04:00
Ryan C. Gordon ea4350d821 Don't corrupt XInput device state during SDL_SYS_JoystickClose(). 2013-08-28 22:07:54 -04:00
Ryan C. Gordon 2538d31140 Fix endlines for logging via OutputDebugString(). 2013-08-28 22:05:16 -04:00
Ryan C. Gordon aa65211486 Make XInput joystick names match the numbers on the device.
(And how the Haptic code already names them.)
2013-08-28 17:17:21 -04:00
Ryan C. Gordon 7949989884 Fixed comment typo. 2013-08-28 17:12:07 -04:00
Ryan C. Gordon 4b255c63f1 Reworked XInput and DirectInput joystick code.
Now multiple XInput controllers map correctly to device indexes instead of grabbing
the first available userid, and are completely separated out from DirectInput.

Also, the hardcoded limitation on number of DirectInput devices is gone. I don't
expect there to really ever be more than eight joysticks plugged into a machine, but
it was a leftover limitation for a static array we didn't actually use anymore.

Fixes Bugzilla #1984. (etc?)
2013-08-28 16:43:47 -04:00
Ryan C. Gordon c89e04694d Better XInput detection code for DirectInput device enumeration.
This code is way faster than the Wbem code, and less ugly.
2013-08-28 16:35:32 -04:00
Gabriel Jacobo ad20c801cb Fixes typo in EGL code (thanks jmcfarlane!) 2013-08-26 14:23:18 -03:00
Ryan C. Gordon 2abe45e8cb Removed obvious comment to trigger buildbot. 2013-08-25 21:28:03 -04:00
Edward Rudd 833fd30eb8 reworked GetBasePath on OS X to use Contents/Resource by default if bundled, or exedir if not bundled.
- also adds OS X specific magic for bundled apps adding an Info.plist property of name SDL_FILESYSTEM_BASE_DIR_TYPE to the following values will change the bahaviour.
* bundle -- use the bundle directory e.g. "/Applications/MyGame/Blah.app/"
* parent -- use the bundle parent directory e.g. "/Applications/MyGame/"
* resource -- use the bundle resource directory (default) e.g. "/Applications/MyGame/Blah.app/Contents/Resources/"
2013-08-25 11:24:01 -04:00
Gabriel Jacobo 64e6eeac7f Fixes "error: conflicting types for 'GLintptr'" 2013-08-25 11:48:49 -03:00
Ryan C. Gordon c9c6852f84 Minor FreeBSD code cleanup. 2013-08-24 21:15:10 -04:00
Edward Rudd e5b65e4e03 Fix #2062 Be more diligent about validating trailing "/" existence in HOME and XDG_DATA_HOME env vars 2013-08-24 09:05:18 -04:00
Ryan C. Gordon 58a558e326 Patched to compile on Solaris. 2013-08-23 23:34:23 -04:00
Ryan C. Gordon 88cd94a0eb Patched to compile on FreeBSD. 2013-08-23 21:48:40 -04:00
Ryan C. Gordon 97948aef66 Add support for some BSDs and Solaris to SDL_GetBasePath(). 2013-08-23 21:38:54 -04:00
Gabriel Jacobo f60bcf8b50 Fix warning in GL ES2 renderer 2013-08-22 17:26:22 -03:00
Ryan C. Gordon faf760d203 XAudio2/DirectSound: Use the usual Windows string convert (thanks, Norfanin!). 2013-08-22 13:32:27 -04:00
Sam Lantinga cd27a1ef05 Fixed compiling on old versions of the DirectX SDK 2013-08-21 12:12:04 -07:00
Sam Lantinga 9faefccd48 SDL
- detect that you tried to open a gamecontroller in xinput mode and failed, then re-get the mapping for the dinput variant you did open (and most likely now just fail the open)

CR: SamL
2013-08-21 10:32:04 -07:00
Sam Lantinga 05d8c2dcd2 Fix SDL xinput code to work at all when xinput has devices at high indexes but no device connected at lower index, for instance 0->disconnected, 1->wireles, 2->wired. Previously the SDL code assumed the indexes were always used up in order which is not true at all and lead to a bunch of failure cases where controllers would go unrecognized.
This entire function is kind of a mess and more complicated than needed, but I don't want to refactor it too heavily tonight.  May look at improving how the indexes are assigned more significanly later.  The way it handles not finding a valid "gamepad" type device is also super broken, it leaves in place the xinput bindings but opens the controller with dinput and ends up with completely wrong mappings, not solving that now, but fixing the bug where we'd very frequently not find a controller due to gaps in assigned player numbers should mostly avoid it.
2013-08-21 10:31:44 -07:00
Sam Lantinga 3d217ed7b5 Fixed crash if the IC isn't set up for some reason (bad X11 locale?) 2013-08-21 10:07:48 -07:00
Gabriel Jacobo 6107705a40 Fix a couple of warnings 2013-08-21 10:34:32 -03:00
Gabriel Jacobo 5f8de2b936 Patched to compile on Darwin 2013-08-21 10:27:39 -03:00
Gabriel Jacobo 29dfdd1edc More fixes for -Wdeclaration-after-statement 2013-08-21 10:13:12 -03:00
Gabriel Jacobo 2490166d2d Fixes for -Wdeclaration-after-statement 2013-08-21 10:12:16 -03:00
Gabriel Jacobo 1e49b1ed6e OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
Gabriel Jacobo 695344d163 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Ryan C. Gordon 3984c7d8e3 Actually, this should be a memcpy().
We already know the exact length we just allocated, and we plan to append
 our own null terminator to the end of the copy, so this makes more sense.
2013-08-20 23:20:32 -04:00
Ryan C. Gordon 9ff379ba67 Patched to compile on iOS. 2013-08-20 21:21:57 -04:00
Ryan C. Gordon fb7a02912a More Haiku fixes. 2013-08-20 20:39:22 -04:00
Ryan C. Gordon 24006be288 Fixed compiler warning. 2013-08-20 20:31:57 -04:00
Ryan C. Gordon ad8aa33bce More Windows fixes for filesystem code. 2013-08-20 20:29:30 -04:00
Ryan C. Gordon c9152adcb0 Patched new filesystem code to compile. 2013-08-20 20:15:15 -04:00
Ryan C. Gordon 2dd7091e50 Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Gabriel Jacobo 552b04c58a More non C89 compliant comments 2013-08-20 20:34:40 -03:00
Gabriel Jacobo 63fe3a7753 Fixes a few non C89 compliant comments 2013-08-20 19:49:24 -03:00
Ryan C. Gordon e43ff8fb59 Added some FIXMEs for later. 2013-08-20 12:43:06 -04:00
Gabriel Jacobo 0eeb76d869 Fixes bug #2037, common EGL code for Android and X11 2013-08-19 16:29:46 -03:00
Ryan C. Gordon b44267693d Fixed leaking of pixel shader object in D3D renderer (thanks, Peter!).
Fixes Bugzilla #2047.
2013-08-19 11:02:44 -04:00
Sam Lantinga c2a29aede9 Fixed Haiku build (thanks Alexander!) 2013-08-18 22:05:53 -07:00
Ryan C. Gordon 7e3b7dbcb6 Patched to compile with Visual Studio. 2013-08-17 20:46:34 -04:00
Sam Lantinga 1455a94714 Fixed Windows build 2013-08-17 17:14:15 -07:00
Sam Lantinga d7817f424b Fixed for consistency with the other platforms 2013-08-17 17:04:14 -07:00
Edward Rudd e187810eca auto init the ticks if the GetTicks and the like methods are called before SDL_Init().. This prevents annoying game bugs such as caching SDL_GetPerformanceFrequency in a static initializer 2013-08-17 18:07:29 -04:00
Sam Lantinga 6995ff18d3 Do full state initialization in D3D_Reset(), this fixes blend mode issues when resizing the window on Windows 8. 2013-08-17 09:54:30 -07:00
Sam Lantinga 9ab14aa554 Fixed windows build 2013-08-16 17:50:44 -07:00
Sam Lantinga ff77ca8d0b The keyboard text events should be sent after the key down events 2013-08-16 15:38:06 -07:00
Sam Lantinga b4b12d950e Fixed bug 1876 - SDL_TEXTINPUT only returns '?' (0x3F) in event.text.text with Khmer language input
Andreas

The issue comes down to this line on MSDN:
"TranslateMessage produces WM_CHAR messages only for keys that are mapped to ASCII characters by the keyboard driver."

"WM_KEYDOWN and WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message. WM_SYSKEYDOWN and WM_SYSKEYUP combinations produce a WM_SYSCHAR or WM_SYSDEADCHAR message."
Except for WM_CHAR, none of these messages are used in SDL. Hence TranslateMessage should be dropped entirely and proper handling be included in the WM_KEYDOWN event.
Currently TranslateMessage is called for every message even if it must not be called in certain cases (like "An application should not call TranslateMessage if the TranslateAccelerator function returns a nonzero value.").

WM_CHAR message handling should remain for external processes posting these messages - additionally, WM_UNICHAR should be added.

I made a patch for src/video/windows/SDL_windowsevents.c that seems to work fine. It doesn't solve the "missing" composition for Khmer, but at least input for languages that cannot be mapped to ASCII characters (and for which IME is not used) will now work on Windows.
2013-08-16 15:35:10 -07:00
Gabriel Jacobo bb2671b7e7 Android quirk:Some devices don't report GL_OES_framebuffer_object but support it 2013-08-16 14:38:04 -03:00
Ryan C. Gordon 4cb0ead795 Patched to compile. 2013-08-16 12:51:29 -04:00
Gabriel Jacobo 02868b6903 [Bug 2042] OpenGL ES renderer tries to load OES functions unconditionally
Also, fail more gracefully when creating texture to avoid double free errors.
2013-08-16 13:37:27 -03:00
Sam Lantinga 76b7b1e96c Fixed alpha composition when destination alpha is transparent.
Jianyu Guan

I found I make a big mistake that when dstA==0, I just simply let *dstp=*srcp and forgot to make dstRGB = srcRGB*srcA.

The if consition "(*dstp & amask) == 0" in BlitRGBtoRGBPixelAlphaMMX and BlitRGBtoRGBPixelAlphaMMX3dNow should be removed.
2013-08-16 09:20:33 -07:00
Sam Lantinga 89bc80f1ae Fixed alpha blending for the MMX blit functions
I see the Remarks of function SDL_BlitSurface shows that "when SDL_BLENDMODE_BLEND, we have dstA = srcA + (dstA * (1-srcA))". however, I tested some pictures but the result implies "dstA=arcA" actually. I stepped into the source code, and found after I set SDL_BLENDMODE_BLEND for the source surface, the final blit function is BlitRGBtoRGBPixelAlphaMMX when I use SDL_BlitSurface on my computer. And I found these codes:

    else if (alpha == amask) {
    /* opaque alpha -- copy RGB, keep dst alpha */
    *dstp = (*srcp & chanmask) | (*dstp & ~chanmask);

The same code is used in BlitRGBtoRGBPixelAlphaMMX3DNOW and BlitRGBtoRGBPixelAlpha. So I think they still keep dst alpha.

Best regards,
Jianyu Guan
2013-08-16 06:59:19 -07:00
Sam Lantinga 67367be019 Don't print "unrecognized key" message for an X11 keycode of 0. This can happen with composed characters. 2013-08-12 22:00:21 -07:00
J?rgen P. Tjern? 14bf230d76 Mac: Fix restoring of Cmd-H-hidden fullscreen desktop windows.
This should fix http://bugzilla.libsdl.org/show_bug.cgi?id=1996
2013-08-12 11:09:13 -07:00
Gabriel Jacobo dad420670f Fixes #2022, do not resume on Android when surfaceChanged
If the app is in landscape mode and the user presses the power button, a pause
is followed immediately by a surfaceChanged event because the lock screen
is shown in portrait mode. This triggers a "false" resume.
So, we just pause and resume following the onWindowFocusChanged events.

Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before
blocking the event pump.
2013-08-12 11:13:50 -03:00
Sam Lantinga e14e0ef947 Fixed crash if the OpenGL library hasn't been loaded yet 1970-01-01 04:04:21 +00:00
Yuri Kunde Schlesner d12d7952f1 Align pointer in SDL_memset before doing Uint32 loop
Some more recent compilers emit SSE aligned store instructions for the loop,
causing crashes if the destination buffer isn't aligned on a 32-bit boundary.
This would also crash on platforms like ARM that require aligned stores.

This fixes a crash inside SDL_FillRect that happens with the official x64 mingw
build.
2014-05-10 21:48:46 -03:00
Philipp Wiesemann 9bc47465ca Changed C++ style comments. 2014-05-18 21:11:30 +02:00
Philipp Wiesemann ca11d7c8b5 Changed C++ style comments to fix pedantic warnings. 2014-05-17 22:02:25 +02:00
Philipp Wiesemann 0d196c3099 Removed unused standard library includes from gesture source. 2014-05-17 21:52:05 +02:00
Sam Lantinga e772f0df2b Added a binding for the NVIDIA Shield controller 2014-05-13 12:10:37 -07:00
Sam Lantinga 6735097332 Updated coding style to match the rest of SDL 2014-05-13 11:32:36 -07:00
David Ludwig 49cef77e31 WinRT: fixed the max-button count for WinPhone 8.1 message boxes
Doh.

The max button count on WinPhone 8.1 was set to three, not two.  Any more than
two leads to a crash.
2014-05-10 23:39:54 -04:00
David Ludwig ea99e0c03e Added limited message-box support for Windows Phone 8.1
The Windows Phone 8.1 'MessageDialog' API only seems to support two buttons,
despite the documentation for such mentioning support for three.  Trying to use
three or more buttons leads to an exception being thrown.  As such, any attempt
to use more than two buttons via SDL_ShowMessageBox (on Windows Phone 8.1) will
lead to no message box getting shown, and the call returning an error.

The Win32 MessageBox and dialog APIs are not available in WinRT apps, to note.

More extensive message dialog support might be available at some point, if and
when XAML support is more fully fleshed-out.  I'm not certain of this, though.
2014-05-10 23:28:53 -04:00
Gabriel Jacobo de0d349e68 Fixes #2512, handle configuration change messages sent by Wayland. Patch by Bryan Cain. 2014-05-10 16:50:05 -03:00
Gabriel Jacobo fb389950a7 Fixes #2529, guard SDL_d3math.* with the proper defines 2014-05-10 16:23:06 -03:00
Gabriel Jacobo 536dd01307 Fixes #2519, clear error if using the default library path for EGL succeeds. 2014-05-10 16:13:22 -03:00
Dimitris Zenios 548a0ee7b8 __ANDROID__ is the correct macro to check for an android system.ANDROID is only defined in NDK build system (.mk) and not in the standalone NDK. 2014-05-05 22:21:26 +03:00
Dimitris Zenios 3672aeb497 Export android jni functions even when build with -fvisibility=hidden flag 2014-05-05 22:26:21 +03:00
Sam Lantinga 1a4c0dacbc Temporary fix for bug 2494 - Crashes due to the non thread-safe SDL_malloc/SDL_free on Windows
We'll define USE_LOCKS as a temporary fix until an alternative like ptmalloc, jemalloc, or nedmalloc can be investigated.
http://www.malloc.de/en/
http://www.canonware.com/jemalloc/
http://www.nedprod.com/programs/portable/nedmalloc/

SDL allocates memory very infrequently, so this is probably a decent fix for a while.
2014-05-10 11:27:43 -07:00
David Ludwig 164e5b89d5 WinRT: display-information code cleanups 2014-05-09 21:28:52 -04:00
David Ludwig d4f1d2257e Fixed bug: touch input on WinPhone 8.0 was wrong, in some cases
When a Windows Phone 8.0 app was rotated to anything but Portrait mode, touch
input coordinates, as well as virtual mouse coordinates, were usually getting
reported as coming from the wrong part of the screen.
2014-05-09 20:32:06 -04:00
David Ludwig 0a879d63bd Fixed rendering-alignment issues on WinPhone 8.1, when the device was rotated
If a Windows Phone 8.1 device was rotated to anything but Portrait mode,
the Direct3D 11 renderer's output wouldn't get aligned correctly with the
screen.
2014-05-09 20:16:21 -04:00
Brandon Schaefer b614809203 eglGetProcAddress fails the same way on MIR as ANDROID does on arm. Thanks Sylvain Becker for the patch! 2014-05-06 15:08:43 -07:00
Ryan C. Gordon 2a7aa9bde8 Fix build on Windows targets without dxgi.h, like MingW32. 2014-05-06 00:13:07 -04:00
Brandon Schaefer 7528f94ca5 Remove code that found its way back into the diff 2014-05-02 12:39:26 -07:00
Brandon Schaefer 44a0f1d9cd Fix software rendering in the mir backend. The window assumed hardware buffer, which caused testdrawchessboard to fail to mmap a buffer. 2014-05-02 12:33:19 -07:00
David Ludwig ec5f6ad595 WinRT: suppressed an unused param warning when building for Windows Phone 8.1 2014-04-30 21:12:47 -04:00
David Ludwig c5c1a2c65a WinRT: preliminary support for building against the Windows Phone 8.1 SDK
This is a step towards supporting "Universal" Windows apps, when building for
Windows Phone.  SDL can now build against the Windows Phone 8.1 SDK, and apps
linked to it can run, however further work and testing is required as some
previously Phone-only code appears to no longer be applicable for
Windows Phone 8.1.  The Windows 8.1 code paths does seem to be preferable, but
should probably be tested and updated on a finer-grained basis.

If in doubt, use the Windows Phone 8.0 projects for now, as located in
VisualC-WinRT/WinPhone80_VS2012/

TODO:
- look at any Windows Phone specific code paths in SDL, and see if Phone 8.1
should use the Windows Phone code path(s), or the Windows 8.x or 8.1 paths
2014-04-30 21:07:30 -04:00
David Ludwig c10afa4816 Fixed a linker error when building SDL/WinRT
The Win32 APIs, VerifyVersionInfoW and VerSetConditionMask, are not currently
available for use in WinRT apps.  This change primarily #if[n]defs-out some
calls to them.
2014-04-29 19:22:48 -04:00
Sam Lantinga d2fb8a2a91 Better compiler for Windows XP systems 2014-04-26 11:23:55 -07:00
Ryan C. Gordon 5d7562c7e2 Mac OS X: Look for joystick hotplug in its own CFRunLoop.
This allows the joystick hotplug to function without the main event loop
 (specifically: without SDL_INIT_VIDEO), and moves explicit polling for
 joysticks where it belongs at the low-level: in SDL_SYS_JoystickDetect().

This lets apps call SDL_JoystickUpdate() to get hotplug events and keep
 SDL_NumJoysticks() correct, as expected. As SDL_PumpEvents() (and
 SDL_PollEvents, etc) calls SDL_JoystickUpdate(), existing apps will function
 as before.

Thanks to "raskie" on the forums for pointing this out!
2014-04-24 23:24:48 -04:00
J?rgen P. Tjern? 8b28009105 Mac: Correct the y-axis position after 870c7d21004b
This fixes a bug where we'd offset positions by the height of the dock, if it
was along the bottom of the screen.

Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2509
Thanks to Alex Szpakowski for bug & patch.
2014-04-24 21:05:51 -07:00
Sam Lantinga dfea14d92d Fixed cygwin build 2014-04-23 13:54:47 -07:00
Sam Lantinga 45dc89c2c2 Fixed detecting output on second adapter
CR: Sam Lantinga
2014-04-23 13:48:01 -07:00
Sam Lantinga 3e3570dff7 Don't crash in WIN_GL_InitExtensions() if the OpenGL library couldn't be loaded 2014-04-23 13:47:57 -07:00
Sam Lantinga a5ce57bc3d Fixed compiler warning 2014-04-23 13:47:52 -07:00
Sam Lantinga acbc321c2a Don't try to load d3dcompiler_46.dll on Windows XP 2014-04-23 13:47:42 -07:00
Sam Lantinga af395e970e Removed possible implicit memset() 2014-04-23 13:47:35 -07:00
J?rgen P. Tjern? beff5cece6 Mac: SDL_SetWindowPosition is now relative to the menubar.
It used to be that SDL_SetWindowPosition was relative to the top of the screen,
which didn't make sense. In addition, borderless windows can be positioned
*below* the menubar, so SDL_SetWindowPosition(win, 0, 0) on a borderless window
would hide ~30ish pixels of the window below the menubar.
2014-04-19 13:15:53 -07:00
J?rgen P. Tjern? defd90b6f6 Render: Allow empty cliprect.
This fixes an issue where an empty cliprect is treated the same as a NULL
cliprect, causing the render backends to disable clipping.

Also adds a new API, SDL_RenderIsClipEnabled(render) that allows you to
differentiate between:
 - SDL_RenderSetClipRect(render, NULL)
 - SDL_Rect r = {0,0,0,0}; SDL_RenderSetClipRect(render, &r);

Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2504
2014-04-19 13:15:41 -07:00
Sam Lantinga 36e11d87c8 Fixed missing j 2014-04-19 10:17:36 -07:00
Brandon Schaefer 2540214e06 Mir 14.04 headers available that allow scroll + touch events. 2014-04-19 00:31:02 -07:00
Ryan C. Gordon 60e0504077 Fixed some issues reported on new Ubuntu 14.04 buildbots. 2014-04-19 02:17:34 -04:00
Sam Lantinga d2ea7cfea4 Fixed logic error loading DXGI 2014-04-18 12:43:10 -07:00
Sam Lantinga 03afd0de40 SDL_DXGIGetOutputInfo() checks input parameters and returns a boolean value whether or not it succeeded. 2014-04-18 12:43:04 -07:00
J?rgen P. Tjern? fc9e3a69b7 Mac: Don't prompt to reopen windows after crash.
We don't support state serialization / resume, so disable the prompt
that pops up asking if you want to reopen the windows.
2014-04-15 13:53:07 -07:00
Sam Lantinga 6dd9ea8d37 Fixed bug 2496 - mouse left button double click event issue
cplu

When I double click on a window, the "clicks" field (newly added since 2.0.2) in SDL_MouseButtonEvent is 1 instead of 2.
However, when I "tripple" click, "clicks" field is then 2.
I'v look into the source code in SDL_windowsevents.c and found that when a double click event comes, WIN_WindowProc will get a WM_LBUTTONDBLCLK msg. The message sequence of a double click is:WM_LBUTTONDOWN->WM_LBUTTONUP->WM_LBUTTONDBLCLK->WM_LBUTTONUP.
2014-04-17 21:00:25 -07:00
Thomas Perl 929fd90e05 Wayland: Resize windows with 0x0 requested size to screen size
This makes it in line with other platforms, where SDL_CreateWindow() with
width=0, height=0 and SDL_WINDOW_FULLSCREEN opens a fullscreen window.
2014-04-05 17:19:34 +02:00
Sam Lantinga 5a6f4d4051 Fixed bug 2485 - [PATCH] Wayland: cursor disappears permanently after window loses mouse focus
Bryan Cain

Using any SDL application with the Wayland backend under Weston, if the application sets a cursor with SDL_SetCursor, the cursor will work until the mouse pointer leaves the window.  When the pointer re-enters the window, there will be no cursor displayed at all.

I did some digging, and the reason for this is that SDL attaches the buffer to the cursor surface only once (during cursor creation) and assumes that it will stay attached.  This is not how Wayland works, though - once the compositor is done rendering the buffer, it will release it, so it is no longer attached to the surface.  When the cursor re-enters the window a second time, SDL sets the cursor to the same surface with no buffer attached, so no cursor is displayed.

This is fixed by the attached patch, which makes SDL attach the buffer to the surface when the cursor is set, not when it is created.
2014-04-17 20:51:28 -07:00
Sam Lantinga 59690a4e97 Fixed bug 2482 - Wayland_CreateSystemCursor trying to load nonexistent "wait" cursor
Bryan Cain

Wayland_CreateSystemCursor tries to load a cursor named "wait" for two of the system cursor categories.  This causes a segmentation fault when one of these cursors is used, because "wait" is not an actual cursor name in X11/Wayland cursor themes.

I can't attach my patch since I'm on a mobile right now, but I can confirm that simply replacing "wait" with "watch" for both of its uses in Wayland_CreateSystemCursor (in SDL_waylandmouse.c) fixes the bug.
2014-04-17 20:21:10 -07:00
Sam Lantinga 7ae52b1730 Fixed bug 2477 - [PATCH] Joysticks do not work on RHEL6/CentOS6 systems
Ashley Whetter

RHEL6 and CentOS6 systems still use an old version of udev (147). It wasn't until udev 148 (Yep. 1 version off!) that the input class system changed from "ID_CLASS" to "ID_INPUT_{JOYSTICK,KEYBOARD,MOUSE,etc}" (http://lwn.net/Articles/364728/). Because SDL2 looks for the ID_INPUT_X field this means that it never detects any input devices on RHEL6 systems.

I've attached a patch which fixes the problem. If no input devices are detected with "ID_INPUT_X" then SDL will fallback to looking for the old style "ID_CLASS" udev field instead.
Because of the "big change" between udev versions I doubt it'll ever get upgraded on RHEL6, but because RHEL7 is on the way I don't know if this patch is worth merging. Hopefully it'll help anyone out that's having this problem though.
2014-04-17 20:18:50 -07:00
Sam Lantinga 5439f9dd87 Fixed window losing the SDL_WINDOW_FOREIGN flag if something tries to recreate it. 2014-04-17 20:15:44 -07:00
Sam Lantinga 2dacb60bbb Fixed bug 2086 - valgrind memory not released
Sylvain

Someone provided a patch for this, recently on the mailing list :
-----

Hi,

it is possible to skip the bug in libX11 by using the defaults for
XNResourceName and XNResourceClass in `XCreateIC' (the table for the
"Input Context Values" [1] in libX11-doc shows that a default is
provided if it is not set).

diff -ur SDL2-2.0.3~/src/video/x11/SDL_x11window.c SDL2-2.0.3/src/video/x11/SDL_x11window.c
--- SDL2-2.0.3~/src/video/x11/SDL_x11window.c   2014-04-04 17:09:40.764307181 +0200
+++ SDL2-2.0.3/src/video/x11/SDL_x11window.c    2014-04-04 17:10:23.887765046 +0200
@@ -239,8 +239,7 @@
         data->ic =
             X11_XCreateIC(videodata->im, XNClientWindow, w, XNFocusWindow, w,
                        XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
-                       XNResourceName, videodata->classname, XNResourceClass,
-                       videodata->classname, NULL);
+                       NULL);
     }
 #endif
     data->created = created;


Tito Latini

[1] http://www.x.org/releases/X11R7.7-RC1/doc/libX11/libX11/libX11.html#Input_Context_Values
2014-04-17 20:06:02 -07:00
Sam Lantinga f6953cf4c2 Fixed bug 2502 - Memory leak inside SDL_x11events.c -> X11_DispatchEvent(_THIS)
bojko_1000

Code @566:
            if (data->xwindow) {
                Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0);
                Atom type = None;
                int format;
                unsigned long nitems = 0, bytes_after;
                unsigned char *property;
                X11_XGetWindowProperty(display, data->xwindow,
                    _net_frame_extents, 0, 16, 0,
                    XA_CARDINAL, &type, &format,
                    &nitems, &bytes_after, &property);

                if (type != None && nitems == 4)
                {
                    border_left = ((long*)property)[0];
                    border_right = ((long*)property)[1];
                    border_top = ((long*)property)[2];
                    border_bottom = ((long*)property)[3];
                }
            }

Code after _the fix_:
            if (data->xwindow) {
                Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0);
                Atom type = None;
                int format;
                unsigned long nitems = 0, bytes_after;
                unsigned char *property;
                X11_XGetWindowProperty(display, data->xwindow,
                    _net_frame_extents, 0, 16, 0,
                    XA_CARDINAL, &type, &format,
                    &nitems, &bytes_after, &property);

                if (type != None && nitems == 4)
                {
                    border_left = ((long*)property)[0];
                    border_right = ((long*)property)[1];
                    border_top = ((long*)property)[2];
                    border_bottom = ((long*)property)[3];
                }
                X11_XFree(property);
            }

I have found that leak with valgrind.
2014-04-17 20:02:11 -07:00
Sam Lantinga f4b77110d2 Fixed bug 2503 - Loop indexing and event union errors in SDL_gesture.c
Lasse ??rni

While enabling $1 gesture support in the Urho3D engine which uses SDL2 I detected some errors in the gesture code in SDL_gesture.c:

- In the function SDL_SaveAllDollarTemplates() the following line should use index variable j instead of i:

    rtrn += SaveTemplate(&touch->dollarTemplate[i], dst);

- In the function SDL_SaveDollarTemplate() the following code should use index variable j instead of i:

    if (touch->dollarTemplate[i].hash == gestureId) {
        return SaveTemplate(&touch->dollarTemplate[i], dst);

- In the function SDL_SendGestureDollar() the x & y coordinates are being written to the mgesture structure, which results in garbage due to dgesture and mgesture being different data structures inside the union. The coordinates should be written to dgesture.x & dgesture.y respectively
2014-04-17 19:52:15 -07:00
David Ludwig 63b46d3d88 WinRT: keyboard VirtualKey translation improvements from Sylvain Becker
Changes included:
- adding support for a few, additional, VirtualKey constants
- removing accesses to 'windows_scancode_table', as the table's contents
don't line up with WinRT virtual keys.  Using Windows older VK_* constants
may, however, be a good alternative in a future update.
2014-04-17 12:43:51 -04:00
Gabriel Jacobo 4bb6afefa2 Comment out eglWaitGL from Android_GLES_SwapWindow
Let's hope for the best! If anyone has a device affected by this removal,
please file a bug!
2014-04-17 12:44:08 -03:00
David Ludwig 3dcb451f85 Added a README file regarding WinRT support
To note, this file is currently formatted with CRLF line endings, rather than
LF, to allow the file to be viewed with Notepad.
2014-04-09 21:29:19 -04:00