Commit Graph

10658 Commits

Author SHA1 Message Date
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
David Ludwig 33f81a0da5 WinRT: made Win[Phone] 8.1 projects be structured like their 8.0 counterparts
This change removes the "Shared" component from the Windows 8.1 and Windows
Phone 8.1 project files, then renames the projects to use a file structure
that's the same as  used for the Windows 8.0 and Windows Phone 8.0 projects.

This change now places WinRT projects in the following directories:

VisualC-WinRT\WinRT81_VS2013\ -- Windows 8.1 project files
VisualC-WinRT\WinPhone81_VS2013\ -- Windows Phone 8.1 project files (NEW, as of this change)
VisualC-WinRT\WinRT80_VS2012\ -- Windows 8.0 project files
VisualC-WinRT\WinPhone80_VS2012\ -- Windows Phone 8.0 project files

Windows 8.0 and Windows Phone 8.0 projects, as well as apps or libs that
reference these, should be unaffected by this change.

Windows 8.1 and Windows Phone 8.1 based apps or libs that reference SDL's
projects directly will need to have their old references removed, then
replaced with new ones that point to the updated structure.
2014-05-06 20:31:10 -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 e7bccd1640 Update the machine-generated configure code. 2014-05-06 00:20:34 -04: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
David Ludwig 366967775b WinRT: added project files for Windows 8.1 + MSVC 2013
This commit also includes some base-level support for Universal apps.

TODO:
- add support for Windows Phone 8.1
- add support for satellite libs: SDL_image, SDL_ttf, and SDL_mixer
2014-04-29 19:06:00 -04:00
Ryan C. Gordon cb403ab660 Removed comma at end of enum in a public header, to make -Wpedantic happy. 2014-04-29 12:00:28 -04:00
Steven Stewart-Gallus 2c784e3639 Set the tag type in libtool invocations
Setting the tag type will let libtool work even when it cannot infer
the type of the code being built. One way libtool may fail to infer
the tag type is if one uses a mock compiler (such as for static
analysis).
2014-04-19 16:33:42 -07:00
Sam Lantinga bd6a493697 Fixed bug 2508 - don't redefine WIN32_LEAN_AND_MEAN 2014-04-26 12:38:35 -07:00
Sam Lantinga d9ffe549e2 Fixed the inertia effect in the test program 2014-04-26 12:29:40 -07: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
Brandon Schaefer ae2a50fc8f Revert MIR_CFLAGS to SDL_CFLAGS. Use forward declaration for the real fix. (We shouldn't expose mir headers!) 2014-04-21 12:42:25 -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
David Ludwig 0ba3a54ac3 Cleaned up and rearranged WinRT project file structure.
All WinRT projects have been merged into a single directory, "VisualC-WinRT",
with platform-specific variants in subdirectories off of it.  This structure
has been applied to a few major SDL satellite libraries as well (SDL_image,
SDL_mixer, and SDL_ttf).

Currently, only Windows 8.0/RT and Windows Phone 8.0 targets are supported.
Windows 8.1/RT/Phone targets are planned.

Projects that use SDL_image/WinRT, and link to it via Visual Studio's
project-to-project reference system, will need to be updated, to reflect the
changes in the project structure.  This can be done by:
1. removing the MSVC project(s) for SDL/WinRT
2. re-added the MSVC project(s) for SDL/WinRT
3. right-clicking on the app, or projects that use those libraries, choosing
References, removing the references to any of these projects (they'll likely
be highlighted with an exclamation mark), then re-adding them

To note, the satellite libraries that reference SDL/WinRT have been updated
already.  The changes for those libraries will be pushed to hg.libsdl.org
shortly.

TODO:
- add support for Windows 8.1 and Windows Phone 8.1 targets, using
Microsoft's new "Universal" app support, if possible.  These will be added to
a new subdirectory, or subdirectories (if more than one sets of projects are
needed, hopefully not), of "VisualC-WinRT".
- investigate NuGet support, which could allow Visual C++ to download
new copies of SDL/WinRT, its satellite libraries, and their dependencies,
from remote servers.
2014-04-19 12:48:45 -04:00
Philipp Wiesemann 65c82148e0 Removed global variable from test program. 2014-04-19 15:28:13 +02: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 dd27ebed6f Turn off Wayland support for Raspberry Pi on the buildbot.
It's picking up the system headers instead of the RPi build files.

Theoretically, we _can_ support Wayland on this platform, though, as there
 _is_ a Raspberry Pi port out there...
2014-04-19 02:26:12 -04: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 353feb5c76 Fixed bug 2475 - Incorrect SDL_Log() format specifiers in test/testgesture.c
rettichschnidi

The floats should not be interpreted as integers. Patch against the current head attached.
2014-04-17 22:40:57 -07:00
Sam Lantinga 43c991969e Fixed bug 2489 - SDL2.framework references __Block_copy in /usr/lib/libSystem.B.dylib, but this symbol cannot be found on OSX-10.5
Thomas Schatz

The dynamic library (extracted from SDL2-2.0.3.dmg and put in /Library/Frameworks/) references the __Block_copy symbol in /usr/lib/libSystem.B.dylib, which cannot be found:

dlopen(/Library/Frameworks/SDL2.framework/SDL2, 6): Symbol not found: __Block_copy
  Referenced from: /Library/Frameworks/SDL2.framework/SDL2
  Expected in: /usr/lib/libSystem.B.dylib

From what I could gather __Block_copy seems to be related to the blocks extension to the C programming language introduced by Apple since OSX-10.6 (see: http://thirdcog.eu/pwcblocks/). If this is indeed the case, I don't think the SDL2-2.0.3.dmg on the website is at all compatible with OSX-10.5 countrary to what is announced.
2014-04-17 22:23:32 -07:00
Dimitris Zenios 9eccde51c3 Enable building of Android libraries using a standalone NDK 2014-04-06 00:30:48 +03: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