Commit Graph

1921 Commits

Author SHA1 Message Date
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
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 e97fc56209 Android: Fixed lint warning about order of elements in AndroidManifest.xml. 2015-04-13 20:52:38 +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
Ryan C. Gordon c6538cb977 Merged. 2015-04-12 20:28:28 -04:00
Alex Szpakowski a27fad1e24 Fixed orientation issues in the iOS extended launch screen. 2015-04-12 01:50:28 -03:00
Rohit Nirmal cf6b9752f9 Ignore some more test binaries. 2015-04-10 22:31:52 -05:00
Philipp Wiesemann 26b4898ac2 Windows: Fixed format string for error message. 2015-04-11 20:43:11 +02:00
Philipp Wiesemann 56c82bc828 Mac: Fixed typo in two error messages. 2015-04-11 20:41:49 +02:00
Ryan C. Gordon 1a73b4eba2 Some Raspberry Pi build fixes (including Raspberry Pi 2 support).
Fixes Bugzilla #2879.
2015-04-11 05:58:37 +00: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
Ryan C. Gordon 6ae7a20647 Placate static analysis with an assertion. 2015-04-10 21:40:50 -04:00
Ryan C. Gordon 2afa4aeda8 Fixed memory leak in failure case that static analysis found. 2015-04-10 21:15:51 -04:00
Philipp Wiesemann 7bd7221997 PSP: Removed empty statement. 2015-04-10 23:45:13 +02:00
Philipp Wiesemann ce2d5f70e4 Wayland: Removed empty statement. 2015-04-10 23:44:55 +02:00
Ryan C. Gordon 562414c74c Merged Alex Szpakowski's iOS-improvement branch to default.
Fixes Bugzilla #2798.
Fixes Bugzilla #2212.
Fixes Bugzilla #2826.
Fixes Bugzilla #2661.
Fixes Bugzilla #1885.
Fixes Bugzilla #1578.
Fixes Bugzilla #2751.

(whew!)

Notable changes, from Alex's notes:

- The SDL_WINDOW_ALLOW_HIGHDPI flag is now needed (along with SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize) to use Retina / high DPI resolutions, bringing SDL?s Retina-related behavior on iOS in line with Mac OS X. Window dimensions and display modes are now in the ?points? (non-high DPI) coordinate system rather than pixels, whereas SDL_GL_GetDrawableSize is in pixels.

- Reworked the custom extended launch screen code:
	- It now hides after the first SDL_PumpEvents call rather than SDL_CreateWindow, and it fades out in a similar manner to the system launch screen behavior.
	- It now mirrors the system launch screen behavior when deciding which image to display: it falls back to using the Launch Images dictionary in Info.plist if the iOS 8+ launch screen nib isn?t available, and if the Launch Images dictionary doesn?t exist it uses the old standard launch image names.
	- The extended launch screen can now be disabled via the SDL_IPHONE_LAUNCHSCREEN define in SDL_config_iphoneos.h.

- Added support for SDL_HINT_ACCELEROMETER_AS_JOYSTICK.

- Added access to a window view's renderbuffer and framebuffer to syswm.

- Added OpenGL ES debug labels for the Renderbuffer and Framebuffer Objects created with SDL_GL_CreateContext.

- Added support for sRGB OpenGL ES contexts on iOS 7+.

- Updated OpenGL ES contexts to support native-resolution rendering (when SDL_WINDOW_ALLOW_HIGHDPI is enabled) on the iPhone 6 Plus, i.e. 1080x1920 rather than 1242x2208.

- Updated SDL_GL_CreateContext, SDL_GL_SwapWindow, SDL_GL_MakeCurrent, and SDL_GL_DeleteContext to be more robust.

- Updated SDL windows to display a UIView at all times, even when an OpenGL context is not active. This allows rotation, touch events, and other windowing-related events to work properly without an active OpenGL context. It also makes it easier to use SDL_GetWindowWMInfo after creating a SDL window.

- Updated the iOS-specific Objective-C code to use cleaner and more modern language features and APIs, including ARC instead of manual reference counting.

- Updated SDL_HINT_ORIENTATIONS to allow disabling custom orientations if the hint is set with no valid orientation names.

- Fixed several rotation and orientation bugs with windows and display modes, especially in iOS 8+.

- Fixed SDL_SetWindowFullscreen failing to update the status bar visibility on iOS 7+.

- Fixed the orientation of the offset applied to the window?s view when the onscreen keyboard is shown in iOS 8+.

- Fixed SDL_IsScreenKeyboardShown (patch by Phil Hassey.)

