Commit Graph

2805 Commits (8b0660b25acd1ce0a5f763fffb3d9e6f0cd8de8f)

Author SHA1 Message Date
Sylvain Becker 56cbe12037 BlitAuto: remove redundant cast to the same type 2019-10-30 14:37:06 +01:00
Sylvain Becker 735691ecd6 Remove nested redundant #ifndef 2019-10-30 14:29:41 +01:00
Sylvain Becker ff0d9245a9 SDL_syspower: remove dead store warning
Value stored to 'str' during its initialization is never read
2019-10-30 14:26:18 +01:00
Sylvain Becker 42153342ab Use fill_function for FillRect SIMD/NEON (bug 4365) 2019-10-29 16:13:41 +01:00
Alex Szpakowski bda618a2af iOS: remove some unused code, minor code style cleanup. 2019-10-27 11:41:48 -03:00
Alex Szpakowski df49e2a572 iOS: replace a deprecated function call with a non-deprecated equivalent. 2019-10-27 11:41:11 -03:00
Sylvain Becker 7289e5e215 Android: remove warning in blit_features
"integer constant not in range of enumerated type 'enum blit_features'"
2019-10-27 15:22:28 +01:00
Sylvain Becker 463bf5c2d8 Android: fix compilation error of SDL_cpuinfo.c on android-r13b (bug 4365) 2019-10-27 14:52:09 +01:00
Ryan C. Gordon c0255be458 x11: check if the X server honored our XMoveWindow() call (thanks, R.E. Rust!).
This can happen if a window is still grabbed when we try to move it, or if
the X11 ecosystem is just in a bad mood, I guess.

This makes sure that SDL will report the correct position for a window;
otherwise, SDL_GetWindowPosition will just report whatever the last
SDL_SetWindowPosition call requested, even if the window didn't actually move.

