Commit Graph

6275 Commits (2c518747b9cf45c1b94c570c19912e04476e8eed)

Author SHA1 Message Date
Ryan C. Gordon 7232e51a68 Unix: Don't send quit events during signal handler.
Make note to send it, and send next time we SDL_PumpEvents().

Otherwise, we might be trying to use malloc() to push a new event on the
queue while a signal is interrupting malloc() elsewhere, usually causing a
crash.

Fixes Bugzilla #2870.
2015-06-08 01:52:43 -04:00
Ryan C. Gordon e3f4ca0d71 configure/cmake/x11: Removed SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 test.
This was the only thing that made SDL_config.h generate differently between
32 and 64-bit versions of Linux, so instead we force a function cast in our
X11 code to match our dynamic loader version, which removes the compile error
on some machines that prompted this test in the first place.

Xlib never wrote to this data, so if you're on an older Xlib where this param
wasn't const, your data should still be intact when we force the caller to
think it was actually const after all.

Fixes Bugzilla #1893.
2015-06-08 01:13:51 -04:00
Ryan C. Gordon d98cfe1435 Let's assume that if VS2005 and VS2010 do it, VS2008 probably does, too. 2015-06-07 20:00:20 -04:00
Ryan C. Gordon 753f95c5dd VS2005 tweaks (thanks, Ozkan!).
Fixes Bugzilla #2895.

His notes:

The following trivial changes make SDL2 tree (mostly) compatible with Visual
Studio 2005:

* SDL_stdlib.c: Similar to VS2010 and newer, VS2005 also generates memcpy(),
  (it also generates memset(), see below), so propagate the #if condition to
  cover VS2005.

* SDL_pixels.c (SDL_CalculateGammaRamp): VS2005 generates a memset() call for
  gamma==0 case, so replace the if loop with SDL_memset().

* SDL_windowsvideo.h: Include msctf.h only with VS2008 and newer, otherwise
  include SDL_msctf.h

* SDL_windowskeyboard.c: Adjust the #ifdefs so that SDL_msctf.h inclusion is
  always recognized correctly.
2015-06-07 19:58:42 -04:00
Ryan C. Gordon 8bac796791 Maybe patched to compile on some Windows configurations.
(Maybe) Fixes Bugzilla #3001.
2015-06-07 18:29:23 -04:00
Ryan C. Gordon 141ac2b59d Backed out changeset c6d43e08be34
This caused Bugzilla #2963, so we'll find a better solution.
2015-06-07 17:59:31 -04:00
Ryan C. Gordon 699f879a8f Fixed a memory leak (thanks, Zack!).
We should probably rework this piece of code a little more after 2.0.4 ships,
though.

Fixes Bugzilla #3004.
2015-06-07 17:54:39 -04:00
Ryan C. Gordon 8a85084fc1 RPi: Patched to compile without OpenGL (thanks, Simon!), other cleanups.
Fixes Bugzilla #3003.
2015-06-06 22:45:22 -04:00
Philipp Wiesemann fd8b7c1ca3 Fixed comments at conditional compilation macros. 2015-06-05 19:41:18 +02:00
Ryan C. Gordon 360d05bf72 X11: Fixed SelectionRequest replies for target TARGETS.
Fixes Google Chrome, etc, freezing up when SDL owns the clipboard selection
and actually sends thems the correct text for pasting. Confirmed working with
Unicode strings in UTF-8 format.

There were a few tweaks in this patch, but the specific fix is that
event.xselection.target in the SelectionNotify event we send back in reply
must be set to the same atom as the request ("TARGETS" in this case), and
we failed to do that in this special case. Things that don't ask for a target,
like the Gnome Terminal app, worked fine because they don't ask for TARGETS
and just go right to asking for a UTF8_STRING, and Mozilla apparently just
was more liberal in what they accepted in reply.

Chrome would reject our wrong reply and freeze up waiting for a valid one.
Someone should fix that in Chrome, too.  :)

Fixes Bugzilla #2926.
2015-06-04 15:41:39 -04:00
Ryan C. Gordon 96aef8cbca X11: Fixed compiler warnings in DEBUG_XEVENTS sections. 2015-06-04 10:59:02 -04:00
Philipp Wiesemann 7738bd9b55 AIX: Fixed nearly impossible file descriptor leak. 2015-06-04 17:52:51 +02:00
Sam Lantinga 38549a7bba Fixed bug 2625 - Direct3D9 with SDL_TEXTUREACCESS_TARGET textures causes an application crash
Roberto

I have debugged the code checking the function calls when Direct3D is the renderer, remember that with software and OpenGL renderers, this issue is not happening.

- Create the texture:
SDL_Texture *pTex = SDL_CreateTexture(pRenderer, iFormat, SDL_TEXTUREACCESS_TARGET, pSurf->w, pSurf->h);

- Update the texture:
SDL_UpdateTexture(pTex, NULL, pSurf->pixels, pSurf->pitch);
  SDL_render.c, SDL_UpdateTexture(): return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
    SDL_render_d3d.c, D3D_UpdateTexture(): if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
      SDL_render_d3d.c, D3D_UpdateTextureRep(): if (D3D_CreateStagingTexture(device, texture) < 0) {
        SDL_render_d3d.c, D3D_CreateStagingTexture(): result = IDirect3DDevice9_CreateTexture(..., D3DPOOL_SYSTEMMEM, ...) --> FAIL! with INVALIDCALL code

After checking a bit the Microsoft documentation, I found this:

D3DUSAGE_RENDERTARGET can only be used with D3DPOOL_DEFAULT. (https://msdn.microsoft.com/en-us/library/windows/desktop/bb172625%28v=vs.85%29.aspx)

The call that fails, is using D3DUSAGE_RENDERTARGET with D3DPOOL_SYSTEMMEM which is unsupported, hence the INVALIDCALL return code.
2015-06-04 00:56:11 -07:00
Ryan C. Gordon ba1263cd1d Backout commit 83034612a883
This caused 8-bit modes to be chosen on older OS X releases.

Fixes Bugzilla #3000.
2015-06-04 02:12:06 -04:00
Ryan C. Gordon e8b376c9d5 Linux: Implemented sysfs-based version of SDL_GetPowerInfo().
Fixes Bugzilla #2938.
2015-06-03 13:11:28 -07:00
Ryan C. Gordon 36ecb766c8 Changed a static function to match the naming scheme of rest of source file. 2015-06-01 01:25:22 -04:00
Jason Wyatt cad269bc27 Also set the _NET_WM_NAME. Window managers supporting this will take this value over the value set by XStoreName. This explicitly supports UTF-8 encoding, which fixes corrupt UTF-8 titles in KDE. 2015-05-05 09:16:12 +01:00
Ryan C. Gordon 05e78b3f49 X11: search all XI2 touch devices, not just masters (thanks, Volumetic!).
Otherwise, you won't find touch devices that aren't currently assigned to a
system cursor.
2015-05-31 22:59:59 -04:00
Ryan C. Gordon 554b2b0e36 X11: Fixed message boxes not responding to click on titlebar close button.
The window needs to catch ClientMessage events for one specific window, but
XNextEvent() catches everything, and XWindowEvent doesn't catch ClientMessage,
so we need predicate procedure and XIfEvent() here.

Fixes Bugzilla #2980.
2015-05-31 22:48:26 -04:00
Ryan C. Gordon 7619ad3430 Cocoa: deal with mouse focus when warping the cursor from outside a window.
Otherwise, you might not get appropriate mouse enter/leave events.

Better fix for Bugzilla #2984.
2015-05-31 21:43:36 -04:00
Ryan C. Gordon 5b2ff76c12 Cocoa: send a MOUSEMOTION event when warping cursor from outside the window.
Fixes Bugzilla #2984.
2015-05-31 13:58:36 -04:00
Philipp Wiesemann 551fbf7bea Android: Changed two unknown keys to be consistent with Windows and X11 mapping. 2015-05-31 19:22:42 +02:00
Ryan C. Gordon 80614b27e4 Fixed swizzle of SDL_FillRect() on 24-bit surface (thanks, "nagydavid91"!).
Fixes Bugzilla #2986.
2015-05-31 11:38:10 -04:00
Ryan C. Gordon e58a5c43c4 X11: Fixed high mouse buttons mappings and horizontal wheels (thanks, Daniel!).
Fixes Bugzilla #2472.
2015-05-31 00:58:43 -04:00
Ryan C. Gordon 870df8adab Cocoa: ignore mouseDown events in a window's titlebar.
These events accidentally slipping in sometimes appears to be a bug (or
maybe new behavior) in 10.10, as previous versions of Mac OS X don't appear
to ever trigger this.

Thanks to Paulo Marques for pointing out the fix on the SDL mailing list!

Fixes Bugzilla #2842 (again).
2015-05-31 00:50:30 -04:00
Ryan C. Gordon f001a00b08 X11: Force the window focus during ShowWindow if there's no window manager.
Fixes Bugzilla #2997.
2015-05-29 15:21:47 -04:00
Sam Lantinga c888183728 Improved fix for bug 2096 - Mapping from scancode to keycode doesn't work for remapped modifier keys
Zack Middleton

The change to the keymap to use SDL_SCANCODE_TO_KEYCODE in SDL_x11keyboard.c causes all SDL scancodes without a Usc4 character to be XOR'd with SDLK_SCANCODE_MASK, but not all key code are suppose to be (as seen in include/SDL_keycodes.h). SDLK_BACKSPACE is not 0x4000002A.

I think the full list of keys affected are return, escape, backspace, tab, and delete.
2015-05-28 19:06:07 -07:00
Sam Lantinga da1909755b Fixed clip rectangle calculation when there is a viewport offset 2015-05-28 18:57:10 -07:00
Sam Lantinga 6e67c949c1 Fixed bug 2054 - SDL_GetError: "Unknown touch device"
Volumetric

The "Unknown touch device" message appears because the initial touch device setup loop uses SDL_GetTouch() as a guard for calling SDL_AddTouch().  SDL_GetTouch() will always report "Unknown touch device" since the device hasn't been added yet.  The SDL_GetTouch() call is unnecessary since SDL_AddTouch() calls SDL_GetTouchIndex() to verify that the device hasn't been added yet, and SDL_GetTouchIndex() has the benefit of not reporting an error for a device it can't find.
2015-05-28 12:55:01 -07:00
Sam Lantinga 32d6dcdb47 Fixed bug 2096 - Mapping from scancode to keycode doesn't work for remapped modifier keys
Jacob Lee

If a user has a non-standard keyboard mapping -- say, their caps lock key has been mapped to Ctrl -- then SDL_GetModState() is no longer accurate: it only considers the unmapped keys. This is a regression from SDL 1.2.

I think there are two parts to this bug: first, GetModState should use keycodes, rather than scancodes, which is easy enough.

Unfortunately, on my system, SDL considers Caps Lock, even when mapped as Control, to be both SDL_SCANCODE_CAPSLOCK and SDLK_CAPSLOCK. The output from checkkeys for it is:

INFO: Key pressed :  scancode 57 = CapsLock, keycode 0x40000039 = CapsLock  modifiers: CAPS

Whereas the output for xev is:

KeyPress event, serial 41, synthetic NO, window 0x4a00001,
    root 0x9a, subw 0x0, time 40218333, (144,177), root:(1458,222),
    state 0x10, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
    XKeysymToKeycode returns keycode: 37
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

I think the problem is that X11_UpdateKeymap in SDL_x11keyboard.c only builds a mapping for keycodes associated with a Unicode character (anything where X11_KeyCodeToUcs returns a value). In the case of caps lock, SDL scancode 57 becomes x11 keycode 66, which becomes x11 keysym 65507(Control_L), which does not have a unicode value.

To fix this, I suspect that SDL needs a mapping of the rest of the x11 keysyms to their corresponding SDL key codes.
2015-05-28 12:48:20 -07:00
Ryan C. Gordon 4d1626d042 Windows SDL_GetBasePath: free string on failure. 2015-05-28 15:36:27 -04:00
Ryan C. Gordon aa43bee434 Windows GetBasePath: fixed reallocation code. 2015-05-28 15:32:45 -04:00
Ryan C. Gordon 566316e052 Windows SDL_GetBasePath: Fixed wrong variable when growing the buffer size. 2015-05-28 15:29:43 -04:00
Sam Lantinga f9abea2061 Fixed bug 2210 - Initializing Video produces unnecessary errors
hiduei

Overview:
Initializing the Video Subsystem causes many errors though everything works as it should.

Steps to Reproduce:
1) Set Loglevel to SDL_LOG_PRIORITY_ERROR

2) Initialize the Video Subsystem (SDL_Init(SDL_INIT_VIDEO))

