Commit Graph

5000 Commits

Author SHA1 Message Date
Sylvain
e14d10263c Change viewport and cliprect to float version: from SDL_Rect to SDL_FRect 2021-12-02 10:01:50 +01:00
Sylvain
7828362da9 SDL_Renderer software, D3D11: don't use "renderer->viewport" in back-ends, but use the one from SETVIEWPORT cmd 2021-12-02 10:01:50 +01:00
Ozkan Sezer
a2b13e585c SDL_iconv_string: avoid memory leak if realloc() fails. 2021-12-02 02:28:24 +03:00
Ozkan Sezer
f14a8bfa4e fix whitespace. 2021-12-01 21:33:02 +03:00
Ozkan Sezer
b71bfdaafb SDL_iconv.c (encodings): mark "WCHAR_T" as ENCODING_UTF16LE for OS/2 too
whcar_t is unsigned short in os/2, like windows
2021-12-01 20:50:40 +03:00
Davis Mosenkovs
66b0a6ee15 workaround for libmali gbm_device_get_fd()
gbm_device_get_fd() in at least some libmali versions duplicates handle.
Other implementations do not do duplication. To prevent handle leak save
drm_fd in SDL_DisplayData.
2021-11-30 16:20:24 -08:00
Ozkan Sezer
662ea5abe4 minor correction after previous patch and minor tidy-up. 2021-12-01 01:40:24 +03:00
Ozkan Sezer
70c5e91d0f os/2 optionally builds against libiconv. 2021-12-01 01:20:10 +03:00
Ozkan Sezer
b20484e803 minor os/2 reorganization for iconv 2021-12-01 01:20:02 +03:00
Sam Lantinga
8c91cf7dba Always create a full 256-entry map in case color values are out of range
Fixes https://github.com/libsdl-org/SDL/issues/5042
2021-11-30 12:37:39 -08:00
Sam Lantinga
a4c04ad230 Fixed building with iOS SDK prior to 13.0
Fixes https://github.com/libsdl-org/SDL/pull/5045
2021-11-30 10:32:39 -08:00
Sam Lantinga
8589134f16 Fixed potential buffer overflow in YUV conversion
Fixes https://github.com/libsdl-org/SDL/issues/5043
2021-11-30 10:23:21 -08:00
Ozkan Sezer
09465a9083 hidapi, windows: replace a strncpy() with plain memcpy()
mainstream has a similar change, already.
2021-11-30 21:10:10 +03:00
Sam Lantinga
5fc901d4f3 Updated to version 2.0.19 for development 2021-11-30 09:58:21 -08:00
Cameron Gutman
715d481271 windows: Fix GUI key state when grabbing the keyboard
When our keyboard grab hook is installed, GetKeyState() will return 0 for the
GUI keys even when they are pressed. This leads to spurious key up events when
holding down the GUI keys and the inability to use any key combos involving
those modifier keys.
2021-11-29 20:07:19 -08:00
Sam Lantinga
b6bc3a6b0e Added a mapping for the PS4 touchpad button on Windows
Fixes https://github.com/libsdl-org/SDL/issues/5035
2021-11-29 09:00:54 -08:00
David Gow
f6fdbc1e37 video: x11: Fix an invalid SDL_LogError() call
This fixes a compile warning — and possible invalid memory read —
introduced in 9c03d255 ("Add back X11 legacy WM_NAME encodings"), which
was part of PR #5029, fixing Bug #4924.

The issue is with one of the added warnings in X11_GetWindowTitle().
Basically, the "title" variable passed to SDL_LogError() hasn't been
initialised yet: we could pass propdata in directly, but it's better to
move the SDL_LogError() call until after title is set, IMHO.

This fixes the following warning from gcc (SUSE Linux) 11.2.1:
In file included from /home/david/Development/SDL/src/video/x11/../../SDL_internal.h:45,
                 from /home/david/Development/SDL/src/video/x11/SDL_x11window.c:21:
/home/david/Development/SDL/src/video/x11/SDL_x11window.c: In function 'X11_GetWindowTitle':
/home/david/Development/SDL/src/video/x11/../../dynapi/SDL_dynapi_overrides.h:33:22: warning: '%s' directive argument is null [-Wformat-overflow=]
   33 | #define SDL_LogDebug SDL_LogDebug_REAL
/home/david/Development/SDL/src/video/x11/SDL_x11window.c:720:13: note: in expansion of macro 'SDL_LogDebug'
  720 |             SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to convert WM_NAME title expecting UTF8! Title: %s", title);
      |             ^~~~~~~~~~~~
