Commit Graph

3303 Commits (2f74dc9e637a636059dcd96c3cef7235033e0356)

Author SHA1 Message Date
Philipp Wiesemann 2f74dc9e63 Fixed typos in shape header. 2017-07-29 23:00:54 +02:00
Philipp Wiesemann 68ca9d9ed1 qnx: Fixed error message. 2017-07-29 23:00:45 +02:00
Philipp Wiesemann cea33bf5b8 aix: Removed unused local variable.
Found by Cppcheck.
2017-07-29 23:00:34 +02:00
Philipp Wiesemann 84aeab17a2 haiku: Changed header paths to be more compatible. 2017-07-29 23:00:14 +02:00
Brandon Schaefer be005b7c78 evdev: Fix 'Syscall param ioctl(TIOCLINUX) points to uninitialised byte'
https://pastebin.com/raw/tQjG0kG0
2017-07-28 12:00:10 -07:00
Sam Lantinga 77ca0f273c Fixed crash if the WASAPI audio device couldn't be recovered 2017-07-27 22:55:18 -07:00
Sam Lantinga 4a734209a3 Fixed infinite recursion if the WASAPI audio device couldn't be recovered 2017-07-27 22:52:19 -07:00
Sam Lantinga f033ce61e1 Fixed typo in WASAPI shutdown code 2017-07-27 02:41:58 -07:00
Brandon Schaefer b0b481d709 [mir] Same no need to wrap this, which is already being done 2017-07-27 08:03:11 -07:00
Brandon Schaefer ecf9f6a13e [mir] Point to SDL_EGL_UnloadLibrary vs doing it our selfs 2017-07-26 18:10:45 -07:00
Ryan C. Gordon 18f2b27b73 Whoops, forgot to commit the actual fix. :) 2017-07-26 13:54:11 -04:00
Ryan C. Gordon 7ecc48c3ba Disable MMX inline assembly on Clang for now.
We should probably rewrite this with SSE compiler intrinsics or something
anyhow.
2017-07-26 13:43:25 -04:00
Ryan C. Gordon 03eaddcad4 Fixed compiler warnings on QNX. 2017-07-23 19:25:16 -04:00
Sam Lantinga 67754af887 Fixed build on older Mac OS X SDKs 2017-07-21 17:28:47 -07:00
Ryan C. Gordon 8ac17a2ae6 sndio: fixed poll() call (thanks, kdrakehp!).
Fixes Bugzilla #3705.
2017-07-20 20:40:17 -04:00
Ryan C. Gordon ee9cc32493 sndio: More improvements to the OpenBSD audio target (thanks, kdrakehp!).
Fixes Bugzilla #3705.
2017-07-20 18:16:02 -04:00
Sam Lantinga 177f19aff0 Fixed bug 3410 - SDL_WINDOW_HIDDEN flag is inaccurate.
Jason Wyatt

After hiding the window, SDL_WINDOW_HIDDEN/SDL_WINDOW_SHOWN flags on a window are correctly updated. However on the next SDL_PumpEvents, they are set incorrectly.