Fixes Bugzilla #4646.
2019-10-26 23:58:55 -04:00
Alex Szpakowski a963e36e2d macOS: more robust detection and switching of exclusive-fullscreen display modes (bug #4822). 2019-10-26 15:27:51 -03:00
Alex Szpakowski a9b867ab07 macOS Fix potential memory leaks in the Metal renderer caught by clang's static analyzer. 2019-10-26 14:39:50 -03:00
Ryan C. Gordon 1ce1364b29 d3d11: Don't fail if there's no vertex data to upload (thanks, Martin!).
Fixes Bugzilla #4832.
2019-10-26 12:56:18 -04:00
Ryan C. Gordon 6dffc5d461 cpuinfo: Remove incorrect #warning when building for non-ARM architectures. 2019-10-25 00:07:30 -04:00
Ben Avison 72f8044a42 ARM: NEON assembly optimization for SDL_FillRect 2019-10-24 21:17:52 -04:00
Ben Avison 1187b013a5 ARM: NEON assembly optimization for function BlitARGBto565PixelAlpha 2019-10-24 21:17:38 -04:00
Ben Avison 2dfe060564 ARM: NEON assembly optimization for function BlitRGBtoRGBPixelAlpha 2019-10-24 21:17:19 -04:00
Ben Avison 74846657ec ARM: SIMD optimization for 4:4:4:4 to 8:8:8:8 normal blits 2019-10-24 21:15:50 -04:00
Ben Avison becc649ae2 ARM: assembly optimization for SDL_FillRect 2019-10-24 21:15:35 -04:00
Ben Avison 7ac733f025 ARM: SIMD assembly optimization for BGR-to-RGB 32bpp normal blits 2019-10-24 21:15:21 -04:00
Ben Avison 8425d9d5d0 SDL_blit: use a named enum for required hardware bits in dispatch tables 2019-10-24 21:15:09 -04:00
Ben Avison 0eaa52cedf ARM: SIMD assembly optimization for function BlitARGBto565PixelAlpha 2019-10-24 21:13:56 -04:00
Ben Avison 57723b83e8 ARM: SIMD assembly optimization for function BlitRGBtoRGBPixelAlpha
Much of the heavy lifting of this optimization is lifted from the Pixman
project, which is distributed under an MIT-style license. As far as possible,
these elements have been relicensed to the zlib license.
2019-10-24 21:13:05 -04:00
Ben Avison 6a6a05289e ARM: Create configure option --enable-arm-simd to govern assembly optimizations 2019-10-24 21:12:08 -04:00
Alex Szpakowski 59beaccd50 macOS: Expose high dpi-capable display modes on macOS 10.13+.
Fixes an issue in macOS 10.15 where the displayed content would move up after entering, exiting and re-entering exclusive fullscreen when certain display modes were used (bug #4822).
Bug #3949 is also related to this change.
2019-10-24 20:15:54 -03:00
Sylvain Becker 8081f11773 Fixed bug 2014 - Hardcoded srcA value in SDL_Blit_auto.c functions 2019-10-24 18:07:30 +02:00
Sylvain Becker 3a8b899428 Android: remove eglGetProcAdded busted comment (bug #4040) 2019-10-23 11:07:11 +02:00
Sylvain Becker 0f871c033c Fixed bug 4843 - Passing NULL to memset in SDL_PrivateLoadButtonMapping
(Thanks!)
2019-10-23 09:53:23 +02:00
Sylvain Becker ed469fa586 Fixed bug 4842 - Redundant condition in MS_ADPCM_Decode and IMA_ADPCM_Decode
(Thanks!)
2019-10-23 09:36:41 +02:00
Sylvain Becker c9d0e2ae0a Fixed bug 4840 - Read of uninitialized memory in DXGI_LoadDLL (Thanks!) 2019-10-23 09:26:27 +02:00
Sylvain Becker d5d34de4db Fixed bug 4839 - Read of uninitialized memory in Win32_ResizeWindowShape
(Thanks!)
2019-10-23 09:17:53 +02:00
Sylvain Becker 758badffa5 Fixed bug 4841 - Misplaced parenthesis WIN_WindowProc / WM_ACTIVATE / ClipCursor
(Thanks!)
2019-10-23 08:58:52 +02:00
Sylvain Becker b7ab3b3984 Fixed bug 4838 - Use after free in SDL_JoystickUpdate (Thanks!) 2019-10-23 08:50:57 +02:00
Sylvain Becker 3ac67cf458 Fixed bug 4837 - Use after free in SDL_SensorUpdate (Thanks!) 2019-10-23 08:46:59 +02:00
Sam Lantinga 5025109f29 Fixed accidental whitespace 2019-10-22 15:43:58 -07:00
Sam Lantinga 9da4bfc141 Added support for the Power A Nintendo Switch Enhanced Wireless Controller 2019-10-22 10:57:07 -07:00
Sam Lantinga f96da11f93 Reordered Power A Switch controllers so they're grouped together 2019-10-22 10:28:51 -07:00
Sam Lantinga 9e7894efac Added support for the PowerA - Super Mario Controller 2019-10-22 10:27:30 -07:00
Ryan C. Gordon 9ececeeaa4 cpuinfo: Use a better default alignment value (thanks, Simon!).
Fixes Bugzilla #4835.
2019-10-20 22:17:59 -04:00
Sam Lantinga cdc7181e6d Don't try to use the Xbox HID protocol with the NVIDIA Shield controllers 2019-10-19 01:54:02 -07:00
Sylvain Becker 336a75491e remove warning prototype SDL_ExitProcess() 2019-10-19 09:23:40 +02:00
Ozkan Sezer 9c14c789ad updated includes for _exit() 2019-10-18 23:10:00 +03:00
Sylvain Becker 24bee6e5e2 Add internal function SDL_EGL_GetVersion() 2019-10-18 21:47:30 +02:00
Sam Lantinga b060b2eadd Fixed whitespace 2019-10-18 08:56:54 -07:00
Sylvain Becker 412ab7e1aa Fixed bug 4829 - Sensor events incorrectly disabled 2019-10-18 14:23:37 +02:00
Sylvain Becker e5bd20030d Android: enable eglGetProcAddress (bug #4040, bug #4794) 2019-10-18 14:08:07 +02:00
Sylvain Becker 03f27a3a75 Add robustness getting the EGL version (see bug #4040) 2019-10-18 13:27:58 +02:00
Ryan C. Gordon 3ecce84749 egl: adjust how we load symbols in SDL_EGL_GetProcAddress.
Use eglGetProcAddress for everything on EGL >= 1.5. Try SDL_LoadFunction first
for EGL <= 1.4 in case it's a core symbol, and as a fallback if
eglGetProcAddress fails. Finally, for EGL <= 1.4, fallback to
eglGetProcAddress to catch extensions not exported from the shared library.

(Maybe) Fixes Bugzilla #4794.
2019-10-18 00:07:32 -04:00
Sam Lantinga 4f304fd88c Added support for the BDA PS4 Fightpad 2019-10-17 18:07:52 -07:00
Sam Lantinga a1349d4627 Build fix for the build fix 2019-10-17 17:51:36 -07:00
Sam Lantinga 097b9c3084 Better fix for iOS build 2019-10-17 17:51:49 -07:00
Sam Lantinga 8984d25bfa Fixed build on iOS 2019-10-17 17:47:27 -07:00
Sam Lantinga bf9092cf4a Removed unused variable 2019-10-17 17:47:11 -07:00
Sam Lantinga b3470f04b1 Added the hint SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS to control whether Nintendo Switch controllers use their button labels or button positions for game controller button reporting. 2019-10-17 17:32:47 -07:00
Sam Lantinga e6ac16ef2f Added support for third party Nintendo Switch controllers that don't support the full protocol 2019-10-17 16:59:05 -07:00
Sam Lantinga 43c5f62d44 Merged latest data from Steam 2019-10-17 16:14:17 -07:00
Alex Szpakowski 216f5b98ac metal: Fix compilation when using older Apple SDKs (bug #4828). 2019-10-17 18:48:58 -03:00
Ryan C. Gordon 6be83e6141 emscripten: Patched to compile (thanks, Caleb!).
Fixes Bugzilla #4827.
2019-10-16 13:54:35 -04:00
Sam Lantinga 1b4de45d05 Fixed bug 4785 - SDL_CreateRGBSurface creates 1-bit surfaces with zero pitch
Sylvain

Seems to be a regression in this commit: https://hg.libsdl.org/SDL/rev/7fdbffd47c0e
SDL_CalculatePitch() was using format->BytesPerPixel, now it uses SDL_BYTESPERPIXEL().

The underlying issue is that "surface->format->BytesPerPixel" is *not* always the same as SDL_BYTESPERPIXEL(format);
BytesPerPixel defined as format->BytesPerPixel = (bpp + 7) / 8;
vs
#define SDL_BYTESPERPIXEL(format)  ... (format & 0xff)

Because of SDL_pixels.h format definitions, one is giving a BytesPP 1, the other 0.
2019-10-16 08:45:54 -07:00
Ryan C. Gordon ed7483f82c x11: On macOS, look for X11 install in /opt/X11 instead of /usr/X11R6.
This is where Apple installs XQuartz now (and apparently, the compatibility
symlink at /usr/X11R6 can be missing).

Fixes Bugzilla #4706.
2019-10-15 22:36:08 -04:00
Ryan C. Gordon 02a2ec986f video: Make sure SDL_FillRects()'s fill_function isn't used unitialized. 2019-10-15 14:55:09 -04:00
Ryan C. Gordon 9f636be8c0 video: Removed unused variables. 2019-10-15 14:04:43 -04:00
Ryan C. Gordon e23067eab2 video: speed up SDL_FillRect[s] slightly (thanks, Jakub!).
"This patch does the following:

* Instead of SDL_FillRects calling SDL_FillRect in a loop the opposite
happens -- SDL_FillRect (a specific case) calls SDL_FillRects (a general case)
with a count of 1

* The switch/case block is moved out of the loop -- it modifies the color
once and stores the fill routine in a pointer which is then used throughout
the loop"

Fixes Bugzilla #4674.
2019-10-15 14:03:01 -04:00
Ryan C. Gordon e9c1e1269c test: Fixed wrong verbose flag check (thanks, watcom.hecht!).
Fixes Bugzilla #4826.
2019-10-15 12:02:19 -04:00
Ryan C. Gordon aa0a6518a2 test: Fixed compiler warning on Visual Studio. 2019-10-15 08:54:25 -04:00
Cameron Gutman 31ee4d3d81 Reduce delay to 1 ms in SDL_WaitEventTimeout() and SDL_WaitEvent()
The 10 ms delay effectively caps input polling at 100 Hz and rendering
at 100 FPS if applications use these functions in their event loop. The
delay may also lead to dropped frames even at 60 FPS due if they are
unlucky enough to hit the delay and rendering takes longer than 6 ms.
2018-11-03 15:46:42 -07:00
Sam Lantinga 526b9bdf1c Backed out changeset b0241180cdc5
Better commit incoming!
2019-10-14 22:41:27 -07:00
Ryan C. Gordon cd8652d8f3 events: SDL_WaitEvent()'s polling loop now sleeps 1ms instead of 10ms.
Fixes Bugzilla #4356.
2019-10-15 01:13:44 -04:00
Ryan C. Gordon d5e378d198 cocoa: Implement SDL_WINDOW_ALWAYS_ON_TOP support (thanks, Gabriel!).
Fixes Bugzilla #4809.
2019-10-15 00:59:10 -04:00
Ryan C. Gordon ec04110d8e dynapi: Deal with failure cases better, other fixes.
Fixes Bugzilla #4803.
2019-10-14 12:41:06 -04:00
Sylvain Becker fe20c35be8 Fixed race condition when scaling Touch events, and changing the renderer
target.
Always read the output size of the main renderer.
(similar to bug 2107)
2019-10-14 16:40:46 +02:00
Alex Szpakowski 074f6a512d macOS: Fix the initial window background not being black since macOS 10.14.2 or so, when OpenGL is used (bug #4810). Also fixes "CGContext: invalid context 0x0" errors when an OpenGL window is created (bug #4470). 2019-10-14 00:51:53 -03:00
Alex Szpakowski 009226c61e macOS: Fix non-highdpi OpenGL contexts not scaling properly in macOS 10.15 (bug 4810 and 4822). 2019-10-13 21:39:20 -03:00
Sylvain Becker 72660a51dd Fixed bug 4825 - SDL Renderer OpenGL: Buffer overflow (SDL_RENDERCMD_DRAW_LINES) 2019-10-13 20:52:52 +02:00
Alex Szpakowski f8bdefe1b5 macOS: Fix asserts in SDL_Render's metal scissor code when the window is resized. 2019-10-13 15:18:28 -03:00
Alex Szpakowski 1773da89f9 macOS: Fix a new issue in 10.15 where the window decorations don't always get restored after SDL_SetWindowFullscreen(window, 0). 2019-10-13 12:16:40 -03:00
Sylvain Becker 3b0dcaf474 Fixed bug 4797 - SDL fails to compile with Mesa Master (thanks Michael Olbrich!)
fix building with Mesa 19.2

With Mesa 19.2 building fails with:

/include/GLES/gl.h:63:25: error: conflicting types for 'GLsizeiptr'

The same type is defined in include/SDL_opengl.h for OpenGL and the two
headers should not be included at the same time.
This was just never noticed because the same header guard '__gl_h_' was
used. This was changed in Mesa. The result is this error.

Fix this the same way GLES2 already handles this: Don't include the GLES
header when the OpenGL header was already included.
(https://hg.libsdl.org/SDL/rev/6a3670d6108d)
2019-10-12 18:47:56 +02:00
Sylvain Becker 97901b9f97 Fixed bug 4820 - SDL assumes RW_SEEK_SET == SEEK_SET 2019-10-10 17:21:46 +02:00
Ryan C. Gordon a747106c97 linux: If D-Bus isn't available on the system, don't keep trying to load it.
Fixes Bugzilla #4476.
2019-10-09 19:38:16 -04:00
Ryan C. Gordon cf092eca90 mouse: Save initial position yet even if xrel and yrel are 0.
The X11 target sets mouse->last_x and last_y in EnterNotify and then calls
SDL_SendMouseMotion(), which throws away the new position because it matches
the mouse->last_x and last_y we just set, meaning that if the pointer is
in the window when it created, SDL_GetMouseState() will report a position of
0,0 until a MotionNotify event (the pointer moves) arrives and corrects the
mouse state.

Mostly fixes Bugzilla #1612.
2019-10-09 13:42:13 -04:00
Ryan C. Gordon b38a5ba062 dynapi: Make gendynapi.pl work on older Perl releases. 2019-10-05 20:19:10 -04:00
David Ludwig c61ca915fb WinRT: fix a link-time error when building UWP + x64 2019-10-02 14:55:02 -04:00
Sam Lantinga 3b3dbb5adb Removed unused volume check interval 2019-10-01 08:50:04 -07:00
Sylvain Becker 7d47f526a7 SDL_LockTextureToSurface: robustness of locked region compared to texture size 2019-10-01 09:26:30 +02:00
Ozkan Sezer a664e95d65 dynapi: move new SDL_LockTextureToSurface addition to the end of file. 2019-10-01 00:05:50 +03:00
Sylvain Becker 1ae61f1009 Added a helper function SDL_LockTextureToSurface()
Similar to SDL_LockTexture(), except the locked area is exposed as a SDL surface.
2019-09-30 20:58:44 +02:00
Sam Lantinga 191fe25b1a Fixed rtkit feature guard 2019-09-27 15:21:31 -07:00
Sam Lantinga 84dc44e24d Fix the RealtimeKit dbus include guards
The SDL_USE_LIBDBUS define is set inside SDL_debug.h, therefore the
circular dependency made it impossible for this feature to be enabled.

Instead, guard SDL_dbus.h based on the autoconf variable HAVE_DBUS_DBUS_H

Additionally, fix one of the rtkit comments. CAP_SYS_NICE isn't required
to achieve high priority. But there is some scheduler config that rtkit
needs the app to setup.
2019-09-27 15:21:27 -07:00
Ryan C. Gordon 4001e6b351 stdlib: Patched to compile. 2019-09-26 13:44:49 -04:00
Ryan C. Gordon 987aa3113c stdlib: Try to coerce VS2019 to not replace some loops with memset() calls.
Fixes (?) Bugzilla #4759.
2019-09-26 12:55:05 -04:00
Ryan C. Gordon aef1ed4ac6 audio: Set (something close to) the correct silence value for U16 audio.
Partially fixes Bugzilla #4805.
2019-09-25 15:40:27 -04:00
Ryan C. Gordon 693755f0b2 coreaudio: Apple doesn't support U16 data, so convert in that case. 2019-09-25 15:07:07 -04:00
Brandon Schaefer ee6d504ae9 offscreen: Define missing define on a older EGL for an EXT function which it wont have 2019-09-24 17:49:53 -04:00
Brandon Schaefer 8a41948e7f offscreen: Avoid using EGLDeviceEXT as it causes issues with older platforms, which is just a void* 2019-09-24 17:27:51 -04:00
Brandon Schaefer 68985371a0 offscreen: Add new video driver backend Offscreen
The Offscreen video driver is intended to be used for headless rendering
  as well as allows for multiple GPUs to be used for headless rendering

Currently only supports EGL (OpenGL / ES) or Framebuffers
Adds a hint to specifiy which EGL device to use: SDL_HINT_EGL_DEVICE
Adds testoffscreen.c which can be used to test the backend out
Disabled by default for now
2019-09-24 16:36:48 -04:00
Jinke Fan abd1dd6617 Add Hygon Dhyana processor support
Background:
    Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture
    between AMD and Haiguang Information Technology Co.,Ltd., aims at
    providing high performance x86 processor for China server market.
    Its first generation processor codename is Dhyana, which
    originates from AMD technology and shares most of the
    architecture with AMD's family 17h, but with different CPU Vendor
    ID("HygonGenuine")/Family series number(Family 18h).

Related Hygon kernel patch can be found on:
http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn

Best regards.
2019-05-15 19:54:36 +08:00
Sam Lantinga 3fe2d8368c Updated SDL development builds to version 2.0.11 2019-09-22 10:37:16 -07:00
Sam Lantinga cbde0ffa3d The PS4 is ignoring the volume values in the report, so we don't need to fill them in. 2019-09-19 16:50:49 -07:00
Sylvain Becker 79e388bfd8 Fixed bug 4798 - PNG w/transparency breaks in SDL 2.0.10 but works in SDL 2.0.9 2019-09-10 17:12:34 +02:00
Sam Lantinga 791df27a30 Fixed compiler warning on Android 2019-09-09 13:50:46 -07:00
Sam Lantinga 715e070d29 SDL_blit_N.c: Correct vec_perm() application on little-endian 64-bit PowerPC
The LE transformation for vec_perm has an implicit assumption that the
permutation is being used to reorder vector elements (in this case 4-byte
integer word elements), not to reorder bytes within those elements.  Although
this is legal behavior, it is not anticipated by the transformation performed
by the compilers.

This causes pygame-1.9.1 test failure on PPC64LE because blitted pixmaps are
corrupted there due to how SDL uses vec_perm().

From RedHat / Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1392465
Original patch was provided by: Menanteau Guy <menantea@linux.vnet.ibm.com>
2019-09-06 08:50:19 -07:00
Conn O'Griofa 2d37d29183 KMSDRM_GLES_SwapWindow: fix non-vsync case
If KMSDRM_drmModeSetCrtc is called when the swap interval is
set to 0, the driver behaves as though vertical sync is engaged by
limiting framerate to the refresh rate, but performance is much worse
than with vertical sync enabled.

Resolve this issue by ensuring that the Crtc is only set up once,
and KMSDRM_drmModePageFlip is called, albeit without any followup
queueing or waiting for flips.
2019-09-06 08:44:46 -07:00
Sam Lantinga aaec90e5c5 Fixed bug 4789 - Linux accelerometers no longer available as joysticks
Daniel Drake

A long time ago, it was possible to play neverball on Linux using the accelerometer found in HP laptops.

The kernel exposes the accelerometer as a joystick (/dev/input/jsX) as well as an evdev device (/dev/input/eventX). I guess it worked fine when SDL was using the js interface, but then stopped working here: http://hg.libsdl.org/SDL/rev/fdaeea9e7567

Looking at current code which uses udev to discover joysticks, it looks for the udev tag ID_INPUT_JOYSTICK.

However udev's internal input_id logic specifically tags accelerometers as ID_INPUT_ACCELEROMETER and nothing else.

This looks like a good fit for SDL_HINT_ACCELEROMETER_AS_JOYSTICK.
2019-09-06 08:42:54 -07:00
Ozkan Sezer 8a394209c4 SDL_windowsevents.c: remove isVistaOrNewer (not used since 8cb1dc50bb28) 2019-09-05 20:47:20 +03:00
Sylvain Becker bf2f4703f2 SDL_windowsmessagebox.c: remove unused variable 2019-09-05 10:49:53 +02:00
Sylvain Becker 1b5e3c19a2 SDL_bmp.c: remove unused variable warnings 2019-09-05 10:08:47 +02:00
Sam Lantinga e5580e18ba x11: add a hint to force the VisualID used when creating a window. 2019-09-04 09:27:58 -07:00
Sam Lantinga 892c8d5058 Fixed bug 4536 - Heap-Buffer Overflow in SDL_GetRGB pertaining to SDL_pixels.c
Ozkan Sezer

As for the issue: This bmp reports bpp=0, therefore SDL_CalculatePitch()
returns pitch==0, which is then fed to SDL_malloc() (which is malloc())
and malloc(0) returns _something_ which is not NULL but not someting
that we expect..  Then testsprite.c:LoadSprite() accesses the pixels
as *(Uint8*)pixels which valrind reports as:

==15533== Invalid read of size 1
==15533==    at 0x8048C08: LoadSprite (testsprite.c:45)
==15533==    by 0x80492FC: main (testsprite.c:224)
==15533==  Address 0x449e588 is 0 bytes after a block of size 0 alloc'd
==15533==    at 0x40072B2: malloc (vg_replace_malloc.c:270)
==15533==    by 0x4045719: SDL_CreateRGBSurface (SDL_surface.c:126)
==15533==    by 0x40403C1: SDL_LoadBMP_RW (SDL_bmp.c:237)
==15533==    by 0x8048BB2: LoadSprite (testsprite.c:36)
==15533==    by 0x80492FC: main (testsprite.c:224)

Besides, valrind also reports this:
==15533== Conditional jump or move depends on uninitialised value(s)
==15533==    at 0x40403F3: SDL_LoadBMP_RW (SDL_bmp.c:247)
==15533==    by 0x8048BB2: LoadSprite (testsprite.c:36)
==15533==    by 0x80492FC: main (testsprite.c:224)


Easy/quick solution would be early-rejecting a bmp with 0 bpp from SDL_bmp.c:SDL_LoadBMP_RW()
2019-09-03 11:55:20 -07:00
Ozkan Sezer b21338eb54 SDL_bmp.c: restore most of the original formatting. 2019-09-02 12:35:00 +03:00
Ryan C. Gordon 847bd8d983 direct3d: Be more aggressive about resetting state when textures go away.
Fixes Bugzilla #4768.
2019-09-02 00:11:58 -04:00
Ryan C. Gordon a3804ba1da d3d11: Fixed VB state, avoiding unnecessary recreation (Thanks, Alex!).
Fixes Bugzilla #4779.
2019-09-01 22:41:44 -04:00
Sylvain Becker 6c295129ba LoadBMP: fix some warnings 2019-08-31 22:58:11 +02:00
Sylvain Becker 830979c555 LoadBMP: use code from SDL_image which allows loading compressed BMP files 2019-08-31 22:52:15 +02:00
Sam Lantinga cc64b369fb Allow mouse messages from Wacom pens, e.g. right click pen buttons, etc. 2019-08-30 15:32:15 -07:00
Sam Lantinga afb9ff9507 Fixed bug where the Steam overlay would generate an event and stop input processing for the frame. 2019-08-30 08:03:19 -07:00
Ozkan Sezer 9c8e403f6b use 'U' suffix on constants instead of (unsigned int) cast. 2019-08-30 11:35:20 +03:00
Sylvain Becker d52080c0ab Android: minor warning 2019-08-30 09:00:06 +02:00
Sylvain Becker 70dc8d1648 Android: fix corresponding warnings 2019-08-30 08:55:20 +02:00
Sam Lantinga 13c4d5e7e3 Fixed Windows relative mouse coordinates when capturing the mouse over RDP 2019-08-26 17:43:01 -07:00
Alex Szpakowski 0c26373842 gl/gles/gles2 render: fix SDL_RenderClear being affected by the clip rect in some situations. 2019-08-26 18:49:04 -03:00
Sam Lantinga ce3b16fc9e Fixed bug 4475 - add Gasia Co. Ltd PS(R) Gamepad support
Frank

This gamepad/controller is sold in Germany https://www.amazon.de/gp/product/B01AQTPSA6/ref=ppx_yo_dt_b_asin_title_o03__o00_s00 but isn't supported right now. It identifies as "Gasia Co. Ltd PS(R) Gamepad"
2019-08-26 10:08:25 -07:00
Ozkan Sezer 1e47790c8d RPI_FreeCursor: set global_cursor to NULL to prevent double-free (bug 4769) 2019-08-26 18:41:40 +03:00
Sylvain Becker 2cb26188e1 Fixed bug 1663 - SDL_EventState(SDL_DOLLARGESTURE,SDL_IGNORE) etc. has no effect 2019-08-24 20:40:37 +02:00
Sam Lantinga 455944c870 Fixed whitespace 2019-08-22 16:12:16 -07:00
Sam Lantinga b521df66c3 [SDL][IOS] Audio fix - applies stream to sound data when resampling or reformatting is required. 2019-08-22 16:09:42 -07:00
Sam Lantinga 5c15e81cfb Prevent the SPEEDLINK COMPETITION PRO joystick from switching into Android controller mode when enumerated over HID on Windows 10. 2019-08-22 15:58:00 -07:00
Alex Szpakowski dd29abb478 macOS: Use the proper type (NSSize instead of CGSize) for the bounds of metal views. 2019-08-22 19:23:52 -03:00
Sylvain Becker 2937317f12 Fixed bug 4172 - remove logging Gesture error "NumPoints = 0"
- not necessary when app isn't recording gesture.
- happen when gesture path has less than 2 different points
2019-08-22 10:15:33 +02:00
Sylvain Becker 05f35c2420 Fix audio conversion U16_to_F32_SSE2 (bug 4186) 2019-08-19 21:23:47 +02:00
Sylvain Becker 1d220401ce Fixed bug 4186 - ARM/NEON audio converters cause strange clicking noises
reverse the order when storing ouput buffer
2019-08-19 20:35:02 +02:00
Sylvain Becker c0fc94f2de Fixed bug 4186 - ARM/NEON audio converters cause strange clicking noises
reverse the order when storing ouput buffer
2019-08-19 16:57:15 +02:00
Alex Szpakowski bfdb0e9743 metal renderer: optimize SDL_RenderFillRect slightly. 2019-08-18 10:38:32 -03:00
Alex Szpakowski ff7888e698 render: fix colors not being set properly after the previous change 2019-08-18 09:35:11 -03:00
Alex Szpakowski 1be03b4089 render: avoid a couple redundant memcmp calls in all drawing functions. Improves performance slightly. 2019-08-17 22:26:33 -03:00
Alex Szpakowski e8278d0d5b metal renderer: use vertex attributes instead of indexing into a buffer with the vertex id in the shader. Allows for more flexibility with vertex setup in the future.
Also optimize vertex buffer binding slightly.
2019-08-17 16:53:08 -03:00
Alex Szpakowski 55a46abf0a metal renderer: more closely match buffer data alignment requirements from the metal specification. 2019-08-17 01:09:30 -03:00
Alex Szpakowski 69c6924ccc render: simplify vertex and uniform data allocation. Improves performance of various SDL_Render functions (bug #4764). 2019-08-17 00:43:44 -03:00
Alex Szpakowski e5acccc7c3 metal renderer: use the device address space instead of the constant address space for colors.
It doesn't negatively impact GPU performance in my tests, and it removes the need for 256 byte memory alignment of color data on macOS.
2019-08-17 00:37:22 -03:00
Alex Szpakowski 3fb5cabe5e metal: Update compiled shaders based on compilation script changes 2019-08-16 22:13:30 -03:00
Alex Szpakowski 9e57e3e595 metal: Update shader compilation script with fixes for newer xcode versions and for running on older platforms 2019-08-16 22:11:50 -03:00
Alex Szpakowski 79cd6cfc94 iOS: Fix issues with Split VIew on iPad (bugs #4586, #4705). 2019-08-15 19:38:12 -03:00
Ethan Lee c76f0f5b6b hidapi: Explicitly include locale.h, for setlocale 2019-08-06 23:08:01 -04:00
Sam Lantinga 2a1adf71ab Fixed bug 4747 - [Patch] SDL_ShowMessageBox ignores BUTTON_RETURNKEY_DEFAULT flag
Caleb Cornett

SDL_ShowMessageBox on UIKit doesn't do anything special with buttons that are marked with the flag SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT. According to Apple's documentation on UIAlertController, a button can respond to a return key if it's marked as the preferredAction of the controller. SDL doesn't set a preferredAction currently, so I've attached a patch to fix that.
2019-08-05 23:52:16 -07:00
Sam Lantinga afdb40af61 Fixed bug 4689 - SDL fails to detect compositor shutdown on Wayland -- program keeps running
M Stoeckl

To reproduce:

1. Run any SDL-based program with a Wayland compositor, orphaning it so that it doesn't have an immediate parent process. (For example, from a terminal, running `supertux2 & disown`.) The program should use the wayland backend, i.e. by setting environment variable SDL_VIDEODRIVER=wayland.
2. Kill the compositor process.

Results:

- The SDL program will keep running.

Expected results:

- The SDL program should close. (What close should mean here, I'm not sure - is injecting an SDL_Quit the appropriate action when a video driver disconnects?)

Build data:

2019-06-22, hg tip (12901:bf8d9d29cbf1), Linux, can reproduce with sway, weston, and other Wayland oompositors.
2019-08-05 23:38:48 -07:00
Ethan Lee aa09e61223 Port libusb hid.c to SDL, add to MinGW configure 2019-08-04 00:01:38 -04:00
Alex Szpakowski aebaa316c7 Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h. 2019-08-05 12:35:32 -03:00
Alex Szpakowski f3683d3a09 macOS: fix a typo in touch handling code. 2019-08-04 23:30:55 -03:00
Alex Szpakowski 109cbd6e8b Fix touch-related compile errors on Linux. 2019-08-04 16:56:40 -03:00
Alex Szpakowski 2fb71ac52d Implement touch window IDs on x11/xinput2. 2019-08-04 00:34:23 -03:00
Sam Lantinga 63197c4338 Fix bug where the wrong button was the default in the old message box because buttons were added backwards, breaking the indexing used by GetButtonIndex.
Add messagebox flags to explicilty request left-to-right button order or right-to-left.  If neither is specified it'll be some platform default.
2019-08-02 17:19:50 -07:00
Sam Lantinga d52ffcf985 Added support for a few controllers on Android 2019-08-02 17:12:49 -07:00
Alex Szpakowski d5ec735a33 Add a windowID field to SDL_TouchFingerEvent (bug #4331).
This is unimplemented on some platforms and will cause compile errors when building those platform backends for now.
2019-08-01 18:22:12 -03:00
Ozkan Sezer c37c6cbbca use WIN_IsWindowsVistaOrGreater() from core/windows for isVistaOrNewer 2019-07-31 23:37:02 +03:00
Ethan Lee f7d82e5616 hidapi: Add SDL_hidapi.c, allows support for multiple hidapi backends.
This is currently supported on Linux and macOS. iOS and Android are not
supported at all, Windows support could be added with some changes to the libusb
backend. The Visual Studio and Xcode projects do not use this feature.

Based on Valve Software's hid.cpp, written in collaboration with Andrew Eikum.
2019-07-31 12:20:55 -04:00
Sam Lantinga c10a87429d Make sure HIDAPI is initialized whenever we call HIDAPI_IsDevicePresent() 2019-07-31 10:20:37 -07:00
Andrew Eikum c172f36bf4 joystick: Ensure HIDAPI is initialized before calling it 2019-07-31 11:14:48 -05:00
Ozkan Sezer 1b7fc81e3f minor whitespace tidy-up. 2019-07-31 19:40:50 +03:00
Sam Lantinga f8400cbba9 Fixed bug 4692 - Command line parsing
Galadrim

As I have seen, SDL implements its own command line parser for Windows in SDL_windows_main.c. Unfortunately, it doesn't seem to allow command line arguments with trailing backslashes if quoting is required.

Usually, when you write an application that gets command line arguments passed as argc and argv, the parsing is done by parse_cmdline. The Windows API also provides the function CommandLineToArgvW, so an application can parse itself if only the command line string is provided. Both functions behave almost identically according to their documentation. If the argument "\\" (including the quotes) is passed, they both turn it into a single backslash.

The SDL command line parser on the other hand doesn't recognize the second quote character as the closing character in this example and therefore includes it in the parsed argument. The parser does not count the number of backslashes preceding a quote. It always treats a quote as escaped if a backslash is in front of it. Therefore, it should be impossible to quote and escape an argument correctly, if it has a trailing backslash and contains characters that require quoting.

Of course, each application is allowed to implement its own parsing rules, so SDL is free to do so. But the problem I see is that there are arguments, that are impossible to be passed to the parser correctly, as I described above. Is there a reason, why SDL does not simply use CommandLineToArgvW instead of implementing its own parser?

Here are some links that show that correct argument parsing, as it is usually done in Windows, is quite complicated:

https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-commandlinetoargvw

http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/
2019-07-31 09:11:20 -07:00
Ozkan Sezer 4953e050f5 use SDL_zeroa at more places where the argument is an array. 2019-07-31 05:11:40 +03:00
Ozkan Sezer 7a47c292c0 Fix bug 4746 - introduce SDL_zeroa macro. 2019-07-31 01:22:02 +03:00
Ozkan Sezer f96d7cc0fd minor build fix. 2019-07-31 01:19:26 +03:00
Ozkan Sezer fdc67c3c60 MS_ADPCM_Decode: fix assigning an array to a pointer (lose '&'). 2019-07-31 00:10:00 +03:00
Ozkan Sezer 2ea0ec6207 better readability.. 2019-07-31 00:07:15 +03:00
Ozkan Sezer 5f04ed5fbd SDL_iconv_string: add (char*) casts before SDL_malloc() calls. 2019-07-31 00:06:50 +03:00
Ozkan Sezer ceee7def84 minor build fixes. 2019-07-31 00:05:28 +03:00
Sam Lantinga 97fefd0509 Fixed bug 4538 - validate image size when loading BMP files 2019-07-30 11:00:00 -07:00
Andrew Eikum 738dff4bbc hidapi: Update repository URLs
Upstream hidapi has been re-homed. Update the repo URLs to help guide folks
where to contribute fixes.
2019-07-25 08:05:13 -05:00
Sam Lantinga 31cb854f98 Fixed bug 4745 - 2.0.10 fails to build against macOS 10.11 SDK
Joshua Root

NSEventSubtypeMouseEvent was added in 10.12, so it needs to be defined on 10.11 as well
2019-07-30 10:04:46 -07:00
Sylvain Becker 18bcafffce Fixed bug 4739 - Android: loading native libs, generated by bundletool (Thanks akk0rd87) 2019-07-27 20:21:42 +02:00
Sam Lantinga dc714389f0 Don't call hid_enumerate() if the HIDAPI drivers are all disabled 2019-07-25 15:21:44 -07:00
Andrew Eikum 0e9560aea2 hidapi: Zero out new hid_device_info structs 2019-07-23 14:41:00 -05:00
Ethan Lee bf9bf602e7 Copypaste SDL_NSLog to UIKit backend, document it as such 2019-07-17 23:20:57 -04:00
Sam Lantinga e954e32b0e Fixed bug 4726 - Fix for tvOS GetPrefPath
Caleb Cornett

Unlike iOS and macOS, tvOS does not have any persistent local storage. In fact, the ApplicationSupport directory pointed to by the existing Cocoa GetPrefPath() throws an error whenever any attempt is made to access it. To get any local storage on an Apple TV, our only option is to use a temporary cache directory.

This patch changes the tvOS PrefPath to this cache directory and also logs a critical warning that this if developers want their save data to persist across game sessions, they must use some form of iCloud storage.
2019-07-18 19:33:17 -07:00
Sam Lantinga 52e62329c8 Fixed build error 2019-07-17 16:47:19 -07:00
Sam Lantinga a06d8cd0d4 Merged latest changes from Steam into controller_type.h 2019-07-17 16:47:17 -07:00
Sam Lantinga 1dc24160a1 Add linked list of opened HID devices to prevent accessing already freed devices in device removal callback that is sometimes called even after being unregistered 2019-07-17 16:47:13 -07:00
Sam Lantinga 89de2512e5 Added support for the Victrix Pro Fight Stick for PS4 2019-07-17 13:01:44 -07:00
Cameron Gutman a4bfe2a4ae Allow hotplugging joysticks without udev 2019-06-24 21:08:26 -07:00
Sam Lantinga e7c2cf107a Fixed bug 4704 - SDL_HINT_ANDROID_SEPERATE_MOUSE_AND_TOUCH on Windows?
superfury

I notice that, somehow, when locking the mouse into place(using SDL_SetRelativeMouseMode), somehow at least the movement information gets through to both mouse movement and touch movement events?

My app handles both, so when moving a touched finger accross the app(using RDP from an Android device) I see the mouse moving inside the app when it shouldn't(meaning that the touch movement is ignored properly by the app(press-location dependant) but the mouse movement is still performed due to the mouse movement events)?
2019-07-15 09:36:53 -07:00
Sam Lantinga 064d1223f0 Fixed bug 4723 - Generic Xbox pad controller bindings seem odd/broken
alexrice999

I have a knock off wired xbox 360 controller called afterglow for xbox 360 controller. Despite there being a few afterglow controllers in the controller mapping the guid of my controller seems to map to Generic Xbox pad. This binding is as follows:
```
 "030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
```
When running openmw I have a strange issue that the joysticks work for up and down movements but not for side to side. I managed to track this down to the side to side events being classified as joystick events instead of gamepad events.
I believe this is due to both "leftstick" and "leftx" being bound to "a0" which seems odd to me. If I change openmw's mappings to remove these the controller works as expected. I was hoping someone who knows a lot more than me (as I have only been exploring this today trying to fix my controller) would know what is happening
2019-07-14 16:59:39 -07:00
Jimb Esser 6a7161dceb Blacklist Corsair device causing hang 2019-07-14 16:48:31 -07:00
Alex Szpakowski 8fb8adfc90 macOS: Fix SDL_GL_CreateContext/MakeCurrent on non-main threads causing a Main Thread Checker warning when built with Xcode 11 / the macOS 10.15 SDK.
Fixes bug #4714.
2019-07-13 17:04:02 -03:00
Ryan C. Gordon 73536d93ea ios: Fixed MFi guide button not being detected (thanks, Caleb!).
Fixes Bugzilla #4721.
2019-07-12 21:28:43 -04:00
Ryan C. Gordon 27ad8e5d72 cocoa: Set keyboard mod state correctly when turning off capslock.
Fixes Bugzilla #4716.
2019-07-11 01:07:14 -04:00
Sylvain Becker 86965eecd3 x11: prevent a synthetic mouse event when using a touchscreen
With multitouch, register to receive XI_Motion (which desctivates MotionNotify),
so that we can distinguish real mouse motions from synthetic one.

(bug 4690)
2019-07-10 10:06:28 +02:00
Ryan C. Gordon 6ef01e5236 x11: set some modality things on message boxes with parent windows. 2019-07-09 17:28:02 -04:00
Sylvain Becker 6625203514 SDL_Mouse/Touch: discard synthetic events when hints are not set.
Those are generated/flagged by platform layer.
2019-07-09 11:46:42 +02:00
Cameron Gutman 7e09718dfe Ignore synthetic mouse events generated for touchscreens
Windows generates fake raw mouse events for touchscreens for compatibility
with legacy apps that predate touch support in Windows. We already handle
touch events explicitly, so drop the synthetic events to avoid duplicates.
2019-07-07 11:23:16 -07:00
Ryan C. Gordon e841b066fd cocoa: Another attempt at mouse vs touch support.
This time, we make anything we think is a MacBook trackpad report its touches
as SDL_MOUSE_TOUCHID, even though they're not _actually_ synthesized events,
and let all mouse input--even if the OS synthesized it from a multitouch
trackpad on our behalf--look like physical input. This is backwards from
reality, but produces the results most apps will expect.

Note that if you have a real touch device that doesn't appear to be the
trackpad, it'll produce real touch events with unique device ids, so it's
not a total loss here, but also note that the way we decide if it was the
trackpad is an imperfect heuristic; it happens to work out right now, but
it's not impossible that a real touchscreen could come to the Mac at some
point and (incorrectly?) call it a "mouse" input, etc.

But for now, good enough.

Fixes Bugzilla #4690.
2019-07-08 13:41:01 -04:00
Sam Lantinga 680e7937e0 Fixed bug 4710 - audio/alsa: avoid configuring hardware parameters with only a single period
Anthony Pesch

The previous code first configured the period size using snd_pcm_hw_par-
ams_set_period_size_near. Then, it further narrowed the configuration
space by calling snd_pcm_hw_params_set_buffer_size_near using a buffer
size of 2 times the _requested_ period size in order to try and get a
configuration with only 2 periods. If the configured period size was
larger than the requested size, the second call could inadvertently
narrow the configuration space to contain only a single period.

Rather than fixing the call to snd_pcm_hw_params_set_buffer_size_near
to use a size of 2 times the configured period size, the code has been
changed to use snd_pcm_hw_params_set_periods_min in order to more
clearly explain the intent.
2019-07-07 09:10:56 -07:00
Sam Lantinga 67bb882e13 Fixed bug 4707 - SDL_SetRelativeMouseMode fails on Vivante
Cameron Gutman

The bugfix in https://hg.libsdl.org/SDL/rev/ca9417a52f18 caused SDL_SetRelativeMouseMode() to begin failing on Vivante (Steam Link). Even though Vivante doesn't have a SetRelativeMouseMode() or WarpMouse() function, it's in relative mode already (because it uses evdev) so the function was actually working as intended.

I think providing a no-op SetRelativeMouseMode() function for Vivante is a reasonable fix. Since it's already getting relative events through evdev, it really is a no-op to "enter relative mode".

In fact, this is probably the right thing to do for all backends that use evdev (vivante, raspberry, and kmsdrm). Raspberry and kmsdrm both have WarpMouse() implementations so SDL_SetRelativeMouseMode() isn't failing there, but it still seems to make sense not to have to do the fake warping if they're evdev-based anyway.
2019-07-03 15:57:55 -07:00
Ryan C. Gordon b46c771994 raspberry: Actually commit the whole patch. :) (Thanks, Joe!)
Fixes Bugzilla #4699.
2019-07-02 16:49:35 -04:00
Ryan C. Gordon d2d06f4443 cocoa: Don't report trackpad mouse events as synthesized touches.
Fixes Bugzilla #4690, sort of. I guess.
2019-07-02 12:29:36 -04:00
Ryan C. Gordon d2058b45ae raspberry: Fixed missing mouse cursor (thanks, Joe!)
"Starting with changeset 12433, the mouse cursor is not displayed on the
Raspberry Pi platform, due to a bug in the handling of the new
"global_cursor" in RPI_ShowCursor(). Currently, if cursor == global_cursor,
the function immediately returns 0. The function should not return here.
Instead, if cursor == global_cursor, it shouldn't try to hide the current
cursor and update global_cursor = cursor. However, it *should* still continue
through the rest of the function."

Fixes Bugzilla #4699.
2019-07-02 10:26:54 -04:00
Ryan C. Gordon d5ebbcb4e5 dbus: Don't SimulateUserActivity if we're already inhibiting the screensaver. 2019-07-02 09:43:26 -04:00
Ryan C. Gordon 94658099e5 dbus: Add org.freedesktop.ScreenSaver.SimulateUserActivity support. 2019-07-02 09:38:31 -04:00
Alex Szpakowski 027887da15 iOS: Fix the window size not being set properly when Split View is used on an iPad (bug #4586). 2019-07-01 14:52:56 -03:00
Sam Lantinga 959cfc428e Fixed memory barrier macro check so it isn't quite so fragile 2019-06-30 23:58:31 -07:00
Sam Lantinga a8bea85810 Limit the compile error to the case where we actually define the memory barrier macro as the function 2019-06-30 23:55:28 -07:00
Sam Lantinga cc47810d36 Fixed bug 4683 - SDL_atomic infinite recursion on armv6/armv5 w/ thumb
The real problem is that SDL_atomic.c was built in thumb mode instead of ARM mode, which is required to use the mcr instruction on ARM platforms. Added a compiler error to catch this case so we don't generate code that does infinite recursion.

I also added a potentially better way to handle things on Linux ARM platforms, based on comments in the Chromium headers, which we can try out after 2.0.10 ships.
2019-06-30 23:26:16 -07:00
Sam Lantinga 797d2c5957 Fixed bug 4436 - [OpenBSD] fix D-pad
daniel.c.sinclair

Hi, this patch breaks dpad/hat input on my PS4 controller.  The attached patch restores functionality.  Calling SDL_PrivateJoystickHat() at the end of BSD_JoystickUpdate was setting the hat state to zero on every kind of input, instead of just the HUG_DPAD events.
2019-06-30 22:48:13 -07:00