2096 Commits

Author SHA1 Message Date
Edward Li
a35a7d2507 Fix SigSegV from displayInfoInvalidate when changing resolution 2021-12-28 09:33:44 -08:00
Edward Li
1c41b53551 macOS: Calculate correct DPI by not using backingScaleFactor 2021-12-28 09:33:44 -08:00
Sylvain
a1e992b110
Fixed bug #5118 - [Android] PointerIcon leak in Cursor API 2021-12-21 22:07:17 +01:00
Erik Soma
71e3998d6c Make SDL_VideoInit cleanup when errors occur before video driver creation. 2021-12-17 18:55:49 -08:00
Ozkan Sezer
2052b5bc3e os2messagebox: use proper UCHAR* typecast in assignment, just in case. 2021-12-17 01:10:10 +03:00
Sam Lantinga
ca18bf11ee Don't compare raw mouse button state with windows message button state
When mouse buttons are swapped, right mouse button down is the same value as raw mouse button up, and conceptually the two systems use different button masks, so never cache state between the two.

Fixes https://github.com/libsdl-org/SDL/issues/5108
2021-12-16 12:01:18 -08:00
Ethan Lee
4c9966eed6
wayland: Add a note for why we check 0,0 for fullscreen configurations 2021-12-16 10:22:27 -05:00
Sylvain
6101499c7c
BigEndian: fix code that generates illegal instruction with gcc-4.9.2 on powerpc
Program received signal SIGILL, Illegal instruction.
X11_InitKeyboard (_this=0x1001f8f0)
    at /home/sdl/SDL_git/src/video/x11/SDL_x11keyboard.c:273
273	    XKeyboardState values = { .global_auto_repeat = AutoRepeatModeOff };
2021-12-16 09:07:31 +01:00
Alex Szpakowski
3a5e148b13 Renderer backends use SDL_Color instead of int for geometry colors. 2021-12-14 12:19:16 -08:00
David Redondo
e2ade2bfc4 Fix build against wayland 1.20
Fixes #5088
2021-12-10 08:59:20 -08:00
David Gow
9da93d074b video: x11: Set XImage's byte_order field (fix #5081)
If the X server's byte order is different from the client, things might
display in the wrong colour.

Apparently we can just set the byte_order field to the client's byte
order, and the X server will adjust everything automatically:
https://xorg.freedesktop.narkive.com/GbSD1aPq/ximage-s-byte-order-field
2021-12-09 20:40:12 -08:00
Hanseul Jun
e7f84c20bc Fix a typo in comment. 2021-12-09 11:05:23 -08:00
Hanseul Jun
66fbf00e7d Temporarily ignore gl_config.driver_loaded check in Cocoa_GLES_SetupWindow. 2021-12-09 11:05:23 -08:00
Valentin Hăloiu
cb8fa5f9c3 wayland: fix keycodes of swapped xkb modifier keys 2021-12-09 09:30:58 -08:00
Ozkan Sezer
8d14e6ea44 replaced use of _MAX_PATH with CCHMAXPATH in os/2 code,
it now compiles without HAVE_LIBC
2021-12-08 14:01:02 +03:00
Sergio Padrino
6f6382f8d0 Fix SDL_GameController API for PSP (#3)
- Add missing mapping
- Make sure the only window has the keyboard focus (so no `SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS` is needed)
2021-12-07 09:04:05 -08:00
Cameron Gutman
da0f76de6d cocoa: Don't round scroll deltas from trackpads
Rounding the scroll deltas from trackpads causes jerky scrolling behavior
by artificially amplifying the effects of very small scroll movements.

We should only round events from devices with discrete scroll wheels,
because we know the smallest unit of movement there is a single tick.
2021-12-07 09:02:35 -08:00
Ozkan Sezer
00014dc2ac fix some warnings from psp builds (missing includes.) 2021-12-07 18:47:10 +03:00
Ozkan Sezer
03019c912a autotools, cmake: tighten Xfixes check && explicitly test BarrierEventID
Apparently the older versions of libXi doesn't have it.  Fixes the build
break issue reported at:
4b42c05ba1 (commitcomment-61427659)
2021-12-06 20:37:52 +03:00
David Gow
a709b5b602 video: wayland: Handle 0x0 xdg_toplevel_configure in fullscreen
The xdg_shell spec seems to state[1] that xdg_toplevel_configure events can
always provide a 0×0 width/height to signal that the compositor doesn't
care. SDL previously assumed the provided width/height was always valid
for fullscreen windows, and so applied it as-is.

This broke SDL applications on KDE/KWin 5.23, which now sends 0×0
configure events (and, in 5.23.3, 1×1 events for some reason), breaking
all SDL applications in fullscreen[2].

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/6
[2]: https://bugs.kde.org/show_bug.cgi?id=444962#c6
2021-12-06 09:09:37 -08: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
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
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
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
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
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
11a9cd6344 Fixed building SDL on UWP 2021-11-27 08:14:50 -08:00
Sam Lantinga
4e5839a5f4 Fixed compiling for Raspberry Pi 2021-11-26 13:45:08 -08:00
Sam Lantinga
57366285d8 Only send display events for hotplugged displays, not the initial state 2021-11-23 20:14:18 +00:00
Sylvain
381f99a3fd
Fix warnings: re-add enum forward declaration 2021-11-23 10:58:04 +01:00
Sylvain
dd6817b3b7
Fix warnings: static function, {} initializier, un-needed enum forward declaration 2021-11-23 10:47:34 +01:00
Sylvain
fae7034901
Fix warnings: static, include, un-initialized vairables 2021-11-23 10:33:12 +01:00
Sylvain
9c72adc86c
More "Integer overflow generates Illegal instruction under sanitizers" (see bug #4995) 2021-11-23 09:41:01 +01:00
Sylvain
8dd6edec00
Fixed bug #3232 - Integer overflow generates Illegal instruction under sanitizers + see bug #4995 2021-11-23 09:30:42 +01:00
Sylvain
c878d9a0aa Haiku: comment this should not be SDL_free() 2021-11-22 08:38:46 -08:00
Sylvain
0445c13aae Remove 'malloc' from comment 2021-11-22 08:38:46 -08:00
Sylvain
c3633d2c99 Haiku: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
79b37cc55f Pandora: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
10ffcbb115 QNX: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
9fcc630fb3 X11: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
19bf36db15 DirectFB: use SDL_malloc 2021-11-22 08:38:46 -08:00
Sylvain
5a7a7ba570 Don't use "realloc" in comment so that it doesn't show up 2021-11-22 08:38:46 -08:00
Sylvain
b4aeaa30a1 Use SDL_calloc / SDL_free 2021-11-22 08:38:46 -08:00
Sylvain
cb9f85e8d0 Don't use "round", so that it's doesn't show up while searching for the function 2021-11-22 08:38:46 -08:00