Commit Graph

249 Commits (5eccbac4b9c284e7251fca6fe3e821eea879f8b5)

Author SHA1 Message Date
Ryan C. Gordon 5eccbac4b9 Mac: Manage menubar and dock as FULLSCREEN_DESKTOP windows become/resign key. 2014-03-02 15:35:24 -05:00
Bastien Nocera 4ca76b3e59 Add support for the freedesktop.org Idle Inhibition specification,
as per:
http://people.freedesktop.org/~hadess/idle-inhibition-spec/

This makes screensaver inhibition work with GNOME 3 and other
desktop environments that implement the specification.

https://bugzilla.libsdl.org/show_bug.cgi?id=2169
2014-03-02 14:59:06 -05:00
Sam Lantinga c2c08f68e4 Backed out changeset 9357a2ca3473 2014-03-02 11:10:00 -08:00
Sam Lantinga 2cf453dd3e Make sure we return version 0 if XInput detection fails 2014-03-02 11:08:05 -08:00
Ryan C. Gordon 51faf449bb Reworked fullscreen policy on Mac OS X.
- SDL_WINDOW_FULLSCREEN works as always (change resolution, lock to window).
- SDL_WINDOW_FULLSCREEN_DESKTOP now puts the window in its own Space, and
  hides the menu bar, but you can slide between Spaces and Command-Tab between
  apps without the window minimizing, etc.
- SDL_WINDOW_RESIZABLE windows will get the new 10.7+ "toggle fullscreen"
  window decoration and menubar item. As far as the app is concerned, this is
  no different than resizing a window, but it gives the end-user more power.
- The hint for putting fullscreen windows into the Spaces system is gone,
  since Spaces can't enforce the requested resolution. It's a perfect match
  for FULLSCREEN_DESKTOP, though, so this is all automated now.
2014-03-02 12:45:51 -05:00
Ryan C. Gordon afc74d9843 Better attempt to detect available X11 XInput2 features.
Fixes Bugzilla #2306.
2014-03-02 02:00:40 -05:00
Ryan C. Gordon fc0daeba75 Fixed X11 XInput2 multitouch test to work in configure script.
configure wraps this C code in a main() function, so you can't declare a
function body in there. Besides, I'm not sure why we declared a function
that's part of the multitouch API anyhow.

Now we just reference a type that only exists if the headers have multitouch
support and call it a day.
2014-03-02 01:59:25 -05:00
Ryan C. Gordon 1005c93402 Windows: Fixed crash if quitting without closing an XInput haptic device. 2014-03-02 00:02:56 -05:00
Ryan C. Gordon 754067db7e Added a FIXME. 2014-03-01 22:27:21 -05:00
Ryan C. Gordon 7fa4eece25 Fixed a typo in a comment. 2014-03-01 22:27:13 -05:00
Ryan C. Gordon bafa4c7ae8 Dynamically load glGetString(), to avoid direct dependency on OpenGL. 2014-03-01 21:33:48 -05:00
Ryan C. Gordon 73936208b0 Added some FIXMEs. 2014-03-01 20:59:43 -05:00
Ryan C. Gordon 99583397e6 Mac OS X: Make OpenGL context selection more robust, avoid software fallback.
Fixes Bugzilla #2197.
2014-03-01 20:46:45 -05:00
Ryan C. Gordon 3e541f306d Force Windows version of SDL_GetPrefPath() to Unicode, create missing dirs.
Fixes Bugzilla #2273.
2014-03-01 20:28:40 -05:00
Sam Lantinga 63106e4729 Changed SDL_HINT_ACCEL_AS_JOY to SDL_HINT_ACCELEROMETER_AS_JOYSTICK to be more clear. 2014-03-01 12:21:15 -08:00
Sam Lantinga 54ba385b4e Fixed compiler warning 2014-03-01 11:42:12 -08:00
Sam Lantinga 86655b64ef Fixed compiler warning 2014-03-01 11:40:41 -08:00
Sam Lantinga d49962359a Fixed test for libuuid.a 2014-03-01 11:39:39 -08:00
Sam Lantinga 2a67548a3f Updated with the latest 2.0.2 API changes 2014-03-01 11:05:58 -08:00
Sam Lantinga c916f388d4 Fixed bug 2368 - Security Software is blocking RegisterRawInputDevices()
Yamagi

A customer of mine had the strange problem, that SDL_SetRelativeMouseMode() was failing for him on Windows 7. Luckily he was willing to provide some debug informations. We could track this problem down to RegisterRawInputDevices() failing due to security software running on his system (Norton Internet Security to be precise, but there are reports of similar problems with other products. For example [1]). Working around this issue with SDL_WarpMouseInWindow() is easy, and while I don't think that SDL2 can provide an internal workaround it would be really nice and helpfull if this could be documentated somewhere.

