Commit Graph

1192 Commits

Author SHA1 Message Date
David Ludwig a838a56d45 WinRT build fix 2014-06-25 22:03:05 -04:00
Ryan C. Gordon 95864f86d8 Patched to compile on Windows. 2014-06-25 17:24:06 -04:00
Ryan C. Gordon 4318910e02 Whoops, lost this in the merge. 2014-06-25 17:20:22 -04:00
Ryan C. Gordon 84cb232067 Patched to compile with -Werror=declaration-after-statement 2014-06-25 17:13:43 -04:00
Ryan C. Gordon b29740b88f Merged Ryan's SDL-gui-backend branch.
Adds three APIs, and implements them on X11, Cocoa, and Windows:

- SDL_CaptureMouse()
- SDL_GetGlobalMouseState()
- SDL_SetWindowHitTest()
2014-06-25 17:06:12 -04:00
Ryan C. Gordon 8436956711 Changed SDL_GetAbsoluteMouseState() to SDL_GetGlobalMouseState().
This matches naming conventions in the main repository, between
 SDL_GetRelativeMouseState() and SDL_WarpMouseGlobal().
2014-06-25 16:16:55 -04:00
Sam Lantinga 704d9bd30d Fixed bug 2525 - Keyboard focus crash
Todd Seiler

Call Stack:
#0  0x0000000101c29291 in Cocoa_StartTextInput at /Users/Todd/Desktop/codes/sources/SDL/src/video/cocoa/SDL_cocoakeyboard.m:512
#1  0x0000000101c110c5 in SDL_SetKeyboardFocus at /Users/Todd/Desktop/codes/sources/SDL/src/events/SDL_keyboard.c:643
#2  0x0000000101c32be4 in SetupWindowData at /Users/Todd/Desktop/codes/sources/SDL/src/video/cocoa/SDL_cocoawindow.m:981
#3  0x0000000101c32d2a in Cocoa_CreateWindowFrom at /Users/Todd/Desktop/codes/sources/SDL/src/video/cocoa/SDL_cocoawindow.m:1092
#4  0x0000000101c99999 in SDL_CreateWindowFrom_REAL at /Users/Todd/Desktop/codes/sources/SDL/src/video/SDL_video.c:1338
#5  0x0000000101ce1484 in SDL_CreateWindowFrom at /Users/Todd/Desktop/codes/sources/SDL/src/dynapi/SDL_dynapi_procs.h:547
#6  0x0000000100018a5e in SceneRenderer at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/SceneRenderer.cpp:138
#7  0x0000000100017ca5 in SceneRenderer at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/SceneRenderer.cpp:145
#8  0x000000010000cd96 in App::execute(int, char**) at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/App.cpp:28
#9  0x0000000100004402 in main at /Users/Todd/Desktop/codes/sources/tseiler_Todds-MacBook-Pro_3405/AppName/src/main.cpp:8


This issue occurred when using Ogre3D Graphics engine on Mac (cocoa) to create the window. Then handing the window handle off to SDL_CreateWindowFrom().

In Ogre3D application you do the following:
        window_ = root_->initialise(true, "Ogre Window 2");
        loadOgreResources();
        Ogre::WindowEventUtilities::addWindowEventListener(window_, this);

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
        NSWindow* Data = 0;
        window_->getCustomAttribute("WINDOW", &Data);
        sdl_window_ = SDL_CreateWindowFrom((void*)Data);
#endif

It results in a crash in this function:
SDL_cocoakeyboard.m

void
Cocoa_StartTextInput(_THIS)
{
    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    SDL_Window *window = SDL_GetKeyboardFocus();
    NSWindow *nswindow = nil;
    if (window)
        nswindow = ((SDL_WindowData*)window->driverdata)->nswindow;

    // ...
}

The crash occurred because "driverdata" was nil. Before this function call, a call to SetupWindowData is called:

SDL_cocoawindow.m

static int
SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created)
{
    // ...

    if ([nswindow isKeyWindow]) {
        window->flags |= SDL_WINDOW_INPUT_FOCUS;
        SDL_SetKeyboardFocus(data->window);
    }

    /* Prevents the window's "window device" from being destroyed when it is
     * hidden. See http://www.mikeash.com/pyblog/nsopenglcontext-and-one-shot.html
     */
    [nswindow setOneShot:NO];

    /* All done! */
    [pool release];
    window->driverdata = data;
    return 0;
}