2021-11-29 07:13:25 -08:00
Sam Lantinga
3ba9276aff Don't fail the sensor init if we couldn't create a sensor manager (i.e. we're running on Wine)
Fixes https://github.com/libsdl-org/SDL/issues/5031
2021-11-28 21:14:02 -08:00
Sam Lantinga
6872cb12e6 null-terminate the message buffer if FormatMessage() fails 2021-11-28 21:10:46 -08:00
Fredrick Brennan
b5d47aa297 Fix comment style for old compilers (///**/) 2021-11-28 21:00:29 -08:00
Fredrick Brennan
367684b0c2 Add patches suggested by @slouken in round 1 review 2021-11-28 21:00:29 -08:00
Fredrick Brennan
9c03d25543 Add back X11 legacy WM_NAME encodings
Closes #4924.

Based on patches of the past, such as this work by James Cloos in July
2010:
d7d98751b7,
as well as code comments in the Perl module X11::Protocol::WM
(https://metacpan.org/pod/X11::Protocol::WM) and even the code to Xlib
itself, which taught me that we should never have been using
`XStoreName`, all it does is call `XChangeProperty`, hardcoded to
`XA_STRING`!

What can I say, when the task is old school, the sources are too 😂
2021-11-28 21:00:29 -08:00
Ethan Lee
72e53e4b87 wayland: Clear driverdata before calling ResetDisplayModes 2021-11-28 19:25:22 -05:00
Sam Lantinga
942973dd86 Use mouse ID 0 for raw mouse events
We don't track state for each mouse individually, so we should just use the global mouse ID for all events.

Fixes https://github.com/libsdl-org/SDL/issues/5026
2021-11-28 09:27:28 -08:00
Sam Lantinga
dd2f91118e Fixed warnings with Windows SDK 10.0.19041
Fixes https://github.com/libsdl-org/SDL/issues/4998
Also breaks https://github.com/libsdl-org/SDL/issues/4998 for older SDKs, but we're going to ignore them, they're just incorrect.
2021-11-27 20:18:29 -08:00
Sam Lantinga
c2904c8ce7 Fixed compile warnings and errors
Fixes https://github.com/libsdl-org/SDL/issues/4998
2021-11-27 11:16:15 -08:00
Ozkan Sezer
8f17af5e21 hidapi: mark libusb function pointers with LIBUSB_CALL. 2021-11-27 11:02:04 -08:00
Sam Lantinga
a6cbe0ab87 Controllers are always centered at zero using XInput and WGI 2021-11-27 10:58:12 -08:00
Sam Lantinga
09b7ca27d6 Get the current WGI controller list at startup
On Win32 this list is empty and we always get controller added events. On UWP, this list is populated and we don't get controlle added events for currently connected controllers.
2021-11-27 10:53:20 -08:00
Sam Lantinga
12895eca1a Fixed WGI initialization on Win32 2021-11-27 10:52:58 -08:00
Sam Lantinga
110e4e1334 Use WGI instead of XInput for Windows 10 UWP apps
Fixes https://github.com/libsdl-org/SDL/issues/5017
2021-11-27 10:24:32 -08:00
Sam Lantinga
e04a0221e3 Fixed crash running SDL test programs on UWP 2021-11-27 10:22:37 -08:00
Ozkan Sezer
5a0ea7fb17 Check for O_CLOEXEC definition in fcntl.h at configuration time,
If not available, define it internally as 0 (in SDL_internal.h).
Define it as available for macOS >= 10.7 in SDL_config_macosx.h.
2021-11-27 19:23:10 +03:00
Cameron Gutman
f903a39e13
haptic: Fix SDL_MouseIsHaptic() always returning SDL_TRUE on Android 2021-11-27 19:18:41 +03:00
Sam Lantinga
11a9cd6344 Fixed building SDL on UWP 2021-11-27 08:14:50 -08:00
Mathieu Eyraud
02021ae753 Return capabitlities from RawInput joystick 2021-11-27 07:26:10 -05:00
Eric Wasylishen
b786c10013 SDL_render_gl.c: GL_RunCommandQueue: always set viewport_dirty on macOS
Without this, moving the window changes the viewport and causes contents
to render stretched.

Fixes #1504
2021-11-27 07:12:34 -05:00
Sam Lantinga
4f683f01d4 Fixed potentially truncated entry in stack trace 2021-11-26 17:27:07 -08:00
Sam Lantinga
4e5839a5f4 Fixed compiling for Raspberry Pi 2021-11-26 13:45:08 -08:00
Ryan C. Gordon
86c0cf2bb1
software: Draw a single pixel for a line with the same start/end point.
Otherwise it would drop it, which seems like a bug to me, as it normally
fills the endpoint on lines.

Reference #2006.
2021-11-26 14:34:51 -05:00
Sam Lantinga
a2e8565230 The Google Pixel fingerprint sensor isn't actually a joystick
Fixes https://github.com/libsdl-org/SDL/issues/4971
2021-11-26 11:04:15 -08:00
Sam Lantinga
67b5de5b41 Fixed build warnings 2021-11-26 10:18:08 -08:00
Sam Lantinga
2ca2ad76da Fixed build warnings 2021-11-26 10:13:45 -08:00
Sam Lantinga
f90164a62f Fixed mapping for the G-Shark GS-GP702
Fixes https://github.com/libsdl-org/SDL/issues/5006
2021-11-26 09:02:12 -08:00
Sam Lantinga
7242075b2b Updated version to 2.0.18 for release 2021-11-26 08:12:45 -08:00
Sam Lantinga
d861820465 SDL_JoystickGetAttached() doesn't need to be noisy for NULL joystick
Fixes https://github.com/libsdl-org/SDL/issues/5008
2021-11-26 07:57:48 -08:00
Sam Lantinga
30f04d63e6 HIDAPI is only reliable on Android 4.3 and newer
Fixes https://github.com/libsdl-org/SDL/issues/4955
2021-11-26 07:15:46 -08:00
Ryan C. Gordon
d713a68071
pulseaudio: wait until at least 1/8th (!) of the mixbuffer is available.
This is to workaround systems where we hang in playback because the buffer
does not report the space for whatever reason. The system will instead block
in PlayDevice, which always immediately follows WaitDevice in modern times
so this works out, and it seems to keep the device moving forward.

For a future revision, we are either going to clean this up more properly,
or attempt to move to PulseAudio's pa_stream_set_write_callback() API, but
this will do for SDL 2.0.18.

Reference #4387 for discussion and further information.
2021-11-25 22:32:40 -05:00
Ozkan Sezer
53aa8eec5f minor cleanup for watcom _inline keyword. 2021-11-25 17:00:24 +03:00
Sylvain
d5813776db Release UDEV ressources 2021-11-25 07:24:18 -05:00