1: http://forums.codeguru.com/showthread.php?498374-How-to-run-a-very-long-SQL-statement
2014-03-01 09:59:06 -08:00
Sam Lantinga e663b4eb76 Fixed bug 2423 - timeBeginPeriod & timeEndPeriod mismatch
Coriiander

In src\timer\windows\SDL_systimer.c there is an error with regards to timeBeginPeriod and timeEndPeriod. These functions typically get called when no high resolution timer is available, and GetTickCount is not used.

According to MSDN (link: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757624(v=vs.85).aspx), for every call to timeBeginPeriod a subsequent call to timeEndPeriod is required. While SDL is currently doing this, it fails to call timeEndPeriod when cleaning up/shutting down SDL. Please note that these functions affect things on a system level. Failing to call timeEndPeriod, disables applications for using WINMM-timers after usage&shutdown of SDL, as effectively they the mechanism is now broken.

Solution:
Ensure this code gets called when shutting down the timer subsystem:

#ifndef USE_GETTICKCOUNT
if (!hires_timer_available)
{
    timeSetPeriod(0);
}
#endif
2014-03-01 09:50:52 -08:00
Sam Lantinga ab9345a896 Null termnate the pUserMappings variable to prevent memory corruption. 2014-02-28 16:24:41 -08:00
Sam Lantinga e56bbe3f71 Added a hint to enable the screensaver by default 2014-02-28 14:23:41 -08:00
Ryan C. Gordon ac32352f09 Disable the screensaver by default.
Fixes Bugzilla #2218.
2014-02-27 22:06:41 -05:00
Gabriel Jacobo f61602b434 Improve window recreation logic in OpenGL* renderers 2014-02-27 20:21:46 -03:00
J?rgen P. Tjern? 0d5957dfee Mac: Forgot return value in last commit. 2014-02-26 16:27:03 -08:00
J?rgen P. Tjern? dd94c5fa54 Mac: Don't disassociate cursor if window is moving / doesn't have focus.
Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396
2014-02-26 16:10:52 -08:00
J?rgen P. Tjern? 4850d25988 Mac: Redo cursor warp handling.
This fixes bugs related to getting unnaturally large xrel/yrel for
SDL_MOUSEMOTION after warps and enabling / disabling relative mode.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=1836
2014-02-26 11:35:02 -08:00
J?rgen P. Tjern? 52a63e823f Mac: Improve moving relative mode windows.
This makes it possible to move windows by their title bar, even if they're in
relative mode, if you click the title bar when the window does not have focus.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396
2014-02-25 17:27:41 -08:00
J?rgen P. Tjern? 98d8737961 Mac: Fix error message for haptic subsystem.
We were calling SDL_Error instead of SDL_SetError when the haptic subsystem
wasn't initialized.
2014-02-25 17:25:49 -08:00
J?rgen P. Tjern? 95f7e242e6 Mac: Immediately update current OpenGL context's shape.
Previously we were postponing our -[NSOpenGLContext update] call to the next
SDL_GL_SwapWindow, even if the context was current on the current thread. This
changes it so that we will do the update immediately if it's the current
context.