- Fixed several major memory leaks caused by missing autorelease pool blocks in the iOS-specific Objective-C code.

- Removed several dead code paths.

- The iOS 7 SDK (Xcode 5) or newer is now required to build SDL for iOS.
2015-04-09 22:28:37 -04:00
Alex Szpakowski c4035654a9 Added framebuffer and colorbuffer members to the uikit portion of the SDL_SysWMinfo struct, removed SDL_iOSGetViewRenderbuffer and SDL_iOSGetViewFramebuffer. 2015-04-09 19:28:00 -03:00
Philipp Wiesemann 67549d3320 Backed out changeset 064a1998a957 2015-04-09 22:14:05 +02:00
Philipp Wiesemann f87963488b Wayland: Fixed not freeing memory if initialization failed. 2015-04-09 21:13:41 +02:00
Philipp Wiesemann dc33fb942d Wayland: Fixed accessing not fully initialized subsystem if errors happened.
The VideoInit() implementation returned 0 on errors instead of -1.
2015-04-09 21:13:20 +02:00
Philipp Wiesemann 8a573844c9 Wayland: Fixed accessing not fully initialized window if no memory available.
The CreateWindow() implementation returned 0 on no more memory instead of -1.
2015-04-09 21:11:43 +02:00
Philipp Wiesemann 049ef9a35b Android: Fixed calling a getter method twice. 2015-04-08 22:24:33 +02:00
Philipp Wiesemann 458b94da5f Android: Fixed creating mouse coordinates which are not needed if hint is set. 2015-04-08 22:18:10 +02:00
Philipp Wiesemann b473d30f19 Android: Fixed not resetting mouse pointer state if hint was changed at runtime. 2015-04-08 22:15:25 +02:00
Alex Szpakowski fcd0f06a88 Renamed SDL_iPhoneGetViewFramebuffer/Renderbuffer to SDL_iOSGetViewFramebuffer/Renderbuffer. Added #defines for SDL_iOSSetAnimationCallback and SDL_iOSSetEventPump, which point to SDL_iPhoneSetAnimationCallback and SDL_iPhoneSetEventPump. 2015-04-08 15:59:29 -03:00
Alex Szpakowski 1152a75954 Generated dynapi prototypes for the new iPhone functions. 2015-04-08 15:44:07 -03:00
Alex Szpakowski 26c28114ee Merged default into iOS-improvements 2015-04-08 15:35:07 -03:00
Ryan C. Gordon a210dbcb13 Removed unused variable. 2015-04-08 02:42:29 -04:00
Ryan C. Gordon 53287ad51c X11: Removed code to set "icon" title, since it was never used.
(Leftover from SDL 1.2, which let you specify this?)
2015-04-08 02:31:54 -04:00
Ryan C. Gordon 78026f5492 Patched to compile on Windows. 2015-04-08 02:24:17 -04:00
Ryan C. Gordon e0ad1021a5 Wayland: Patched to compile. 2015-04-08 02:22:28 -04:00
Ryan C. Gordon 785618afec DirectInput: ignore everything but joysticks and gamepads (thanks, Justin!).
Fixes Bugzilla #2460.
2015-04-08 02:14:59 -04:00
Ryan C. Gordon 6e53bc9b10 SDL_SetWindowTitle() should never set a NULL pointer for the title string.
Various backends reacted differently (or not at all) in the presence of a
NULL pointer. This simplifies things.

Fixes Bugzilla #2902.
2015-04-08 02:00:14 -04:00
Ryan C. Gordon 1339ce71f6 Make SDL_stdinc.h work when compiling with -Wundef (thanks, Ben!).
Fixes Bugzilla #2664.
2015-04-08 01:42:47 -04:00
Ryan C. Gordon 88e85f4ddd Patched to compile on C89 compilers. 2015-04-08 01:40:01 -04:00
Ryan C. Gordon 8da7e8adc9 Log Android hardware at startup (thanks, rettichschnidi!).
Fixes Bugzilla #2653.
2015-04-08 01:37:17 -04:00
Ryan C. Gordon 6a126a48df Do the "fix" for asserts with MSVC's /W4 warnings only on MSVC.
Naturally, this way generates a warning on GCC and Clang instead.  :)
2015-04-07 23:40:01 -04:00
Ryan C. Gordon 9a686aaa56 Wayland: changed a few "SetError(); return -1;" to "return SetError()". 2015-04-07 22:49:56 -04:00
Alex Szpakowski df98b11c47 Merged default into iOS-improvements 2015-04-06 15:26:37 -03:00