Actual Results:
Many errors (see attachment) are printed on stderr, then the application continues as expected.

Expected Results:
The errors should have been warnings at most.
2015-05-28 12:31:25 -07:00
Sam Lantinga 6a3ad8a998 Fixed bug 2367 - Bad mouse motion coordinates with two windows where one has changed logical size
Andreas Ragnerstam

I have two windows where one has a renderer where the logical size has been changed with SDL_RenderSetLogicalSize. When I get SDL_MOUSEMOTION events belonging to the non-scaled window these will have been scaled with the factor of the scaled window, which is not expected.

Adding some printf debugging to SDL_RendererEventWatch of SDL_render.c, where (event->type == SDL_MOUSEMOTION), I found that for every mouse motion SDL_RendererEventWatch is called twice and the event->motion.x and event.motion.y are set twice for the event, once for each renderer where only the last one set will be saved to the event struct. This will work fine if both renderers have the same scale, but otherwise the motion coordinates will be scaled for the renderer belonging to another window than the mouse was moved in.

I guess one solution would be to check that window == renderer->window for SDL_MOUSEMOTION events, similar to what is done for when SDL_WINDOWEVENT events.

I get the same error on both X11 and Windows.
The same problem also exists for SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP events.
2015-05-28 12:18:05 -07:00
Sam Lantinga bccc2ad09e Fixed compiling and tested on Windows 2015-05-28 12:06:48 -07:00
Ryan C. Gordon 6d1ad3847a Windows GetBasePath should use GetModuleFileNameExW() and check for overflows.
Apparently you might get strange paths from GetModuleFileName(), such as
short path names or UNC filenames, so this avoids that problem. Since you have
to tapdance with linking different libraries and defining macros depending on
what Windows you plan to target, we dynamically load the API we need, which
works on all versions of Windows (on Win7, it'll load a compatibility wrapper
for the newer API location).

What a mess.

This also now does the right thing if there isn't enough space to store the
path, looping with a larger allocated buffer each try.

Fixes Bugzilla #2435.
2015-05-28 01:54:52 -04:00
Ryan C. Gordon 75702ffebc Make sure we have the vsscanf() prototype (thanks, Ozkan!).
issue seen with glibc-2.8.

Fixes Bugzilla #2721.
2015-05-28 14:34:38 -04:00
Sam Lantinga cb24f4de94 Fixed bug 2772 - SDL2 doesn't handle X KeymapNotify events
Jason Wyatt

Currently the keymapnotify event handling is commented out as FIXME in SDL_x11events.c (It looks like this may have functioned SDL1.2).

Not handling this event means that if a window manager shortcut such as ALT+SPACE is used, SDL will send an ALT key down signal, but not an up signal. Also querying SDL about the key state, it believes the ALT key remains pressed.
X passes the events keypress (alt), ?focusout?, ?focusin?, keymapnotify.
2015-05-28 10:44:46 -07:00
Ryan C. Gordon aa4952fdef Added SDL_WINDOWEVENT_HIT_TEST.
This lets windows know when they are dropping a mouse event because their
hit test reported something other than SDL_HITTEST_NORMAL. It lets them know
exactly where in the event queue this happened.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2015-04-21 10:10:59 -04:00
Ryan C. Gordon d4aedf9951 Added SDL_SetWindowModalFor().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2015-04-21 09:45:58 -04:00
Ryan C. Gordon e497e46515 Added SDL_SetWindowInputFocus().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:28:56 -05:00
Ryan C. Gordon 3bdaf4c611 Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity().
This is currently implemented for X11, Cocoa, Windows, and DirectFB.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:46:10 -05:00
Ryan C. Gordon 5696e88e6b Added SDL_GetWindowBordersSize().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:29:06 -05:00
Ryan C. Gordon f9af0c0376 x11: Put a matching window_group wmhint on every window created.
This is useful to the Window Manager, so it can know to associate multiple SDL
windows with a single app.
2016-01-05 02:27:26 -05:00
Ryan C. Gordon 8e855f2fbc Added SDL_DROPBEGIN and SDL_DROPCOMPLETE events, plus window IDs for drops.
This allows an app to know when a set of drops are coming in a grouping of
some sort (for example, a user selected multiple files and dropped them all
on the window with a single drag), and when that set is complete.

This also adds a window ID to the drop events, so the app can determine to
which window a given drop was delivered. For application-level drops (for
example, you launched an app by dropping a file on its icon), the window ID
will be zero.
2016-01-05 01:42:00 -05:00
Ryan C. Gordon f2defe5e11 Added special window type flags.
Specifically: always on top, skip taskbar, tooltip, utility, and popup menu.

This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 01:30:40 -05:00
Ryan C. Gordon f9b7379341 Added SDL_DROPTEXT event, for dragging and dropping string data.
This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:26:45 -05:00
Ryan C. Gordon c3114975db Added SDL_GetDisplayUsableBounds(). 2016-01-04 23:52:40 -05:00
Ryan C. Gordon 8875a4014f x11: Optimize SDL_GetGlobalMouseState() a little.
Use XInput2 to mark the global mouse state as dirty so we don't have to make
a bunch of roundtrips to the X server when nothing has changed.
2015-04-22 16:50:48 -04:00
Ryan C. Gordon 14e007772a x11: window managers might mark windows as FULLSCREEN _and_ MAXIMIZED.
This patch came from Unreal Engine 4's fork of SDL, compliments of Epic Games.
2015-04-21 10:14:17 -04:00
Ryan C. Gordon 9a7527988a x11: Workaround window managers that mark fullscreen windows as maximized.
This patch came from Unreal Engine 4's fork of SDL, compliments of Epic Games.
2015-04-21 01:22:32 -04:00
Ryan C. Gordon 81209acbd8 x11: Let apps specify that video init should fail if XRandR is unavailable.
Notably: it sets the error string to inform you that your custom SDL is built
without xrandr support, which apparently has been a support issue for
Unreal Engine 4 developers.
2016-01-04 23:44:27 -05:00
Ryan C. Gordon f9d478b6c3 x11: _NET_WM_PID needs a long, not a pid_t, I think. 2016-01-05 02:40:14 -05:00
Ryan C. Gordon 0c0ce2096c Updated comment: this is the correct way to do fullscreen on X11 now. 2015-04-21 10:19:20 -04:00
Ryan C. Gordon e0e04542d0 Added a few FIXMEs. 2015-04-21 09:46:48 -04:00
Ryan C. Gordon 15bc7aea64 Mac: allows apps to use OpenGL on a slower, integrated GPU.
This is often useful for SDL apps that aren't meant to be games: the
integrated GPU starts up faster, uses less power, and is often more than
fast enough.

Note that even with this change, the app will still default to the more
powerful, discrete GPU if one is available; an app that prefers the integrated
GPU will still need the NSSupportsAutomaticGraphicsSwitching key properly
set in its Info.plist and Mac OS X 10.7 or later.

https://developer.apple.com/library/mac/qa/qa1734/_index.html
2016-01-04 22:00:04 -05:00
Ryan C. Gordon 7678b1db88 Patch to compile on C89 compilers. 2016-01-04 16:36:42 -05:00
Ryan C. Gordon 6df5e1e535 x11: Support _NET_WM_USER_TIME and give _NET_ACTIVE_WINDOW a valid timestamp.
Fixes Bugzilla #3056.
2016-01-04 16:25:27 -05:00
Ryan C. Gordon fa8c83c1c1 Remove almost all instances of "volatile" keyword.
As Tiffany pointed out in Bugzilla, volatile is not useful for thread safety:

https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/

Some of these volatiles didn't need to be, some were otherwise protected by
spinlocks or mutexes, and some got moved over to SDL_atomic_t data, etc.

Fixes Bugzilla #3220.
2016-01-03 06:50:50 -05:00
Sam Lantinga e2fd1c0fe3 Backed out commit 80ce90dbc266, this causes Visual Studio build failure on buildbot 2016-01-02 11:17:06 -08:00
Sam Lantinga 68a3272852 Fixed sed error on Mac OS X and updated copyright on a few last files 2016-01-02 10:38:51 -08:00
Sam Lantinga ac444cd313 Fixed bug 3092 - Statically link sdl2 with /MT for msvc
Martin Gerhardy