As you can see: "window->driverdata = data" is performed after the "SDL_SetKeyboardFocus()" call, which eventually leads to "Cocoa_StartTextInput()" where the crash occurs.
2014-06-25 02:08:37 -07:00
Sam Lantinga 724d9380ba Fixed compiler warning - HRESULT is set to FFERR_* values, but is an int 2014-06-25 01:43:58 -07:00
Sam Lantinga a8955f2640 Made the RLE code (semi) readable again 2014-06-25 01:35:17 -07:00
Sam Lantinga b4deeeba05 Fixed bug 2595 - Padded, non-contiguous YUV does not display correctly using OpenGL ES 2.0 renderer
Sylvain

Ok, I found out : GLES2_UpdateTexture is just not handling the YUV, I will attach a patch.
2014-06-25 00:58:40 -07:00
Sam Lantinga afe14829b8 Fixed bug 2556 - add compilation flag -Wshadow
Sylvain

here's the full patch for Blit + RLE.
2014-06-25 00:43:10 -07:00
Sam Lantinga 6a632eb23c Fixed bug 2603 - iOS: update joystick accelerometer code to use CoreMotion instead of the deprecated UIAccelerometer
Alex Szpakowski

SDL's code for exposing the accelerometer as a joystick on iOS currently uses UIAccelerometer, which was superseded by the CoreMotion framework and deprecated since iOS 5.

The UIAccelerometer code still works (for now), but it also throws deprecation warnings whenever SDL is built for iOS, since SDL's deployment target is no longer below iOS 5.

I've created a patch which replaces the old UIAccelerometer code with a replacement based on the CoreMotion framework. It has identical functionality (to SDL users), however iOS apps are now required to link to the CoreMotion framework when using SDL.
2014-06-25 00:20:21 -07:00
Sam Lantinga 52ec151fb0 Fixed bug 2553 - Add support to all XInput devices
This adds support for all XInput devices, exposed through the SDL joystick API.
The button and axis reporting for XInput devices has been changed to match DirectInput and other platforms.
The game controller xinput mapping has been updated so this change is seamless.
There is a new hint, SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, for any applications that have hardcoded the old xinput button and axis set. This hint will be removed in SDL 2.1.
2014-06-24 13:31:25 -07:00
Sam Lantinga cbafb158b0 Fixed bug 2467 - bad memcpy in SDL_OpenAudio/open_audio_device/prepare_audiospec chain
Rainer Deyke

If 'SDL_OpenAudio' is called with 'obtained == NULL', 'prepare_audiospec' performs a bad 'memcpy' with the destination and source pointing to the same block of memory.  The problem appears to be on in 'SDL_OpenAudio', which calls open_audio_device with 'obtained = desired' when 'obtained == NULL'.  'open_audio_device' cannot deal with 'desired' and 'obtained' pointing to the same block of memory but can deal with 'obtained == NULL'
2014-06-24 01:38:21 -07:00
Sam Lantinga 3344db40ff Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings 2014-06-23 11:06:50 -07:00
Sam Lantinga 67e55655a3 Fixed grab interaction with Windows Classic theme
Testing:
* For each theme in Windows 7, Windows 7 Basic, and Windows 7 Classic:
- Ran testsprite2
- Pressed Ctrl-G to grab the mouse
- Alt-tabbed away, verified mouse is no longer grabbed
- Alt-tabbed back, verified that mouse was grabbed
- Alt-tabbed away
- Clicked in the window, verified mouse was grabbed
- Alt-tabbed away
- Grabbed the title bar and dragged the window around successfully, verified that mouse was grabbed when move modal loop completed
- Alt-tabbed away
- Clicked the minimize button on the title bar, the window was successfully minimized
- Clicked on the icon in the task bar, the window was restored and the mouse grabbed again
- Alt-tabbed away
- Clicked the close button on the title bar, the window was successfully closed
2014-06-23 10:09:15 -07:00
Sam Lantinga 9e2a2639f8 Added names for some theme related windows messages 2014-06-23 10:09:13 -07:00
Gabriel Jacobo e63e1a5e64 Fixes OpenGL ES 2 renderer (Thanks Sylvain Becker) 2014-06-23 09:25:27 -03:00
Gabriel Jacobo 620510b337 Fix compiler warning 2014-06-23 09:18:31 -03:00
Sam Lantinga 553028c9ec Partial fix for bug 2556 - add compilation flag -Wshadow
I added -Wshadow and then turned it off again because of massive variable shadowing in the blit macros.

