2067 Commits

Author SHA1 Message Date
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
Sylvain
d31251b014 use SDL's functions version inplace of libc version 2021-11-22 08:38:46 -08:00
Sam Lantinga
c97b721868 Added SDL_PremultiplyAlpha() to premultiply alpha on a block of SDL_PIXELFORMAT_ARGB8888 pixels 2021-11-21 12:18:10 -08:00
Ryan C. Gordon
ceb9e9a809 cocoa: Removed a debug printf call. 2021-11-21 00:21:41 -05:00
Ryan C. Gordon
18715acb55 cocoa: Position non-left mouse button events in background windows correctly.
Fixes #4828.
2021-11-21 00:14:18 -05:00
Ryan C. Gordon
23b7bdef87
offscreen: Don't fail to create a window because of driver_loaded politics.
Fixes #4922.
2021-11-20 14:12:11 -05:00
Sam Lantinga
665865eda2 If the hardware is in an error state, the final page flip may not come.
We should either put a timeout on the wait when destroying the window, or skip it entirely.
2021-11-19 09:58:13 -08:00
Ethan Lee
a7a54e6452 wayland: Add support for display connect/disconnect events 2021-11-18 00:44:08 -05:00
Ethan Lee
5cc23868ed wayland: Add support for SDL_DisplayOrientation 2021-11-16 11:58:23 -08:00
Sam Lantinga
cc094f4d7c Fixed building with the macOS 10.8 SDK 2021-11-14 20:15:48 -08:00
Zack Middleton
1cd3e83756 cocoa: Fix abort on touch event types without a subtype
macOS 10.6 has some touch NSEvents which do not have a subtype
(Begin/EndGesture, Magnify, Rotate, Swipe) and cause an uncaught
exception which triggers SIGABRT and the program exits.

As it is, none of the macOS 10.6 touch events are detected as a
trackpad (including Gesture due to using different subtypes).
2021-11-14 15:21:51 -08:00
Ozkan Sezer
781caec2b2 SDL_waylandevents.c (keyboard_handle_keymap): silenced -Wwrite-strings . 2021-11-15 00:55:24 +03:00
Ozkan Sezer
8a6e48d46d constified SDL_RegisterApp() 2021-11-14 04:40:50 +03:00
Ozkan Sezer
7dfd22ac5e fix XGetDefault signature - its first and second params are _Xconst 2021-11-14 02:32:00 +03:00
Cameron Gutman
674f361dec wayland: Fix memory leaks in clipboard code 2021-11-13 11:44:36 -06:00
Cameron Gutman
eb3f1462b8 x11: Fix memory leak in X11_CreatePixmapCursor() 2021-11-12 18:26:26 -06:00
Ozkan Sezer
3dc7813ae4 more whitespace tidy-ups in SDL_os2messagebox.c 2021-11-12 20:47:02 +03:00
Sam Lantinga
c2dd50a9a0 Fixed whitespace 2021-11-12 08:28:02 -08:00
Sam Lantinga
074e613bbb Fixed typo 2021-11-12 03:04:11 -08:00
Sam Lantinga
35d90f17e1 Better implementation of SDL_SetWindowMouseGrab() and SDL_SetWindowMouseRect() on macOS 2021-11-12 03:04:11 -08:00
Misa
3bf7994fe2 Add and use SDL_FALLTHROUGH for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Clang before Clang 10 and GCC before GCC 7 have problems with using
__attribute__ as a sole statement and warn about a "declaration not
declaring anything", so fall back to using the /* fallthrough */ comment
if we are using those older compiler versions.

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-12 07:26:14 +03:00
Sam Lantinga
abc12a832c Revert "Add and use SDL_FALLTHROUGH for fallthroughs"
This reverts commit 66a08aa3914a98667f212e79b4f0b9453203d656.

This causes problems with older compilers:
https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
2021-11-11 15:58:44 -08:00
Ethan Lee
63ae103cd1 wayland: QTWAYLAND_CONTENT_ORIENTATION can support multiple values as bitmasks 2021-11-11 13:16:34 -05:00
Sam Lantinga
11ae43ca16 Only lock the pointer for mouse relative mode, there isn't really a concept of grab and confinement on iOS
Locking the pointer prevents the on-screen cursor from moving, which isn't what we want with a grab behavior.

Fixes https://github.com/libsdl-org/SDL/issues/4941
2021-11-11 07:51:34 -08:00
Misa
66a08aa391 Add and use SDL_FALLTHROUGH for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-11 07:23:25 -08:00
Sam Lantinga
eda4c40732 Make sure the X event is an Xkb event before checking the Xkb event type 2021-11-10 12:48:09 -08:00
Sam Lantinga
98c9836287 Don't clobber the error in SDL_ShowMessageBox() if one has been set at
the platform level

Fixes https://github.com/libsdl-org/SDL/issues/4760
2021-11-10 11:04:51 -08:00
Sam Lantinga
6c4b4ee7a6 Don't assert on API parameters
This causes lots of spam in test automation and it's not clear it's useful to developers. If we need this level of validation, we should add a log category for it.
2021-11-10 09:41:43 -08:00
Sam Lantinga
fed857787a Update the orientation and display modes when the display settings change on Windows
Fixes https://github.com/libsdl-org/SDL/issues/1061
2021-11-10 08:47:39 -08:00
Sam Lantinga
c0f1109bd0 Implemented querying the orientation of displays on Windows 2021-11-10 06:03:01 -08:00