According to https://msdn.microsoft.com/de-de/library/2kzt1wy3%28v=vs.120%29.aspx when one is using /MT for msvc compilations the libcmt.lib is already linked to the binary. This lib includes the symbol that is now guarded (see attached patch) by the #ifndef _MT.
2016-01-02 10:25:53 -08:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
David Ludwig 44c0b2da87 WinRT: minor code-comment cleanups 2015-12-31 01:54:11 -05:00
David Ludwig 6823a22162 WinRT: fixed bug whereby a Win8.x app's SDL_Window wasn't getting de-marked as maximized (on window restore) 2015-12-31 01:50:30 -05:00
David Ludwig d8aa066288 Fixed Bug 3217 - WinRT: after alt-tab'ing back into fullscreen app, mouse cursor is sometimes wrong 2015-12-31 01:40:50 -05:00
David Ludwig 854cf7ac40 Fixed Bug 3215 - Win32: 'fullscreen' app doesn't always extend to top of screen 2015-12-30 12:44:13 -05:00
Philipp Wiesemann c41feca5de Fixed a crash if creating accelerated renderer after accessing window surface.
Partially fixes Bugzilla #3196.
2015-12-29 19:13:56 +01:00
Ryan C. Gordon 696cd7975c NetBSD: fixed issues with cpuinfo and pthread_setname_np (thanks, Thomas!).
Fixes Bugzilla #3176.
2015-12-29 02:32:47 -05:00
Ryan C. Gordon ce0f90ffb9 NetBSD: improved joystick support (thanks, Thomas!).
This patch skips non-joystick HID devices and gives joysticks on NetBSD
a human readable name.

Fixes Bugzilla #3178.
2015-12-29 02:29:56 -05:00
Ryan C. Gordon 18c7d6df21 XRandR: fixed primary output detection logic (thanks, "winterknight"!).
Fixes Bugzilla #3185.
2015-12-29 02:16:14 -05:00
Ryan C. Gordon 326b357804 Mac: don't ignore mouse clicks on the top pixel of a window (thanks, Joshua!).
Fixes Bugzilla #3190.
2015-12-29 01:09:58 -05:00
Ryan C. Gordon f893ce3d3e OpenGL+GLES renderers: Fixed incorrect clip rectangle coords (thanks, Marcel!).
Fixes Bugzilla #2700.
2015-12-28 15:15:58 -05:00
Alex Szpakowski 4ae69e3222 Mac: expose joystick buttons that report themselves as having 'Start' and 'Select' HID usages.
I don't know if any joysticks report those usages for any buttons in practice, but other prominent Mac gaming software exposes them, so we might as well too.
2015-12-28 15:44:09 -04:00
Ryan C. Gordon 51c1d69d13 Mac: Whoops, lost legit Caps lock keypress events. Fixed. 2015-12-28 13:30:58 -05:00
Ryan C. Gordon fd6b435c6a Windows: resync num/caps lock when window is gaining focus. 2015-12-28 13:08:19 -05:00
Ryan C. Gordon 257b7af247 Sync up the caps/numlock state properly without sending key events.
Partially fixes Bugzilla #2736 and #3125.
2015-12-28 13:07:44 -05:00
Ryan C. Gordon d3b323f89d Mac: Fix keyboard state if capslock was toggled while app wasn't in foreground. 2015-12-27 23:39:43 -05:00
David Ludwig fa7c15ce1f WinRT: made bug 3202/3213's fix apply for WinRT apps 2015-12-27 22:26:27 -05:00
Ryan C. Gordon 2befe01d39 Removed a tabstop. 2015-12-27 18:56:46 -05:00
Ryan C. Gordon 6a2e8a7a90 Win: make sure SDL keyboard state reflects system capslock state at startup. 2015-12-27 18:48:14 -05:00
David Ludwig 9e9ef5ad31 Fixed bug 3202 - Fix renderer visibility on a window maximized directly from the minimized state
Many thanks to id.zeta for details on the bug, and for the fix!
2015-12-27 17:55:45 -05:00
Ryan C. Gordon faed05850e Mac: make sure SDL keyboard state reflects system capslock state at startup. 2015-12-27 16:46:12 -05:00
David Ludwig 8281cc72ba WinRT: Fixed bug 3210, "alt-tab doesn't work correctly with full-screened, UWP (Win10 Store) apps" 2015-12-22 00:58:47 -05:00
Sam Lantinga 8ddcc63ac7 sdl:
xaudio2 is not linked against sdl but the sdk already handles dynamically loading (XAudio2Create is inlined and just loads a com object). Updated SDL_xaudio2.c
2015-12-18 18:49:35 -08:00
Alex Szpakowski 4026980917 Cleaned up some code formatting. 2015-12-18 00:49:27 -04:00
Alex Szpakowski cb15bb4cfa iOS: Set the player index of MFi gamepads when the user first presses a button, rather than when it's programatically opened. 2015-12-11 16:41:59 -04:00
Alex Szpakowski a2235d7b29 Cocoa: Use NSTextInputClient instead of NSTextInput for text input handling. The latter was deprecated in OS X 10.6. 2015-12-10 22:17:22 -04:00
Alex Szpakowski 0c463d770b SDL_GL_GetAttribute: If a GL context isn't active, only return failure when the specified attribute needs an active GL context to be queried. 2015-12-10 20:25:34 -04:00
David Ludwig f2f435ee45 WinRT: fixed bug: Back button(s) weren't working on Win10
Many thanks go to Sylvain Becker for providing details on the fix!
2015-12-09 21:34:56 -05:00
Sam Lantinga d1e6a2ebe6 Added broad support for wireless XBox 360 controllers on Linux 2015-12-09 12:11:40 -08:00
David Ludwig 976bc9a919 WinRT: build fix for Windows Phone 8.0 2015-12-06 18:48:46 -05:00
David Ludwig 2b48481879 WinRT: enabled the Win10-Store Cert Kit bug-workaround, for Windows 8.0 apps 2015-12-06 18:42:30 -05:00
David Ludwig a40d49aa1c WinRT: enabled the Win10-Store Cert Kit bug-workaround, for Windows 8.1 apps 2015-12-06 18:33:43 -05:00
David Ludwig 898054a179 WinRT: fixed a build error when compiling Windows 8.1 .dlls 2015-12-06 17:32:33 -05:00
David Ludwig c8e3bfbf54 WinRT: removed an unused variable from DXGI-based display-detection code 2015-12-06 17:07:37 -05:00
David Ludwig 781455fd8b WinRT: workaround for a possible bug in the Win10 Store's Certification Kit
DXGI fails to report any displays in at least one of the
"Windows App Certification Kit 10.0"'s tests for Store Apps.  This was
causing SDL's video initialization code to fail, when the suspect test
("Direct3D Feature Test") was run, as DXGI was unable to report a
display-output at adapter-index 0, output-index 0.

The workaround that is applied here attempts to detect this case, then
use a hopefully-reasonable alternative means to calculate at least one
display output.
2015-12-06 17:06:40 -05:00
Philipp Wiesemann 57f2f3baf3 Windows: Added missing NULL check after SDL_stack_alloc().
SDL_stack_alloc() might wrap SDL_malloc() which can return NULL.
2015-12-06 17:51:11 +01:00
Philipp Wiesemann 32147ba780 X11: Fixed memory leak when initializing multiple screens. 2015-12-05 17:08:07 +01:00
Edward Rudd 9394953400 Add Logitech F510 Gamepad Direct input mode mapping 2015-11-30 10:39:34 -05:00
Alex Szpakowski 6a50d33385 Removed some debug prints. 2015-11-30 03:30:35 -04:00
Alex Szpakowski 9ddc6c3441 Mac: Fixed SDL_SetWindowFullscreen not restoring the window's original size when exiting a Space. 2015-11-30 03:30:07 -04:00
David Ludwig 25abce513d WinRT: added Win10/UWP (Universal Windows Platform) support
"UWP" appears to be Microsoft's new name for WinRT/Windows-Store APIs.

This set of changes updates SDL's WinRT backends to support the Win10 flavor
of WinRT.  It has been tested on Win10 on a desktop.  In theory, it should
also support Win10 on other devices (phone, Xbox One, etc.), however further
patches may be necessary.

This adds:
- a set of MSVC 2015 project files, for use in creating UWP apps
- modifications to various pieces of SDL, in order to compile via MSVC 2015 +
  the Win10 API set
- enables SDL_Window resizing and programmatic-fullscreen toggling, when using
  the WinRT backend
- WinRT README updates
2015-11-29 19:33:11 -05:00
David Ludwig fa2d5ab497 WinRT: bug-fix - SDL_SetThreadPriority() didn't work on WinRT 8.x platforms
WinRT 8.0 (Phone and non-Phone) didn't offer an API to set an already-created
thread's priority.  WinRT 8.1 offered this API, along with several other
Win32 thread functions that were previously unavailable (in WinRT).

This change makes WinRT 8.1+ platforms use SDL's Win32 backend.
2015-11-26 13:51:03 -05:00
David Ludwig d07aa877d2 WinRT: minor code cleanup in window-creation code
Window flags can be detected on all WinRT platforms.
2015-11-26 11:15:43 -05:00
David Ludwig a70fe9a53e WinRT: native windows are inherently resizable (in WinRT 8.x) 2015-11-26 11:09:50 -05:00
David Ludwig 7bd640d5da WinRT: bug-fix, fullscreen mode wasn't getting reported in Windows 8.0 apps
This bug did not occur in Windows 8.1 apps, just Windows 8.0.
2015-11-26 02:37:51 -05:00
David Ludwig 36090f576f WinRT: bug-fix, OpenGLES2 was failing to init, after recent windowing fixes
Some SDL_Window flags were getting lost inside WINRT_UpdateWindowFlags, namely
SDL_WINDOW_OPENGL.
2015-11-26 02:13:15 -05:00
David Ludwig f520994455 WinRT: bug-fix, fullscreen window flags weren't set if device was rotated 90 degrees 2015-11-26 01:36:36 -05:00
David Ludwig 623898f70b WinRT: lots of display and windowing related fixes
This change-set fixes a lot of windowing related bugs, especially with
regards to Windows 8.x apps running on Windows 10 (which was the driver for
this work).  The primary fixes include:
* listed display modes were wrong, especially when launching apps into a
  non-fullscreen space
* reported window flags were often wrong, especially on Windows 10
* fullscreen/windowed mode switches weren't failing (they are not
  programmatically possible in Win 8.x apps).
2015-11-26 00:41:39 -05:00
David Ludwig a5a80cd033 WinRT: fixed crash in SDL_CondWaitTimeout, when using Win10's MSVC runtime 2015-11-15 13:04:42 -05:00
Ryan C. Gordon 5224dfcc9a X11: Let XRandR respect multiple screens (DISPLAY=:0.0 vs :0.1, etc). 2015-11-17 12:15:35 -05:00
Sam Lantinga 11f2a9f8c4 Fixed bug 3168 - xinput build failure with dxsdk
Ozkan Sezer