Feel free to go through that code and fix these if you want. Just uncomment CheckWarnShadow in configure.in if you want to try this.
2014-06-22 11:02:56 -07:00
Sam Lantinga 9f5e3ed7e7 Fixed bug 1673 - BEXT wave files only have extra metadata that you can easily skip through
bill

In SDL_wave.c, BEXT wave files with "bext" instead of "fmt " are choked on

    if (chunk.magic != FMT) {
        SDL_SetError("Complex WAVE files not supported");
        was_error = 1;
        goto done;
    }

BEXT files http://en.wikipedia.org/wiki/Broadcast_Wave_Format actually playback the same as regular waves.  All they have is (A LOT OF) extra header info.

To open them, just SKIP the "bext" chunk, and the "fmt " chunk will be a couple of hundred bytes later.

The "fmt " chunk is also bloated, but if you skip past the extra information to the "data" chunk, there is nothing different about a BEXT wave file than a "normal" one.

You can then load the data and proceed as normal.
2014-06-22 10:05:59 -07:00
Sam Lantinga cff9eac637 Fixed bug 2579 - SDL fails to compile on Windows when only EGL+OpenGL ES defined
callow.mark

Compiling with SDL_VIDEO_RENDER_OGL=0, SDL_VIDEO_OPENGL=0, SDL_VIDEO_OPENGL_WGL=0, SDL_VIDEO_RENDER_OGL_ES2=1, SDL_VIDEO_OPENGL_ES2=1 and SDL_VIDEO_OPENGL_EGL=1 set in SDL_config_windows.h fails.

A patch is attached. See bug #2570 for reasons you might want to compile this way.
2014-06-22 09:48:46 -07:00
Sam Lantinga 1b3d4e6d0e 565 textures have higher priority than 555 textures 2014-06-22 09:42:43 -07:00
Sam Lantinga d65ac7785f Restore window OpenGL state if creating an OpenGL renderer fails 2014-06-22 02:48:43 -07:00
Sam Lantinga b7b6d8ab7a Fixed crash initializing OpenGL ES renderer if OpenGL renderer fails 2014-06-22 02:30:36 -07:00
Sam Lantinga 5df11f8aa1 Made SDL_PIXELFORMAT_ARGB8888 the default texture format for consistency across renderer implementations. 2014-06-21 21:46:42 -07:00
Sam Lantinga 7b7828a46e You shouldn't get axis and hat events when your application doesn't have focus (unless you use the SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint) 2014-06-21 21:30:49 -07:00
Sam Lantinga f8b75b1a14 Fixed bug 2562 - SDL_hapticlist/_tail not set correctly
Zachary L

SDL_hapticlist and SDL_hapticlist_tail are not set correctly when quitting the subsystem. This matters because they are represented as global variables. In the case you quit and reinitialize the subsystems, problems with dangling pointers arise.

For instance, SDL_hapticlist_tail will not be null on second initialization and because of the check on line 298, it will fail to set SDL_hapticlist appropriately. This can cause a few things to go wrong, like feeding SDL_strcmp a null fname which can cause a segfault.
2014-06-21 20:40:00 -07:00
Sam Lantinga e8d84fbfaa Merged changes from Alexey Petruchik to support Android obb files
http://developer.android.com/google/play/expansion-files.html
2014-06-21 20:35:36 -07:00
Sam Lantinga f448815e82 Added libibus-1.0-dev build dependency 2014-06-21 17:31:36 -07:00
Sam Lantinga b56b37cde6 Fixed warning when building without ibus 2014-06-21 17:25:59 -07:00
Sam Lantinga fe63e00be9 Generated configure from recent configure.in changes (for ibus support) 2014-06-21 12:50:03 -07:00
Sam Lantinga 62bdecc80c Fixed compiler warning with new OpenGL ES header files 2014-06-21 12:45:54 -07:00
Sam Lantinga d7924c73d6 Fixed bug 2563 - Remove obsolete code for supporting iOS < 5
Alex Szpakowski