This appears to be because X11_GetNetWMState does not check whether the _NET_WM_STATE property exists (it shouldn't on unmapped windows, see https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#idm140130317598336). This results in an empty list of atoms for the state, which would imply that the window is not hidden.

(Seen on Fedora 24, Gnome)

--

Dan Ginsburg

More details on my proposed patch: I am on Kubuntu 16.04.2.  I ran into this same bug, but with Jason's patch I found that actualType != None was true so the SDL_WINDOW_HIDDEN would still not be set.  My fix instead is to explicitly check for whether the window is unmapped rather than relying on the returned values in XGetWindowProperty.
2017-07-20 10:52:43 -07:00
Sam Lantinga 36998b823e Fixed bug 3689 - MMX YUV renderer crash
felix

The functions in src/render/SDL_yuv_mmx.c contain the following inline assembly snippet:

        /* tap dance to workaround the inability to use %%ebx at will... */
        /*  move one thing to the stack... */
        "pushl $0\n"  /* save a slot on the stack. */
        "pushl %%ebx\n"  /* save %%ebx. */
        "movl %0, %%ebx\n"  /* put the thing in ebx. */
        "movl %%ebx,4(%%esp)\n"  /* put the thing in the stack slot. */
        "popl %%ebx\n"  /* get back %%ebx (the PIC register). */

Here's how it ended up in a binary on my old laptop:

   0xb5c17dbd <ColorRGBDitherYV12MMX1X+93>:	push   $0x0
   0xb5c17dbf <ColorRGBDitherYV12MMX1X+95>:	push   %ebx
   0xb5c17dc0 <ColorRGBDitherYV12MMX1X+96>:	mov    0xc(%esp),%ebx
   0xb5c17dc4 <ColorRGBDitherYV12MMX1X+100>:	mov    %ebx,0x4(%esp)
   0xb5c17dc8 <ColorRGBDitherYV12MMX1X+104>:	pop    %ebx

Apparently the compiler, oblivious to the fact that the assembly snippet manipulates the %esp register, decided to refer to the operand via that same register instead of via %ebp (I believe -fomit-frame-pointer enables this). This causes %ebx to be loaded with the wrong value, which later leads to a null pointer dereference.

Recent GCC can use the %ebx register normally: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47602#c16>. There is even an explicit constraint "b" for allocating it.
2017-07-20 10:48:57 -07:00
Sam Lantinga 2008d86696 Fixed bug 3703 - Missing media keys support on Amazon Fire TV remote control
Holger Schemel

Summary: This patch adds support for key events for the "rewind" and "fast forward" media keys on the Amazon Fire TV remote control.

How to reproduce the problem: Run Android build of SDL2 application on the Amazon Fire TV (tested with "stick" version) and log key events.

Expected behaviour: Every key pressed on the Fire TV remote control should result in a corresponding key event (pressed/released).

Observed behaviour: Of the bottom row of buttons on the Fire TV remote control, only the "play/pause" (middle) button generates a key event, while the "rewind" (left) and "fast forward" (right) buttons to not generate any event at all.

The attached patch adds support for these two missing buttons/keys.

Note 1: Some missing definitions were added for the already existing key codes SDL_SCANCODE_APP1 and SDL_SCANCODE_APP2 (to keep up the correct order of enumerations / array positions when adding the two new key codes).

Note 2: Definitions in "scancodes_linux.h" and "scancodes_xfree86.h" (to also add support for these keys on other platforms) were added without testing. However, I was unable to find corresponding definitions for these two media keys for Windows and Mac OS X.

Note 3: I have also updated the (broken) link to the USB usage page standard PDF document (comment in "include/SDL_scancode.h").
2017-07-20 10:46:38 -07:00
Sam Lantinga 2cc6806472 Fixed bug 3705 - Add capture support to the sndio backend
kdrakehp

The attached patch adds capture support to the sndio backend.

The patch also allows the `OpenDevice' function to accept arbitrary device names.
2017-07-20 10:39:47 -07:00
Alex Szpakowski 01050d4ed1 iOS: Use modern replacements for deprecated functions, when available. 2017-07-15 17:41:58 -03:00
Alex Szpakowski efe179cdfe macOS: Fix compilation when using 10.11 or earlier to build. 2017-07-14 17:42:11 -03:00
Alex Szpakowski 562473c1f4 macOS: Address more compiler warnings when building with a recent deployment target. 2017-07-13 23:09:37 -03:00
Alex Szpakowski bc3ede1ed0 macOS: Replace uses of deprecated Cocoa enum names with modern/consistent equivalents. 2017-07-13 22:59:02 -03:00
Alex Szpakowski e0ea4da4ae Fix a potential crash in macOS 10.7 and earlier. 2017-07-12 21:32:10 -03:00
Alex Szpakowski 8292d73ebb macOS: Expose more display modes on retina screens. Fixes an issue found in BZFlag. 2017-07-12 21:28:32 -03:00
Sam Lantinga 49f846f113 Added support for an XBox One wired controller for Leo L?nnenm?ki 2017-07-11 19:27:50 -07:00
Sam Lantinga 74ca16547c Fixed bug 3699 - Shaped windows are distorted unless width is divisible by 8
Bogomancer

On X11, windows created using the shaped window API appear distorted unless the width of the shape surface is divisible by 8.

Steps to reproduce:

    1) Use your favorite image editor to resize one of the images in test/shapes/ to a width that's not a multiple of 8.
    2) Compile and run test/testshape.c on the image you edited.
    3) The shaped window will appear twisted and distorted.

It appears the bug was not caught sooner because all the test images are either 640 or 256 pixels wide.

I tracked down the bug to SDL_CalculateShapeBitmap() in SDL_shape.c. The shape surface is reduced to a 1-bit-per-pixel mask, but the original code doesn't take into account that X11 apparently wants each scanline to begin on a new byte.
2017-07-11 08:16:00 -07:00
Sam Lantinga 34b29c6ac5 Fixed bug 3688 - cmake / pthread check related patch proposal
Juha Niemim?ki

Fix for PTHREAD_MUTEX_RECURSIVE_NP check and restoring the original flags

Two fixes proposed:

1) Looks like there is a copy-paste issue regarding PTHREAD_MUTEX_RECURSIVE_NP check.

2) Compiler flag restoration doesn't look symmetrical regarding if/endif blocks. Moved to an outer block (if PTHREADS).
2017-07-10 18:40:35 -07:00
Sam Lantinga 3c09265daf Fixed bug 3609 - Windows build fails due to conflicting types for 'XINPUT_GAMEPAD_EX'
Ozkan Sezer

(In reply to Ryan C. Gordon from comment #9)
> I've put this patch in as https://hg.libsdl.org/SDL/rev/7213ae46e870 ...can
> you verify this works on the latest MinGW?
>
> Thanks,
> --ryan.


This patch is wrong: the structure in question has nothing to do with any
gcc version in use.  I suggest reverting this adding a conigury check for
it, instead.  Something like the following should do it: (configure needs
regenerating.)
2017-07-10 18:31:28 -07:00
Sam Lantinga cd79d8ccec Fixed bug 3696 - SDL_ShowMessageBox displays different error from intended
Mark Callow

SDL_ShowMessageBox calls SDL_CaptureMouse which, in the UIKit driver, raises a ?That operation is not supported? error, overwriting the SDL error that an application may be trying to report.

This is because UIKit SDL_CaptureMouse returns SDL_Unsupported() which ends up calling SDL_SetError() which has the following code:

    /* If we are in debug mode, print out an error message */
    SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());

The SDL_GetError call here overwrites the static buffer?..

Although an application can avoid this by using SDL_GetErrorMsg(char* errstr,  int maxlen) to avoid the static buffer, SDL should be fixed.

The fix is simple. In SDL_SetError change

    SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());

to

    SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", error);

where error is the pointer to the buffer where it assembled the message.
2017-07-10 17:16:12 -07:00
Sam Lantinga 37722d01a8 Fixed bug 3697 - Main thread gets stuck on left mouse down
Amruth Raj

- My app runs in full screen to play video(I use SDL_WINDOW_FULLSCREEN_DESKTOP)
- Cmd-tab to go out of full screen to another app
- Cmd-tab again to get back to my app
- Press left mouse button at one of the edges of the screen, don't release yet.
After this point the main thread is stuck until I release the left mouse button and hence video rendering doesn't happen anymore.

On debugging more, I see that thread 0 is stuck as shown below with sendEvent processing left mouse down. It comes out only after it receives a left mouse up. There are some frames below which show NSWindowResizing, but my window flag doesn't have SDL_WINDOW_RESIZABLE set.

Thread 0:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fffbe13d34a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fffbe13c797 mach_msg + 55
2 com.apple.CoreFoundation 0x00007fffa889d434 __CFRunLoopServiceMachPort + 212
3 com.apple.CoreFoundation 0x00007fffa889c8c1 __CFRunLoopRun + 1361
4 com.apple.CoreFoundation 0x00007fffa889c114 CFRunLoopRunSpecific + 420
5 com.apple.HIToolbox 0x00007fffa7dfdebc RunCurrentEventLoopInMode + 240
6 com.apple.HIToolbox 0x00007fffa7dfdcf1 ReceiveNextEventCommon + 432
7 com.apple.HIToolbox 0x00007fffa7dfdb26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
8 com.apple.AppKit 0x00007fffa6396a54 _DPSNextEvent + 1120
9 com.apple.AppKit 0x00007fffa6b127ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
10 com.apple.AppKit 0x00007fffa66f568d +[NSWindow(NSWindowResizing) _mouseHysteresisCheck:withExpiration:andDistance:finalMouseLocation:] + 525
11 com.apple.AppKit 0x00007fffa65eedb5 -[NSWindow(NSWindowResizing) _hitTestWithHysteresisCheck:forEvent:allowWindowDragging:] + 394
12 com.apple.AppKit 0x00007fffa6c8f0db -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 1873
13 com.apple.AppKit 0x00007fffa6c8ca6c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 1942
14 com.apple.AppKit 0x00007fffa6c8bf0a -[NSWindow(NSEventRouting) sendEvent:] + 541
15 org.libsdl.SDL2 0x000000010d46d74a -[SDLWindow sendEvent:] + 90
16 com.apple.AppKit 0x00007fffa6b10681 -[NSApplication(NSEvent) sendEvent:] + 1145
17 org.libsdl.SDL2 0x000000010d46532b -[SDLApplication sendEvent:] + 139
18 org.libsdl.SDL2 0x000000010d466b2f Cocoa_PumpEvents + 495
19 org.libsdl.SDL2 0x000000010d44c1d5 SDL_PumpEvents_REAL + 53
20 org.libsdl.SDL2 0x000000010d44c2f5 SDL_WaitEventTimeout_REAL + 53
21 org.libsdl.SDL2 0x000000010d44c2b7 SDL_PollEvent_REAL + 23
22 org.libsdl.SDL2 0x000000010d51bb24 SDL_PollEvent + 36
23 libTest.dylib 0x000000010cf3e0e8 SDLEventProcessor::processEvents(int) + 568
24 Test 0x000000010cde6bba BrowserApp::RunAppMessageLoop(BAInstData*, CefStringBase, CefStringBase) + 810
25 Test 0x000000010ce04bbc main + 17980
26 libdyld.dylib 0x00007fffbe016235 start + 1

I further noticed that while entering full screen in SDL_cocoawindow.m NSResizableWindowMask is set. If I clear it inside windowDidEnterFullScreen, then, the issue doesn't repro.

This is discussed at https://discourse.libsdl.org/t/main-thread-gets-stuck-on-left-mouse-down/22753/3 and thanks to Eric for the pointers.
2017-07-10 17:07:19 -07:00
Sam Lantinga 66f072ebd8 Updated Visual Studio 2008 project 2017-07-10 15:55:13 -07:00
Philipp Wiesemann 8810023704 Updated generated configure script. 2017-07-09 23:00:43 +02:00
Philipp Wiesemann 707ee5be26 Fixed typo in log message in testime program. 2017-07-09 23:00:35 +02:00
Philipp Wiesemann 44246cdae3 Fixed compiler warning about redundant declaration.
SDL_RecordGesture() is already in the gesture header with additional specifiers.
2017-07-09 23:00:25 +02:00
Philipp Wiesemann 10764b209c Fixed missing audio entries in configure summary. 2017-07-07 23:00:47 +02:00
Philipp Wiesemann c3bf69ca4b haiku: Fixed compiling without OpenGL support. 2017-07-07 23:00:22 +02:00
Philipp Wiesemann fb9c2939c2 qnx: Fixed setting a field twice. 2017-07-07 23:00:10 +02:00
Ryan C. Gordon 1683a0c106 audio: trying to pacify static analysis. 2017-07-05 12:04:37 -04:00
Ryan C. Gordon c80c3419aa x11: pass a long to XChangeProperty, not an int.
The Xlib documentation demands that 32-bit values here be passed in a long,
even when long itself isn't a 32-bit value. Otherwise libx11 might read
memory incorrectly.

Fixes Bugzilla #3692.
2017-07-04 20:44:07 -04:00
Ryan C. Gordon b36755a3fc power: whoops, that should be "==" not "!=". 2017-07-03 16:45:12 -04:00
Ryan C. Gordon c27dc51478 power: Linux /sys/class testing should skip "device" scopes.
(the PS4 game controllers report their batteries through this interface, which
is cool, but not helpful for powering the rest of the system.  :)   )
2017-07-03 16:38:37 -04:00
Philipp Wiesemann 9f99b3d7ee aix: Fixed audio debug output.
DEBUG_AUDIO is checked with #ifdef not #if.
2017-07-02 22:46:49 +02:00
Philipp Wiesemann e6583300e6 haiku: Fixed using wrong constant for internal error handling.
SDL_CreateWindow() worked because ENOMEM is negative on Haiku.
2017-07-02 22:46:23 +02:00
Philipp Wiesemann 4366721b46 qnx: Removed unused bootstrap declaration.
QNX_bootstrap is the VideoBootStrap. QSAAUDIO_bootstrap is still there.
2017-07-02 22:46:00 +02:00
Philipp Wiesemann e3497e7916 qnx: Fixed configure script setting wrong variable. 2017-07-02 22:45:31 +02:00
Ryan C. Gordon 200f782cab qnx: fixed potential buffer overflow. 2017-07-01 19:52:12 -04:00
Ryan C. Gordon 22241ed0b0 Support for QNX 7.0 (thanks, Elad!).
Fixes Bugzilla #3686.
2017-07-01 17:50:47 -04:00
Philipp Wiesemann b1fbab50c5 haiku: Fixed memory leak if destroying window. 2017-07-01 23:01:57 +02:00