Yes, the annotations can actually be removed.  They are used only by MSVC and aren't vital.
2015-11-16 21:20:38 -08:00
David Ludwig dc804c0e1a WinRT: fixed build error in latest XInput code
This change has also been tested as buildable + runnable on Win32 + MSVC 2015,
2013, 2012, and 2010.  It may fix similar build errors (in XInput code) that
are appearing in MingW builds (on buildbot).
2015-11-14 21:29:14 -05:00
Ryan C. Gordon e6ad29aec8 Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID(). 2015-11-14 12:35:45 -05:00
Alex Szpakowski 998a54f9c5 Mac: Fix a warning about implicit declaration of SDL_SendKeymapChangedEvent (bug #3167.) 2015-11-14 04:24:39 -04:00
Sam Lantinga dee61c5a30 Added support for the Gamestop Logic3 Controller 2015-11-13 14:26:00 -08:00
Alex Szpakowski 2816d4477d Mac: Added SDL_GameController mappings for the Steelseries Stratus XL and Nimbus gamepads. 2015-11-12 22:53:37 -04:00
Alex Szpakowski 9c51c4a639 Mac: Detect the d-pad and pause buttons on Steelseries MFi gamepads (bug #3124.) 2015-11-12 22:44:32 -04:00
Alex Szpakowski 7267835842 iOS: Fixed crashes when rotating the screen after destroying a window. 2015-11-12 20:58:11 -04:00
Sam Lantinga faee628941 Added Linux support for the Razer Sabertooth game controller 2015-11-12 13:13:36 -08:00
Alex Szpakowski 0da59802aa iOS: Set the 'player index' of MFi game controllers when they're opened for use.
MFi controllers display their player index via LEDs on the controller.
2015-11-09 18:13:47 -04:00
Alex Szpakowski 84f6bc41b8 iOS: Fixed MFi game controller triggers to report the proper range of values. 2015-11-09 17:41:54 -04:00
Sam Lantinga 5103ae9fd6 one last SDL fix: restore menu bar if we destroy a fullscreen window without transitioning it back to a non-fullscreen window first 2015-11-09 08:55:07 -08:00
Sam Lantinga ebfb2ecb68 don't toggle SDL fullscreen state on OSX if we're destroying the window 2015-11-09 08:55:01 -08:00
Sam Lantinga eeddb7c534 more SDL fullscreen state tracking fixes, don't update fullscreen flags on failure to change fullscreen state 2015-11-09 08:54:56 -08:00
Sam Lantinga 792354d6f0 SDL OSX implementation must account for the fact that going fullscreen can fail. improve the logic around retrying, make a few attempts before failing. 2015-11-09 08:54:49 -08:00
Sam Lantinga 2d884656c4 add hacky support for failed fullscreen transitions. SDL doesn't have the concept of a fullscreen transition that failed. if the user is actively changing spaces while the app goes fullscreen, it fails to go fullscreen; now it will just try again instead of hanging around with the wrong window styles. 2015-11-09 08:54:42 -08:00
Alex Szpakowski 7ce64372c8 iOS MFi game controllers: inverted the thumbstick y axis values to match the behavior of other controllers. 2015-11-09 02:32:37 -04:00
Sam Lantinga cef2242025 Added Linux binding for Wii-U Pro controller 2015-11-05 18:10:19 -08:00
Sam Lantinga 38edc1779a Add SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling
_NET_WM_PING protocol handling in CreateWindow if
desired.
2015-10-27 11:18:04 -07:00
Sam Lantinga 2b0140a91f Add a new SDL_KEYMAPCHANGED SDL event to abstract notification of keyboard layout or input language changes. 2015-10-27 11:17:32 -07:00
Alex Szpakowski f8824cb99b Mac: Fix returning to the window's Space in OS X 10.11+ when SDL_WINDOW_FULLSCREEN_DESKTOP is used (bug #3152.) 2015-10-23 03:37:53 -03:00
Philipp Wiesemann 4c72d39ce7 D3D11: Fixed SDL_RenderDrawPoints() ignoring input after the first 128 points.
If a limit would be needed then count should be adapted before stack allocation.
2015-10-15 22:26:21 +02:00
Philipp Wiesemann 86711041f2 Android: Added new key codes without mapping. 2015-10-07 21:16:18 +02:00
Sam Lantinga 5b1741132f Converted tabs to spaces for SDL style 2015-10-06 21:40:50 -07:00
Sam Lantinga 9bd640e1a0 Fixed sending a size event while setting up a window (fix for DOTA 2 on Source 2) 2015-10-06 21:16:21 -07:00
Ryan C. Gordon c5e68d68e7 Mac: Reset display if going from fullscreen to a fullscreen Space or vice-versa.
Otherwise, bad things happen.
2015-10-06 00:10:54 -04:00
Sam Lantinga 7bc72eaf84 Fixed forcing the window size when creating a non-resizable window on Windows. 2015-10-01 11:21:06 -07:00
Sam Lantinga 667783ba88 Fixed swapped Windows and Linux entries for the Cideko AK08b 2015-09-30 16:00:21 -07:00
Sam Lantinga a0c4b56ff9 SDL - added new SDL_JoystickCurrentPowerLevel() API that returns the battery level of the selected joystick. Currently only implemented for XInput devices, other platforms are a TODO.
CR: Sam
2015-09-30 15:39:30 -07:00
Sam Lantinga c2f0394831 Fix crash on controller hotplug on linux.
CR: Sam
2015-09-30 15:38:30 -07:00
Sam Lantinga e015140af3 SDL - add dynapi entry points for SDL_JoystickCurrentPowerLevel 2015-09-30 15:38:18 -07:00
Sam Lantinga ed23a3f887 Added support for the Cideko AK08b 2015-09-30 15:33:33 -07:00
Philipp Wiesemann 10daf1f4d3 Android: Removed three internal functions not used by SDL.
They were not needed internally since the switch to the common EGL backend.

Thanks to the SDL mailing list for pointing out that the functions seem unused.
2015-09-27 20:12:47 +02:00
Alex Szpakowski ab2a350033 iOS: show message boxes using the new UIAlertController APIs when supported, rather than the deprecated UIAlertView.
UIAlertController is also supported on tvOS, whereas UIAlertView is not.
2015-09-25 15:17:20 -03:00
Philipp Wiesemann 774b077513 iOS: Fixed pointer dereference after free. 2015-09-21 21:19:37 +02:00
Alex Szpakowski 2bf6f1bcb7 Added initial support for MFi game controllers on iOS. 2015-09-20 23:08:36 -03:00
Philipp Wiesemann efad04c317 Android: Added check if Java method for APK expansion file exists. 2015-09-18 21:26:46 +02:00
Philipp Wiesemann 6e7c479ec2 Android: Fixed trying to read from APK expansion files without version hint set.
This also fixed overwriting the asset error message which is more useful if no
APK expansion files are available and the requested file was not found.
2015-09-17 22:30:24 +02:00
Philipp Wiesemann 92ca42d940 Android: Renamed SDLActivity's Java method used for APK expansion files.
The name was not correct.
2015-09-17 22:24:54 +02:00
Alex Szpakowski ecfdb10cfa iOS SDL_GL_CreateContext: Clamp the multisample sample count when the requested value is too high, rather than failing to create the context.
This matches the SDL_GL_CreateContext behavior in OS X.
2015-09-15 00:25:07 -03:00
Alex Szpakowski a506f1cbc7 Windows: Try to use xinput9_1_0.dll if XInput 1.4 and 1.3 are not available.
XInput "9.1.0" ships with Windows Vista and 7 systems, but it lacks some features, including support for detecting Guide button presses.
2015-09-14 22:50:55 -03:00
Alex Szpakowski 76fc378837 Fixed the header guard in the darwin SDL_sysjoystick_c.h file. 2015-09-14 22:44:20 -03:00
Sam Lantinga 08ce12c4e3 Fixed divide by zero if the application has run out of GDI handles and is trying to show an error dialog 2015-09-14 11:15:25 -07:00
Ryan C. Gordon 4295a6fe47 Mac: Fixed off-by-one bug when plugging in a joystick (thanks, Konstantin!). 2015-09-13 11:29:45 -04:00
Alex Szpakowski 82c8825cb5 iOS: Added support for force-touch on capable devices. 2015-09-09 19:08:52 -03:00
Alex Szpakowski 6a32ca7a39 Mac: Fixed SDL_SetWindowSize to set the size of the content area of the window, rather than the total size including decorations. 2015-09-09 13:55:11 -03:00
Philipp Wiesemann e8757e873e Android: Changed return type of four JNI functions from int to jint. 2015-09-05 20:21:52 +02:00
Philipp Wiesemann 212e99633b PSP: Replaced use of SDLKey with SDL_Keycode. 2015-08-24 22:35:01 +02:00
Philipp Wiesemann 991feafa09 PSP: Fixed a syntax error.
Found by Cppcheck.
2015-08-24 22:31:36 +02:00
Philipp Wiesemann 0856a7ef34 Changed an error return value from 0 to NULL for consistency. 2015-08-21 23:50:37 +02:00
Philipp Wiesemann 98986f39e9 Removed not needed call to pthread_attr_getstacksize() for SDL_CreateThread(). 2015-08-15 21:21:29 +02:00
Ryan C. Gordon 8145760314 X11: Handle keyboard layout changing during app's run on Ubuntu 12.04 (etc).
Fixes Bugzilla #3050 (in addition to Jason Wyatt's patch, prior to this).
2015-08-15 00:36:39 -04:00
Ryan C. Gordon 0d8c3a0b76 Patched to compile. 2015-08-14 23:38:40 -04:00
Ryan C. Gordon 0cf81fbdf9 Minor coding convention fix. 2015-08-14 23:30:46 -04:00
Jason Wyatt fb37956d9b Supply current group when translating X11 Keycodes to Keysyms. 2015-08-14 16:23:31 +01:00
Ryan C. Gordon 9e2b90e2a4 Cocoa: Keep the window's screen position through SDL_SetWindowSize().
The Y coordinate is flipped in Cocoa, so if you change the height, the window
will move and maybe clip against the screen edge if you don't adjust its Y
coordinate to match.

Possibly fixes Bugzilla #3066.
2015-08-14 01:20:41 -04:00
Ryan C. Gordon f2f8e6f5ef X11: only send mouse button up events if not a mousewheel "button"
(Brackets in the wrong place, my bad!)
2015-08-13 21:40:32 -04:00
Ryan C. Gordon 874bf86504 X11: Simplified mousewheel event handling.
Under load, this would race and report an incorrect mouse button event instead
of a wheel event.

Fixes Bugzilla #2987.
2015-08-13 17:40:28 -04:00
Ryan C. Gordon da6f2221e3 X11: isConfigureNotify() isn't used at the moment, comment it out. 2015-08-13 17:37:09 -04:00
Ryan C. Gordon 8a1fd98261 X11: don't block on a ConfigureNotify event during SDL_SetWindowBordered().
Unity's window manager is (legitimately, since it moves the client window's
position) sending one, and SDL was incorrectly trying to mask it out. Other
window managers (KWin, apparently) don't move the window and would hang here
indefinitely.

Fixes Bugzilla #3052.
2015-08-13 14:56:16 -04:00
Philipp Wiesemann 3362c9f196 Emscripten: Changed return -1 after SDL_SetError() to return SDL_SetError(). 2015-08-09 20:00:51 +02:00
Ryan C. Gordon c67213f331 X11: Fixed XRandR display detection.
Previously this only worked on X11 when Xinerama was carrying the weight.

Fixes Bugzilla #3062.
2015-08-07 01:02:35 -04:00
Ryan C. Gordon ca46804210 X11: Fixed a memory leak when adding duplicate display modes. 2015-08-07 00:59:31 -04:00
Philipp Wiesemann fcc5940935 Emscripten: Added missing error messages for audio and joystick init failures. 2015-08-05 21:04:10 +02:00
andrewb a702c338f0 Add SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 to SDL so that Reborn can keep running through Alt+F4. 2015-08-03 11:37:03 -07:00
Sam Lantinga 270f38db08 Fixed bug 3083 - Android JNIEXPORT and JNICALL missing
Martin Gerhardy

Just a minor thing, but a huge outcome. All the other jni related functions already have those flags, but the nativeInit function lacks them - so it might be stripped away.
2015-08-01 22:03:50 -07:00
Alex Szpakowski 5a3cc7f580 EGL: Added support for sRGB system framebuffers, when the required EGL extension is present. 2015-08-01 15:16:57 -03:00
Philipp Wiesemann c57f409fe8 Mac: Fixed check for SDL_HINT_MAC_BACKGROUND_APP. 2015-07-31 20:16:58 +02:00
Alfred Reynolds 0aa2a6df2c SDL
- fix hint check, we want or not and
2015-07-31 09:16:21 -07:00
Sam Lantinga e93f90ae90 Trivial integer truncation warning fixes. 2015-07-30 10:01:04 -07:00
Alfred Reynolds 628d8edb95 SDL
- add a new SDL_HINT_MAC_BACKGROUND_APP hint, when set or set to 1 don't force the app to be foreground
2015-07-29 17:19:15 -07:00
Alfred Reynolds 5aaf81c84e Fix up monitor enumeration for Windows 8.1 case. 2015-07-29 17:19:13 -07:00
Alfred Reynolds e09d95c36a Fix SDL_GetWindowPosition to be properly monitor-aware and return the monitor x,y when fullscreened. 2015-07-29 17:19:11 -07:00
Alfred Reynolds b0e145b3e1 Move GetDisplayDPI to the end of the file. 2015-07-29 17:19:06 -07:00
Alfred Reynolds dc2e9ba13b Fix build. 2015-07-29 17:19:04 -07:00
Alfred Reynolds 51c72e10f7 Add X11 implementation of SDL_GetDisplayDPI. 2015-07-29 17:19:02 -07:00
Alfred Reynolds 61c7415071 Add SDL_GetDisplayDPI routine and implement for Windows. 2015-07-29 17:18:56 -07:00
Ryan C. Gordon f5cf86769a x11: Catch fatal X errors when calling glXMakeCurrent().
In extremely rare cases, probably due to misconfigured drivers, one might
see this happen, and rather than terminate the process, we try to recover
by reporting an error to the app.

Fixes Bugzilla #3068.
2015-07-28 00:12:50 -04:00
Alex Szpakowski c344b734f4 iOS: Avoid generating an OpenGL error (but still fail to create the context) if the specified MSAA sample count is unsupported. 2015-07-19 19:56:16 -03:00
Alex Szpakowski 6ea942dae3 Added MSAA support for OpenGL ES contexts on iOS.
Note that extra steps must be taken when using glReadPixels to read the contents of the main OpenGL ES framebuffer on iOS, if multisampling is used. See the OpenGL ES section of README-ios.md for details.
2015-07-19 19:44:40 -03:00
Ryan C. Gordon b24586309c Fixed dynapi for new SDL_WarpMouseGlobal() function signature. 2015-07-18 00:04:49 -04:00
Ryan C. Gordon 9d3d643742 Patched to compile on Raspberry Pi. 2015-07-18 00:03:34 -04:00
Ryan C. Gordon e346f14277 SDL_WarpMouseGlobal() should return non-void.
There are platforms it isn't implemented on (and currently can't be
implemented on!), and there's currently no way for an app to know this.