Now that SDL for iOS requires at least iOS 5.1 at runtime, there are several old codepaths in the UIKit backend which can be removed. I've attached a patch which does so.
2014-06-21 12:43:57 -07:00
Sam Lantinga e8f8e6727a Fixed bug 2595 - Padded, non-contiguous YUV does not display correctly using OpenGL ES 2.0 renderer
Alvin

The new OpenGL ES 2.0 YUV Texture support does not correctly display padded, non-contiguous YUV data.

I am using SDL2 95bd3d33482e (as provided by 'hg id --id') from Mercurial.

The YUV data I am using is provided by the FFMPEG family of libraries. According to FFMPEG's documentation, "The linesize [pitch] may be larger than the size of usable data -- there may be extra padding present for performance reasons."

The dimensions of the video file that I am using are 480x360. What I get from FFMPEG is a Ypitch of 512, and Upitch and Vpitch are both 256.

When I pack new Y, U and V buffers with only the "usable" data (Ypitch is 480 and Upitch and Vpitch are both 240), and use those new buffers, the image is display correctly.

It appears that the Ypitch, Upitch and Vpitch parameters are not being used by SDL_UpdateYUVTexture().

I use SDL_PIXELFORMAT_YV12 for my YUV texture, however, the same results are seen when I use SDL_PIXELFORMAT_IYUV.

Not sure if this is related or not, but when I render the YUV texture (padded and unpadded) to a RGB24 texture, the resulting image is greyscale (or could by just the Y channel).

The URL field for this bug entry is set to my email (SDL mailing list archive) which includes an example image of what I see when rendering padded, non-contiguous YUV data.
2014-06-21 12:38:46 -07:00
Alex Baines 41a39837ca Add IBus IME Support, move DBus code to its own file. (v3.3 squashed) 2014-06-18 20:11:39 +01:00
Sam Lantinga 0d673844ac Fixed bug 2596 - SDL_SetError fails on on NULL on systems with vsnprintf
sfalexrog

On systems with vsnprintf call SDL_SetError fails when passed a NULL as an argument. SDL's implementation checks for NULL (as seen in the commit: https://hg.libsdl.org/SDL/rev/835403a6aec8), but system implementation may crash.
2014-06-21 11:52:53 -07:00
Sam Lantinga 6c0a7b99fa Added NaCl to the supported platforms list 2014-06-21 11:50:18 -07:00
Sam Lantinga 80e401ab08 Added NaCl to SDL_GetPlatform() 2014-06-21 11:48:12 -07:00
Sam Lantinga 640e0415ae Added OpenGL ES headers to public headers 2014-06-21 11:42:46 -07:00
Sam Lantinga 8ef5651185 Fixed compiler warning 2014-06-21 11:36:00 -07:00
Sam Lantinga ce84813a80 commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Author: Sam Clegg <sbc@chromium.org>
Date:   Fri Jun 20 12:52:11 2014

    Fix win32 build which was failing due to missing PRIs64.

    This change adds definitions for the C99 PRIs16 and PRIu64
    which are missing from <stdint.h> on at last win32 and
    possibly other platforms.

    These already existed in testgesture.c so I removed them
    from there also.
2014-06-21 11:24:06 -07:00
Sam Lantinga 61fea2a807 Removed references to Raspberry Pi 2014-06-21 11:16:26 -07:00
Ryan C. Gordon 879805260a Added script for buildbot to use on NaCl target. 2014-06-20 22:38:36 -04:00
Gabriel Jacobo 3b217eefd7 Fix another NaCl warning 2014-06-20 11:50:31 -03:00
Sam Clegg 7e52722dfd Fix compiler warnings in Native Client and Linux builds. 2014-06-20 11:10:16 -03:00
Gabriel Jacobo 6c5cb5400f Ooops, code that resists erasure, I've seen that in a movie. 2014-06-20 11:01:05 -03:00
Gabriel Jacobo 553cc07e9d Initialize nacl_io, removes SDL_NaClMount/Umount
It's just easier to use nacl_io's mount/umount directly.
2014-06-20 10:59:51 -03:00
Sam Clegg 199aff7bc2 Make autoconf-based build quiet by default.
Add V=1 to the make command line will show the full commands but by default
we just show the tool-type and the output file.  This is generally much easier
on the eye and makes warnings and errors more clearly visible.
2014-06-19 00:40:09 -04:00
Gabriel Jacobo 715a9829b9 Fix file name typo, thanks Sam Clegg! 2014-06-18 10:04:21 -03:00