Commit Graph

807 Commits

Author SHA1 Message Date
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