This shouldn't break ABI on apps that moved to a revision between 2.0.3 and
2.0.4.
2015-07-17 21:03:58 -04:00
Philipp Wiesemann 16e18817e9 Windows: Fixed wrong debugger output if logging empty string as info or warning. 2015-07-16 21:31:21 +02:00
Philipp Wiesemann 2919905620 PSP: Fixed error handling in SDL_SemWaitTimeout().
Signed integers were converted to unsigned before being checked if smaller 0.

Found by Cppcheck.
2015-07-15 21:11:24 +02:00
Ryan C. Gordon 27055ea0ad X11: center parentless message boxes on the primary display if possible.
This relies on a successful SDL_Init(SDL_INIT_VIDEO) to work, since it's
silly to reproduce all the Xinerama/XRandR code in the message box parts. If
X11 is available but SDL hasn't been initialized, the message box will center
in the primary screen, which will be positioned weirdly on multi-head setups,
but this should fix the most significant common case.
2015-07-14 23:46:35 -04:00
Ryan C. Gordon 0c19501eeb x11: Patched to compile on systems without the Xutf8LookupString() function. 2015-07-11 00:59:56 -04:00
Philipp Wiesemann 4679195dbf Fixed memory leak in test harness.
Found by Cppcheck.
2015-07-06 21:02:20 +02:00
Sam Lantinga 396b3b8992 Better fix for bug 3048, don't crash if the window title is NULL 2015-07-05 15:45:48 -07:00
David Ludwig d0ba0c1d8a Fixed bug 3048, "Crashes in Cocoa_SetWindowTitle" 2015-07-04 21:04:49 -04:00
Ryan C. Gordon 65a1a3e7e9 Cocoa: support drag-and-drop of multiple objects. 2015-07-04 14:09:09 -04:00
Sam Lantinga b5c43a88b4 Fixed style 2015-07-03 09:18:14 -07:00
Sam Lantinga 35c4468f9d commit a7d7af2a419b453188ffe87386455fc26c1306fa
Author: Benoit Pierre <benoit.pierre@gmail.com>
Date:   Fri Jul 3 02:17:10 2015 +0200

    fix 14dd48ae5bc43b61b2a0dd0b3177d22edec707ef regression

    The window manager detection code in X11_HasWindowManager does not work
    with Awesome (http://awesome.naquadah.org/). Remove it, and reuse the
    result of the more correct checks in X11_CheckWindowManager.
2015-07-03 09:17:24 -07:00
Philipp Wiesemann 26ecab9010 Removed redundant variable check when processing gestures. 2015-07-01 21:10:54 +02:00
Sam Lantinga e8954d5d8c Hack to fix missing window decorations after toggling fullscreen mode in Mac OS X 10.10 2015-06-30 19:30:02 -07:00
Ryan C. Gordon 1e3c28ac64 X11: Added a test for a weird X11 error we get with Xinerama, rarely. 2015-06-30 15:00:48 -04:00
Ryan C. Gordon 20ec137763 X11: Call XRefreshKeyboardMapping() when we get various MappingNotify events.
According to the Xlib docs, you need to do this or Xlib's internal state gets
out of sync.
2015-06-30 14:41:17 -04:00
Ryan C. Gordon acdb494ffd X11: Don't ignore keyboard mapping changes.
MappingNotify events don't have a window associated with them, so SDL was
dropping these before the point where we would have handled them.
2015-06-30 14:39:39 -04:00
Ryan C. Gordon 4986563d2f Fixed assertion failure in diskaudio target caused by new hotplugging support.
Fixes Bugzilla #3032.
2015-06-30 13:46:06 -04:00
Sam Lantinga f1b7a8434f Fixed compiling if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM is not defined 2015-06-25 07:17:08 -07:00
Sam Lantinga 3a08b46336 Fixed bug 2834 - Patch to support dead keys on Windows
Elise Maurer

When inputting text, dead-keys are currently not handled correctly on Windows with the latest SDL2 tip as well as the 2.0.3 release.

Using a French AZERTY keyboard, when I type the `^` key followed by `e` key to compose the `` character, I erroneously get two SDL_TEXTINPUT events, one with the `^` character and one with the `e` character.

I've looked at the history for SDL_windowsevents.c and there's been some back-and-forth with several methods for handling text input:

  * r8142 removed any handling of WM_CHAR because keyboard input was being handled through WM_KEYDOWN along with ToUnicode since r7645.

  * But using ToUnicode actually breaks dead-keys (googling for "ToUnicode dead keys" reports many horror stories of people trying to work around that and failing).

  * It seems like r7645 introduced a double-fix: it fixed WM_CHAR to properly handle Unicode, and also (unnecessarily?) added text input handling to WM_KEYDOWN. Later, r8142 removed the WM_CHAR stuff instead of the WM_KEYDOWN stuff.

The attached patch restores handling of text input through WM_CHAR and removes it from WM_KEYDOWN. I've tested it with French, English and Russian layouts and it seems to do its job. Obviously, with such matters, it's still a risky change.
2015-06-25 11:49:48 -07:00
Sam Lantinga 82eec4b630 Fixed whitespace in SDL_evdev.c 2015-06-24 17:55:38 -07:00
Sam Lantinga 9f50d63dd5 Fixed an issue with mouse/keyboard removal
Sometimes, on removal SDL_EVDEV_udev_callback() gets called with zero udev_class. This in turn seems to be caused the SDL_udev.c:guess_device_class() failing to find the attributes of the parent device.

Apparently this is normal, attributes are not guaranteed to be in place during removal, depending on timing. This lack of attributes causes guess_device_class() to return zero.

This fix mimics the code in linux/SDL_sysjoystick.c:joystick_udev_callback() which effectively has the same fix already in place.
2015-06-24 17:54:39 -07:00
Alfred Reynolds cbbdd27ad3 SDL
- disable compiling in XAudio2 support. We both need the DX SDK to make this code plus we need to work out the runtime dependency problem this code bring in on windows (needing the DX runtime installed).

CR: SamL
2015-06-24 10:56:51 -07:00
Alfred Reynolds e4e4e1b82a SDL
- do the scancode to keyboard code lookup for the grave key, so that we can show users the correct keyface for the key, rather than forcing it to "`".  Note that if a game is using SDLK_* for its KB mapping then after this change on some keyboards the top left key will no longer be mapped correctly with the old data.

CR: SamL
2015-06-24 10:56:37 -07:00
Sam Lantinga b7aa856c8f Fixed bug 3030 - SDL_RecreateWindow fails to restore title, icon, etc.
Adam M.

It loses the title and icon when window recreation fails. For instance, this may happen when trying to create an OpenGL ES window on a system that doesn't support it. But at that point, the title and icon have already been lost.
2015-06-22 23:36:06 -07:00
Ryan C. Gordon ded3a16e72 Fixed compiler warning about shadowed local variables. 2015-06-23 01:44:44 -04:00
Philipp Wiesemann 8cea1b986e Windows: Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 19:37:37 +02:00
Philipp Wiesemann 72590685c0 Backed out changeset 4ad56dbf4a6f 2015-06-21 19:36:35 +02:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00
Eric Wing 7d5147bad3 resync'd overscan patch with SDL mainline. 2015-04-17 21:25:19 -07:00
Philipp Wiesemann 5a578a0783 Fixed return value of SDL_SaveBMP_RW() depending on set errors after NULL input.
If SDL_SaveBMP_RW() was called with NULL passed as SDL_RWops argument, different
values were returned depending on SDL_GetError(). If no error was set before the
call (or SDL_ClearError() was called) then 0 was returned. This is wrong because
nothing was saved. If an error was set before the call then -1 was returned.

This was fixed by directly returning -1 for NULL input instead of deciding based
on SDL_GetError(). No new error is set because this would otherwise override a
maybe more useful error set in SDL_RWFromFile() which is used by SDL_SaveBMP().
2015-04-16 22:04:35 +02:00
Philipp Wiesemann db878a4336 Linux: Removed not needed platform info from two entries of controller database.
Not needed because entries of this file are selected by conditional compilation.
2015-04-16 22:02:03 +02:00
Philipp Wiesemann 3e1d36299a Fixed typo in internal joystick documentation comments. 2015-04-15 21:29:55 +02:00
Philipp Wiesemann e6b7b38c6c Emscripten: Simplified implementation of joystick update function.
The function was implemented using four loops but only needed two.
2015-04-15 21:27:10 +02:00
Philipp Wiesemann 86fb92a7da Emscripten: Fixed memory leak if SDL_GetPrefPath() failed. 2015-04-15 21:25:15 +02:00
Philipp Wiesemann 0fbd3372d4 WinRT: Fixed format string for error message. 2015-04-13 20:52:18 +02:00
Ryan C. Gordon 3a0270593e Patched to compile on C89 compilers. 2015-04-12 21:02:21 -04:00
Ryan C. Gordon c539b3f9e9 Make X11 and Wayland ProcessHitTest() code less verbose. 2015-04-12 20:59:48 -04:00
Ryan C. Gordon d10201be08 Implemented SetWindowHitTest() for Wayland (thanks, x414e54!).
Fixes Bugzilla #2941.
2015-04-12 20:40:06 -04:00
Alex Szpakowski a27fad1e24 Fixed orientation issues in the iOS extended launch screen. 2015-04-12 01:50:28 -03:00
Alex Szpakowski fe6c797cad Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called. 2015-04-10 23:30:31 -03:00
David Ludwig a6df21cd00 Partial fix for bug 2726 - Win32 'mouse' events not applying 'SDL_TOUCH_MOUSEID'
This is a Win32-specific fix for bug 2726.  A WinRT fix for this bug was applied
separately, via https://hg.libsdl.org/SDL/rev/91f56dcad879

This fix applies SDL_TOUCH_MOUSEID to 'mouse' events coming from touch devices,
but only when relative-mouse-mode is turned OFF.  This bug is still present
when relative-mouse-mode is ON, however Microsoft does not provide documentation
on whether or not those input events (which come from WM_INPUT) can be
identified as touch-specific or not.  Unofficially, that data might be available
(via GetMessageExtraInfo()), however this patch only uses MS-documented APIs.
2014-12-20 11:45:39 -05:00
Sam Lantinga 719bb6fcee Fixed X11 build, added code to print initial modifiers to checkkeys 2015-05-28 09:52:48 -07:00
Sam Lantinga 0694baf260 Fixed bug 2736 - X11 doesn't set KMOD_NUM and KMOD_CAPS to system state
Zack Middleton

Using X11 (on Debian Wheezy), SDL_GetModState() & KMOD_NUM and KMOD_CAPS are not set to system state (numlock/capslock LEDs). Pressing numlock or capslock toggles the mod state, though if num/caps lock is enabled before starting the program it's still reversed from system state. This makes getting KMOD_NUM and KMOD_CAPS in programs unreliable. This can be seen using the checkkeys test program.

The function that appears to have handle this in SDL 1.2 is X11_SetKeyboardState. The function call is commented out with "FIXME:" in SDL 2.

Using Windows backend through WINE; on first key press if numlock and/or capslock is enabled on system, numlock/capslock SDL_SendKeyboardKey is run and toggles KMOD_NUM/KMOD_CAPS to the correct state. On X11 this does not happen.

The attached patch makes X11 backend set keyboard state on window focus if no window was previously focused. It sets all keys to system up/down state and toggles KMOD_NUM/KMOD_CAPS via SDL_SendKeyboardKey to match system if needed. The patch is based on SDL 1.2's X11_SetKeyboardState.
2015-05-28 09:33:47 -07:00
Sam Lantinga 779d403563 Fixed Windows build 2015-05-28 08:51:59 -07:00
Sam Lantinga 0669a224f5 Fixed bug 2860 - SetProp must be paired with RemoveProp especially for properties added to external windows
Coriiander

Upon creating a window, a window property is added to it through the Win32-function "SetProp". This is done in the SDL-function "SetupWindowData" in file "src\video\windows\SDL_windowswindow.c".

Whenever you call "SetProp" to add a property to a Win32-window, you should also call the Win32-function "RemoveProp" to remove it before destroying that Win32-window.

While you might think that it's ok and that Windows will clean up nicely itself, it is not ok. It is against all Win32-API guidelines and is mostlikely a leak. Especially on external windows (CreateWindowFrom) you want to have things done right, not messy and leaky, affecting some other module. Even if SDL gets shutdown entirely that external window will now forever still have the "SDL_WindowData" prop attached to it.
2015-05-28 08:41:07 -07:00
Ryan C. Gordon 84ce000670 I think this will be the time... 2015-05-28 01:27:24 -04:00
Ryan C. Gordon 7964f3adb2 Still trying to get this to compile... 2015-05-28 01:22:14 -04:00
Ryan C. Gordon cae4fd7fb2 More patching to compile... 2015-05-28 01:16:55 -04:00
Ryan C. Gordon e90f87bab0 Another attempt to get this to compile. 2015-05-28 01:08:33 -04:00
Ryan C. Gordon 4add16943e Patched to compile on MingW.
(I think!)
2015-05-28 01:02:03 -04:00
Ryan C. Gordon 58447b24c1 Move tests from SDL_config higher up in Windows joystick/haptic code.
Fixes Bugzilla #2932.
2015-05-28 00:54:52 -04:00
Ryan C. Gordon 2a75782553 X11: Add Xdbe support to message boxes (thanks, Melker!).
Without this, message boxes with a lot of text will noticibly flicker as
you mouse over buttons.

Fixes Bugzilla #2343.
2015-05-28 00:30:21 -04:00
Ryan C. Gordon bea1854cac Patched to compile on C89 compilers. 2015-05-27 19:00:56 -04:00
Ryan C. Gordon 9c343681c4 Wayland: Avoid NULL dereference after window destruction (thanks, "x414e54"!).
Fixes Bugzilla #2934.
2015-05-27 18:54:06 -04:00
Sam Lantinga 7f17e0ab9e Fixed detecting PS4 wired controller on Windows 2015-05-27 10:29:43 -07:00
Ryan C. Gordon 80cfccbf8d Back out changeset b80349dd6d40.
This change didn't do what I thought it did, sorry.
2015-05-26 22:57:42 -04:00
Ryan C. Gordon c69a559239 X11: generate clipboard update events (thanks, "chw"!).
Partially fixes Bugzilla #2266.
2015-05-26 21:29:45 -04:00
Ryan C. Gordon 059a030716 Uh, yeah, it helps to press "Save" before committing... 2015-05-26 21:30:41 -04:00
Ryan C. Gordon cc493d7195 X11: use XA_STRING for text SDL puts on the clipboard (thanks, "chw"!).
Partially fixes Bugzilla #2266.
2015-05-26 21:26:27 -04:00
Ryan C. Gordon baea64e642 Stack hint should look for 0, not -1, and not care about environment variables. 2015-05-26 21:19:23 -04:00
Ryan C. Gordon a8fa7bd1f7 Added a hint to specify new thread stack size (thanks, Gabriel!).
Fixes Bugzilla #2019.

(we'll do a better fix when we break the API in SDL 2.1.)
2015-05-26 21:13:27 -04:00
Alex Baines dae40bff0d [IBus] Only register interest in messages sent to our input context. 2015-02-27 21:17:29 +00:00
Alex Baines 42d9cf6978 [ibus] Send an empty TextEditing event when the text is cleared by pressing backspace. 2015-02-01 21:08:54 +00:00
Ryan C. Gordon 21d0cdedb3 Added some unknown keys from Japanese 106/109 keyboards (thanks, "ver0hiro"!).
This adds them for Windows and X11.

Fixes Bugzilla #2820.
2015-05-26 20:55:03 -04:00
Alex Szpakowski 262e8ef3f0 Mac: Send a window resize event when the window's backing scale factor changes.
The backing scale factor can change when the window moves between retina and non-retina displays.

The only other way to detect such a change is to compare the output of SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize every frame, which is less than desirable, especially since the necessary app logic is likely already being executed when a window resize event is received.
2015-05-26 21:51:47 -03:00
Ryan C. Gordon be89fa09ef Reset the keyboard state when launching a message box (thanks, Sean!).
Otherwise, pressed keys get stuck.

Fixes Bugzilla #2776.
2015-05-26 20:49:27 -04:00
Ryan C. Gordon 41908548b9 Windows: Alt-F4 hotkey should be checked on keydown, not keyup (thanks, Matt!).
Fixes Bugzilla #2780.
2015-05-26 20:40:00 -04:00
Ryan C. Gordon 72a244da41 Android: Added basic drop file support (thanks, "noxalus"!).
This lets SDL-based apps respond to "Open With" commands properly, as they
can now obtain the requested path via a standard SDL dropfile event.

This is only checked on startup, so apps don't get drop events at any other
time, even if Android supports that, but this is still a definite
improvement.

Fixes Bugzilla #2762.
2015-05-26 20:36:45 -04:00
Alex Baines ae6555dff8 Pump IBus events after X events. 2015-05-26 20:22:14 -04:00
Alex Szpakowski a4f0daedae EGL: OpenGL ES 3.0 contexts can now be created without the EGL_KHR_create_context extension.
Fixes bugzilla #2994.
2015-05-26 19:34:56 -03:00
Ryan C. Gordon d5a578531b Drop out of SDL_UpdateTexture() early if the rectangle is zero pixels.
Hopefully makes static analysis happy about a zero-byte malloc elsewhere.
2015-05-26 16:42:36 -04:00
Ryan C. Gordon 2e2b84fb32 Some setups need _GNU_SOURCE to make LLONG_MAX available (thanks, Ozkan!).
Fixes Bugzilla #2721.
2015-05-26 16:31:11 -04:00
Ryan C. Gordon 59f69f6317 Whoops, fix the static analysis fix. 2015-05-26 16:14:25 -04:00
Ryan C. Gordon d1980b93fb Mac: Fix compiler warning when building with a min target >= 10.6. 2015-05-26 12:52:28 -04:00
Ryan C. Gordon 37f4eb5379 Darwin haptic: Fixed a static analysis warning if axes==0. 2015-05-26 12:47:03 -04:00
Ryan C. Gordon f99d6e1df8 Linux joystick: Look at entire axis namespace for controls (thanks, "spaz16"!).
This apparently has fallout: the PS4 (and maybe PS3?) controllers apparently
report some bogus axes, but it won't change the axes we currently expect, and
thus the game controller config string is still stable.

Fixes Bugzilla #2719.
2015-05-26 12:03:51 -04:00
Sam Lantinga 523064592a Fixed bug 2869 - Controllers connected on launch are reported twice.
Since all device detection/removal happens on the main thread now, post events inline with when the status changes occur.
Also fixed rare cases when joystick API functions could return data about removed joysticks when called with a device index.
2015-05-26 08:52:02 -07:00
Ryan C. Gordon 80916e01f3 Cocoa: Fixed relative mouse mode when app loses/regains focus (thanks, Eric!).
Fixes Bugzilla #2718.
2015-05-26 11:38:04 -04:00
Ryan C. Gordon b11b3493b9 Windows: don't beep on Alt-* key combos (Thanks, historic_bruno!).
Fixes Bugzilla 2669.
2015-05-26 11:08:30 -04:00
Ryan C. Gordon bb437f0233 Cocoa: report SDL_WINDOWEVENT_EXPOSED events to the app (thanks, David!).
Fixes Bugzilla #2644.
2015-05-26 11:01:19 -04:00
Ryan C. Gordon 22704ac2df Cocoa: don't fail outright if we see an unknown display format.
Just treat it as ARGB8888.
2015-05-26 09:55:41 -04:00
Ryan C. Gordon aba4d78384 Don't look for (and fail without) glGetIntegerv() until we need to.
Fixes Bugzilla #2615.
2015-05-26 10:25:15 -04:00
Sam Lantinga 2c4a6ea0a2 Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Sam Lantinga 507157abdb Wait for devices to finish initializing when inserted, before using them. Fixes hotplug issue with XBox 360 game controller. 2015-05-25 16:22:09 -07:00
Sam Lantinga b0c5e201f8 Added support for Razer Serval Bluetooth mode 2015-05-25 14:52:41 -07:00
Victor Luchits afc97cbd5d Fix duplicate raw mouse events with XInput2
Make XGrabPointer calls in X11_SetWindowGrab and X11_CaptureMouse
consistent by passing False to owner_mask along with proper event_mask.
2015-05-14 14:40:56 +03:00
Sam Lantinga 6365381422 Added game controller support for the Razer Serval 2015-05-20 16:28:21 -07:00
Alex Szpakowski fcee3e734d Code style cleanup in the GLES and GLES2 render backends. 2015-05-16 17:35:36 -03:00
Alex Szpakowski 240a3fbffe iOS: Added support for SDL_DisableScreenSaver and SDL_EnableScreenSaver. 2015-05-16 16:55:56 -03:00
Philipp Wiesemann a54d038b64 Emscripten: Fixed wrong source comment and updated web link. 2015-05-16 21:15:27 +02:00
Alex Szpakowski d57b973518 Mac: Use CoreFoundation headers instead of Carbon headers, in GetPowerInfo code. 2015-05-16 12:05:42 -03:00
Sam Lantinga 1c6ea0f226 Added a userdata parameter to SDL_SetWindowsMessageHook() 2015-05-13 22:39:32 -07:00
Sam Lantinga b2be9253e3 Fixed Mac and Linux builds 2015-05-13 22:39:27 -07:00
Sam Lantinga 7de242e72c Added SDL_SetWindowsMessageHook() to facilitate full IME support on Windows 2015-05-13 22:39:20 -07:00
Sam Lantinga 094c4a160f Added generic xinput fallback for XBox compatible controllers on Linux 2015-05-13 22:37:26 -07:00
Alex Szpakowski f1a7c00d06 Refactored SDL_EGL_CreateContext: It now supports context flags and OpenGL ES 3+ contexts, and its behavior more closely matches the GLX and WGL context creation code.
Improved the code style consistency of SDL_egl.c.

Fixes bugzilla #2865.
2015-05-11 21:03:36 -03:00
Philipp Wiesemann 5919a859b4 Android: Fixed empty parameter list in signatures of internal functions. 2015-05-09 22:42:23 +02:00
Philipp Wiesemann 3f51758ec5 Emscripten: Fixed touch coordinates not being normalized. 2015-05-06 21:10:48 +02:00
Alex Szpakowski ac27b511bf Fixed SDL_GL_GetAttribute queries for framebuffer component sizes in Core Profile OpenGL contexts.
Fixes bugzilla #2060.
2015-05-06 12:54:51 -03:00
Alex Szpakowski 4fc4026660 Replaced all remaining uses of NSAutoreleasePool with @autoreleasepool blocks (bugzilla #2680.) 2015-05-05 19:01:55 -03:00
Alex Szpakowski d1372bb92c Fixed the window offset on iOS when resuming an app with a borderless or fullscreen window that has the on-screen keyboard visible. 2015-05-05 16:20:11 -03:00
Alex Szpakowski d603bb30e6 Fixed a crash on iOS when none of the orientations in Info.plist match the SDL window's actual orientation.
Fixes bug #2967.
2015-05-05 16:16:10 -03:00
Sam Lantinga 74d83ead35 Fixed bug 2976 - Fix RGBA<->RGBA blit that was broken with the optimization from Bug 11
id.zeta

The optimization from Bug 11 added a code branch on cases where the source RGB masks match the destination RGB masks and a optimized blit function Blit4to4MaskAlpha that always overrides the source alpha info would be chosen. Unfortunately, the branch also errorneously took over the RGBA<->RGBA blitting cases where the source alpha info should be copied, while they would instead get overriden in Blit4to4MaskAlpha.

The attached patch fixes that by handling the RGBA<->RGBA cases correctly in that branch with the original BlitNtoNCopyAlpha as well as uses an optimized Blit4to4CopyAlpha along the same vein.
2015-05-04 21:47:40 -07:00
Ryan C. Gordon 589c46dd65 X11: send keypress events before textinput events. 2015-05-01 01:20:28 -04:00
Philipp Wiesemann 9979bab20b Android: Deactivated debug log messages on joystick device events. 2015-04-30 21:45:29 +02:00
Dimitris Zenios d9d1a1b980 X11: Use our own cut-buffer for intermediate clipboard storage.
XA_CUTBUFFER0 is not defined for holding UTF8 strings.
2015-04-26 13:53:46 +03:00
Eric Wing 313881175d Adds support to control the scaling policy/mode of SDL_RenderSetLogicalSize for both letterbox (current behavior) and a new overscan mode (expand to fill the entire screen, even if some parts draw off the screen).
The expected use case is for games that are designed with multiple aspect ratios already in mind and leave optional margins on the edges of the game which won't hurt if they are cut off.

An example use case is a game is designed for wide-screen/16:9, but then wants to deploy on an iPad which is 4:3. Normally, SDL will letterbox, which will shrink things and result in wasted space. But the designer already thought about 4:3 and designed the edges of the game so they could be cut off without any functional loss. So rather than wasting space with letterboxing, "overscan" mode will zoom the rendering to fill up the entire screen. Parts on the edges will be drawn offscreen, but since the game was already designed with this in mind, it is fine. The end result is the iPad (4:3) experience is much better since it feels like a game designed for that screen aspect ratio.

This patch introduces a new SDL_hint: SDL_HINT_RENDER_LOGICAL_SIZE_MODE.
Valid values are "letterbox" or "0" for letterboxing and "overscan" or "1" for overscan.
The default mode is letterbox to preserve existing behavior.

// Example usage:
SDL_SetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE, "overscan");
SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT);
2014-12-03 04:41:26 -08:00
David Ludwig 5fee84f24b WinRT: removed SDL_HINT_WINRT_PREF_PATH_ROOT (introduced post-2.0.3 & pre-2.0.4)
A WinRT app's Roaming folder-path can still be retrieved via calls to
SDL_WinRTGetFSPathUTF8() or SDL_WinRTGetFSPathUNICODE(), if need be.
2014-12-02 21:18:50 -05:00
Andreas Schiffler 52760dcdf1 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes 2014-11-30 20:55:27 -08:00
Sam Lantinga 265b219e3e Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification
Elias Vanderstuyft

Remove the dependency of the calculation of Linux "phase" on "period",
currently the "phase" parameter is interpreted as a time shift, instead of a phase shift.
The Linux input documentation is not clear about the exact units of the "phase" parameter (see http://lxr.free-electrons.com/source/include/uapi/linux/input.h?v=3.17#L1075 ),
but we're about to standardize the 'phase shift' interpretation into the Linux input documentation,
since this will ease the job of a driver to recalculate the effect's state when the user dynamically updates the "period" parameter.
2014-11-29 11:51:13 -08:00
Sam Lantinga ef8c3d89ce Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification
Elias Vanderstuyft

It's not obvious from the general "haptic direction" description what the SDL direction actually means in terms of force magnitude sign,
currently its meaning is only reflected by the example.
2014-11-29 11:48:43 -08:00
David Ludwig ce64b4ad3a WinRT: bug and data-integrity fixes for SDL_GetPrefPath()
This change does a few things, all with regards to the WinRT implementation of
SDL_GetPrefPath():

1. it fixes a bug whereby SDL_GetPrefPath() did not create the directory it
returned.  On other SDL platforms, SDL_GetPrefPath() will create separate
directories for its 'org' and 'app' folders.  Without this, attempts to create
files in the pref-path would fail, unless those directories were first created
by the app, or by some other library the app used.  This change makes sure
that these directories get created, before SDL_GetPrefPath() returns to its
caller(s).


2. it defaults to having SDL_GetPrefPath() return a WinRT 'Local' folder
on all platforms.  Previously, for Windows Store apps, it would have used a
different, 'Roaming' folder.  Files in Roaming folders can be automatically,
and synchronized across multiple devices by Windows.  This synchronization can
happen while the app runs, with new files being copied into a running app's
pref-path.  Unless an app is specifically designed to handle this scenario,
there is a chance that save-data could be overwritten in unwanted or
unexpected ways.

The default is now to use a Local folder, which does not get synchronized, and
which is arguably a bit safer to use.  Apps that wish to use Roaming folders
can do so by setting SDL_HINT_WINRT_PREF_PATH_ROOT to "roaming", however it
is recommended that one first read Microsoft's documentation for Roaming
files, a link to which is provided in README-winrt.md.

To preserve older pref-path selection behavior (found in SDL 2.0.3, as well as
many pre-2.0.4 versions of SDL from hg.libsdl.org), which uses a Roaming path
in Windows Store apps, and a Local path in Windows Phone, set
SDL_HINT_WINRT_PREF_PATH_ROOT to "old".

Please note that Roaming paths are not supported on Windows Phone 8.0, due to
limitations in the OS itself.  Attempts to use this will fail.
(Windows Phone 8.1 does not have this limitation, however.)


3. It makes SDL_GetPrefPath(), when on Windows Phone 8.0, and when
SDL_HINT_WINRT_PREF_PATH_ROOT is set to "roaming", return NULL, rather than
silently defaulting to a Local path (then switching to a Roaming path if and
when the user upgraded to Windows Phone 8.1).
2014-11-29 10:09:30 -05:00
Sam Lantinga 4dab32a2bc Fixed bug 2786 - "UCS-2-INTERNAL" iconv encoding is not supported everywhere, use UTF-16LE instead
Jonas Kulla

src/main/windows/SDL_windows_main.c:137:
cmdline = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(text), (SDL_wcslen(text)+1)*sizeof(WCHAR));

I'm trying to compile an SDL2 application for windows using the mingw-w64 32bit toolchain provided by my distro (Fedora 19). However, even the simplest test program that does nothing at all fails to startup with a "Fatal error - out of memory" message because the mingw iconv library provided by my distro does not support the "UCS-2-INTERNAL" encoding and the conversion returns null.

From my little bit of research, it turns out that even though this encoding is supported by the external GNU libiconv library, some glibc versions (?) don't support it with their internal iconv routines, and will instead provide the native endian encoding when "UCS-2" is specified.

Nonetheless, I wonder why the native endianness is considered in the first place when Windows doesn't even run on any big endian archs (to my knowledge). And true enough, 'WIN_StringToUTF8' from core/windows/SDL_windows.h is used everywhere else in the windows backend, which is just a macro to iconv with "UTF-16LE" as source. Therefore it would IMO make sense to use this macro here as well, which would solve my problem (patch attached).
2014-11-28 04:51:33 -08:00
Sam Lantinga 767bb36364 Fixed bug 2676 - xdnd_version check issue in case ClientMessage
Nitz

I added xdnd_version check to XdndPosition case also
under DEBUG_XEVENTS macro.
by this we can get the action requested by user.

I analysed further and found out that removing xdnd_version check at XdndDrop case is a bad idea because
in XConvertSelection API timestamp should be passed if(xdnd_version >= 1)
otherwise CurrentTime should be passed
So xdnd_version check is important at XdndDrop case

I made xdnd_version as a static so that it can store the version in other cases also.
2014-11-28 04:42:46 -08:00
Sam Lantinga 7ed41da0b0 Fixed bug 2411 - Even if built with --enable-clock_gettime, SDL2 still calls gettimeofday()
Ben Swick

Makes SDL_syscond.c and SDL_syssem.c use clock_gettime(CLOCK_REALTIME) when HAVE_CLOCK_GETTIME is defined.
2014-11-28 04:37:50 -08:00
Eric Wing ef559ddb4c iOS: Added support for iOS 8 LaunchScreen NIBs.
iOS 8 introduces LaunchScreen NIBs which use autolayout to handle all devices and orientations with a single NIB instead of multiple launch images. This is also the only way to get the App Store badge "Optimized for iPhone 6 and iPhone 6 Plus". So if the application is running on iOS 8 or greater AND has specified a LaunchScreen in their Info.plist, this patch will use the NIB as the launch screen. Otherwise, the code falls back to the legacy code path.

Note: Upon audit of the legacy path, it appears that it does not properly handle the UILaunchImages Info.plist convention. I've added comments inline to the code about this. However, in about a year from now, nobody is going to care about this path since everybody should be using LaunchScreen NIBs.
2014-11-02 20:55:13 -08:00
David Ludwig ecc014740a WinRT: added SDL_HINT_WINRT_PREF_PATH_ROOT
SDL_HINT_WINRT_PREF_PATH_ROOT allows WinRT apps to alter the path that
SDL_GetPrefPath() returns.  Setting it to "local" uses the app's
OS-defined Local folder, setting it to "roaming" uses the app's OS-defined
Roaming folder.

Roaming folder support is not available in Windows Phone 8.0.  Attempts to
make SDL_GetPrefPath() return a Roaming folder on this OS will be ignored.

Various bits of documentation on this were added to SDL_hints.h, and to
README-winrt.md
2014-11-27 09:55:34 -05:00
David Ludwig 506a1efc22 WinRT: removed a completed TODO item from an inline comment 2014-11-27 08:50:11 -05:00
David Ludwig 6a5b3bb425 WinRT: added initial SDL_TEXTINPUT support
Further support regarding IME and on-screen keyboards is pending, some of
which might not be 100% compatible with other platforms, given WinRT platform
restrictions.  An MSDN article at http://msdn.microsoft.com/en-us/library/windows/apps/hh465404.aspx
indicates that on-screen keyboard display requires that the user first tap on
a Windows/XAML text control.

This change adds basic SDL_TEXTINPUT support, with input coming from hardware
keyboards, at a minimum, and without the need for XAML integration (which is
still pending integration into SDL, by and large).
2014-11-26 21:34:15 -05:00
Philipp Wiesemann 8cab5ae300 Fixed limitation for number of custom main() arguments on Android.
Limitation was size of the reference table because local refs were not deleted.
2014-11-25 22:31:14 +01:00
J?rgen P. Tjern? 94539137a2 Mac: Add drag & drop support.
Fixes bug https://bugzilla.libsdl.org/show_bug.cgi?id=2757

Thanks to Alex Szpakowski for the patch!
2014-11-24 11:46:20 -08:00
Edward Rudd 084642d3f4 Cocoa: add in handling of "lost" touches on OS X. [bug #2635]
This scenario can occur, for example, when the 4-finger touch sequence is used to switch spaces.  the SDL window does not receive the touch up events and ends up thinking there are far more fingers on the pad than there are.

So the solution here is everytime a new "touch" appears we can through and check if there are any existing known touches by the OS and if there are none, abut SDL things there are, we simply go through and cancel the SDL touches.

Side affects.
- the "touch up" won't occur until the users sends a new touch (could be well after the actual release really did occur)
2014-11-23 15:48:52 -05:00
Philipp Wiesemann 097ad55000 Fixed local reference leaks in messagebox implementation for Android. 2014-11-23 20:38:18 +01:00
David Ludwig d9a42c76b1 WinRT: fixed an invalid comment in SDL_GetPrefPath() (for WinRT) 2014-11-23 08:59:01 -05:00
David Ludwig 13c511697c WinRT: allowed 'roaming' and 'temp' folder paths to be retrieved on WinPhone 8.1
Windows Phone 8.0 either did not define, or provide access to, a 'RoamingFolder'
or 'TemporaryFolder' for apps to use.  Windows 8.0 and 8.1 do, as does
Windows Phone 8.1.  This change allows SDL-based Windows Phone 8.1 apps to
access these folders, via either the SDL_WinRTGetFSPathUNICODE() or
SDL_WinRTGetFSPathUTF8() functions.

SDL_GetPrefPath(), which on WinRT, is based on SDL_WinRTGetFSPathUTF8(), will
continue to return the app's 'local' folder, despite Windows 8.x
counterpart apps using the 'roaming' folder, in order to preserve compatibility
when 8.0-based Phone apps upgrade to 8.1-based Phone apps.
2014-11-23 08:52:10 -05:00
David Ludwig 5575948b37 Fixed bug 2726 - WinRT touches not setting 'which' field in virtual mouse events
This patch makes sure that any SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, and
SDL_MOUSEMOTION events, as triggered by a touch event in a WinRT app, set the
event's 'which' field to SDL_TOUCH_MOUSEID.  Previously, this was getting set
to the same value as events from a real mouse, '0'.

Thanks to Diego for providing information on this bug, and to Tamas Hamor for
sending over a patch!
2014-11-22 21:13:46 -05:00
Philipp Wiesemann 9c398852e6 Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
Wander Lairson Costa eff61ee39d Add an entry for X11 "/" key for Brazilian keyboard.
SDL2 reports the following message when we type the "/" on br-abnt2 keyboards:

The key you just pressed is not recognized by SDL. \
To help get this fixed, please report this to the SDL mailing list \
<sdl@libsdl.org> X11 KeyCode 97 (89), X11 KeySym 0x2F (slash).

That's because the corresponding entry in the scancodes table is
marked with value SDL_SCANCODE_UNKNOWN.

This commit fixes that adding the value SDL_SCANCODE_SLASH for this entry.
2014-06-05 11:55:37 -03:00
Ryan C. Gordon 69f6f646a2 Cleaned up the macro salsa in the Windows timer code.
- Removed USE_GETTICKCOUNT code; it's never used now.
- Reduced the number of preprocessor checks for WinRT.
- Renamed timeSetPeriod() so it doesn't look like a Win32 API call.
2015-04-20 13:43:24 -04:00
Ryan C. Gordon b72938c861 Windows: Always set the system timer resolution to 1ms by default.
An existing hint lets apps that don't need the timer resolution changed avoid
this, to save battery, etc, but this fixes several problems in timing, audio
callbacks not firing fast enough, etc.

Fixes Bugzilla #2944.
2015-04-20 12:22:44 -04:00