If you're rendering on another thread, you need to call SDL_GL_SwapWindow once
after a resize event to ensure your drawable will produce non-garbage data.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2339
2014-02-25 15:28:12 -08:00
Gabriel Jacobo 4c192bc802 Fixes #2308, recreate window if GL requirements for the renderer are not met
If the window has been created with values for SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION not matching those
required by the renderer, attempt to recreate the window.
This is needed on platforms where both GL and GLES 1/2 surfaces are supported
by the video backend, requiring that the window be recreated when switching
between context types.
2014-02-25 17:42:34 -03:00
CarniBlood 472068dd97 fixed gles/gles2 renderer creation fail on Android when default major/minor version doesn't match 2013-12-19 06:01:18 +09:00
Sam Lantinga 8db4c5a9d3 Fixed crash if the input data pitch is larger than the locked texture pitch 2014-02-25 10:04:49 -08:00
Sam Lantinga b420ad0e01 Don't warp the mouse while we're doing a modal interaction 2014-02-24 23:09:35 -08:00
Sam Lantinga 2a6213ad02 Make sure we don't clip the cursor while clicking on the window title bar 2014-02-24 22:49:30 -08:00
Sam Lantinga 973d890b83 Fixed relative mouse mode with multiple windows.
The window cursor clipping will be taken care of when SDL_UpdateWindowGrab() is called.
2014-02-24 22:37:58 -08:00
Sam Lantinga 54debf84e4 Added a bunch of missing windows messages 2014-02-24 22:36:24 -08:00
J?rgen P. Tjern? d6b1218b46 Mac: Fix inconsistent repeat of SDL_TEXTINPUT events on 10.7+
Due to the new "tap and hold" IME in Mountain Lion and above, we were getting
inconsistent repeat of SDL_TEXTINPUT events. Disabling that functionality (since
you can't see the popover anyway) solves this.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2387
2014-02-24 16:42:08 -08:00
Gabriel Jacobo 6ee12d6ccc Fixes #2296 - SDL_GL_UnbindTexture segfaults (thanks Daniel B?nzli) 2014-02-24 18:57:22 -03:00
Ryan C. Gordon b814f23a21 CMake: Fixed build on Mac OS X. 2014-02-24 11:24:48 -05:00
Gabriel Jacobo 1084421cca Zero out haptic linked list items on creation
(thanks to Turo Lamminen for the report!)
2014-02-24 10:25:02 -03:00
Gabriel Jacobo 2ed47d8369 Fixes #2417, memory leak in SDL_gamecontroller.c (thanks Leonardo!) 2014-02-24 10:00:10 -03:00
Ryan C. Gordon 96f09df730 Free the correct variable. 2014-02-23 01:24:46 -05:00
Ryan C. Gordon 295acea953 CMake: Just assume Apple platforms have Cocoa support.
Fixes Bugzilla #2056.
2014-02-23 01:10:33 -05:00
Ryan C. Gordon f9f2bc5afb Fixed Mac DualShock 4 gamecontroller db entry again. 2014-02-22 21:21:33 -05:00
Ryan C. Gordon b67b970db1 Mac joystick: ignore duplicate HID elements.
The DualShock 4 has all elements listed twice: once in the top-level list of
 elements, and once in an "Application Collection" element at the top-level.

Each element has a proper cookie with a unique value, so now we descend into
 each element collections, but before we add an element to the device's list,
 we make sure we don't already have one with that cookie, probably from
 another collection or a buggy device.
2014-02-22 21:15:34 -05:00
Sam Lantinga 9cd5f5ceca Fixed bug 2404 - CPU detection not working with MSVC on x64
Tiemo Jung

All CPU detection functions SDL_Has* will return false, even if it is supported by the CPU, if SDL is compiled with MSVC and the target is x64.

The reason for this is that 'CPU_haveCPUID' will return 0 and macro 'cpuid' in SDL_cpuinfo.c is the fallback implementation, which sets all params to zero.

It is safe to assume that cpuid is supported on a CPU that runs windows x64, so CPU_haveCPUID can just return 1, and the empty macro can be replaced with a small wrap around the __cpuid intrinsic.
2014-02-22 19:10:45 -08:00
Sam Lantinga fea87cc9cf Fixed bug 2335 - Fails to build on Debian GNU/kFreeBSD
Felix Geyer

Starting from version 2.0.1 libsdl fails to build on Debian GNU/kFreeBSD in SDL_cpuinfo.c.

GNU/kFreeBSD defines __FreeBSD_kernel__ but not __FreeBSD__.
The #ifdef __FreeBSD__ check should be extended for __FreeBSD_kernel__, see the attached patch.

Build log:
libtool: compile:  gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DUSING_GENERATED_CONFIG_H -Iinclude -I/?BUILDDIR?/libsdl2-2.0.1+dfsg1/include -mmmx -m3dnow -msse -msse2 -fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-kfreebsd-gnu/dbus-1.0/include -DHAVE_USBHID_H -DUSBHID_NEW -D_REENTRANT -Wall -c /?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c  -fPIC -DPIC -o build/.libs/SDL_cpuinfo.o
/?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c: In function 'SDL_GetSystemRAM':
/?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: error: 'HW_MEMSIZE' undeclared (first use in this function)
             int mib[2] = {CTL_HW, HW_MEMSIZE};
                                   ^
/?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [build/SDL_cpuinfo.lo] Error 1
2014-02-22 18:01:18 -08:00
Sam Lantinga 6bb2f2ef8d Fixed bug 2347 - On OSX, an SDL app prevents system shutdown.
Tim McDaniel

On OSX, an SDL app forces a system shutdown to be cancelled.  This happens because [SDLAppDelegate applicationShouldTerminate] returns NSTerminateCancel.  A better approach is to subclass NSApplication and override terminate to do nothing except call SDL_SendQuit.  In response to a system shutdown notification, this allows the normal SDL Quit event processing to occur, and if the app then terminates, system shutdown occurs normally.  Please see the attached patch, based on SDL 2.0.1.
2014-02-22 17:55:58 -08:00