Commit Graph

8765 Commits

Author SHA1 Message Date
Frank Praznik
fbebbab90d wayland: Only set the explicit logical window size when using display scaling
Otherwise, the standard width/height is already in points/screen units.
2024-01-28 13:31:42 -05:00
Frank Praznik
879ba46ade wayland: Make sure the logical window size can't go to zero.
libdecor can send a size of zero as a valid value, the use of which will close the window. Make sure the minimum width/height are clamped to a minimum of 1.
2024-01-28 13:31:42 -05:00
Frank Praznik
b97cda226f wayland: Refactor internal variable names for better readability
Add descriptions in the internal window struct as well.
2024-01-28 13:31:42 -05:00
Frank Praznik
5b8ca05f1a wayland: Add a forced screen space scaling mode
Add a mode that forces Wayland windows to output with scaling that forces 1:1 pixel mapping.

This is intended to allow legacy applications to be displayed without desktop scaling being applied, and may have issues with some display configurations, as this forces the window to behave in a way that Wayland desktops were not designed to accommodate (rounding errors can result from certain combinations of window/scale values, the window may be unusably small, jump in size at times, or appear to be larger than the desktop space, and cursor precision may be reduced).

Windows flagged as DPI-aware are not affected by this.

The automated video test suite passes with the hint turned on.
2024-01-28 13:31:42 -05:00
Sam Lantinga
12bdb2b4d0 Added the environment variable SDL_LOGGING to control default log output 2024-01-27 19:30:22 -08:00
Ryan C. Gordon
dcd26a80e5 windows: Minor tweaks that makes Windows XP vidmodes work again.
(thanks @madebr!)

Fixes #8328.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon
6ca596cfc1 windows: Manage MapVirtualKey vs Windows XP.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon
1c5bc53738 windows: Manage WideCharToMultiByte vs Windows XP.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon
2144c2ac71 windows: Added WIN_IsWindowsXP, for extreme runtime compatibility checks.
Reference Issue #8666.
2024-01-27 20:15:08 -05:00
Ryan C. Gordon
56fa22c63b windows: OS version checks now cache results.
So these only have to talk to the Win32 API once per check, per process.
2024-01-27 20:15:08 -05:00
Sam Lantinga
4fba663368 Simplified the default log category logic
Now it's much clearer and easier to tweak the defaults
2024-01-27 15:45:38 -08:00
Ozkan Sezer
2a4db8c415 SDL_rwops.c (SDL_IsRegularFile): fix WinRT build failure due to S_ISREG
(cherry picked from commit fcd1c155cc)
2024-01-28 02:22:00 +03:00
Sam Lantinga
f66fe7e221 Replaced SDL_GetJoystickCaps() with joystick properties
Fixes https://github.com/libsdl-org/SDL/issues/8927
2024-01-27 15:11:52 -08:00
Ozkan Sezer
019dc53764 SDL_RWFromFile, stdio: reject if the file is not a regular file.
Fixes https://github.com/libsdl-org/SDL/issues/8935
(cherry picked from commit 230ae797a7)
2024-01-28 01:44:50 +03:00
Sam Lantinga
3b55c7d1f4 Shortened SDL property names 2024-01-27 13:00:50 -08:00
Sam Lantinga
2d94b4f490 Make sure we set datasize on error in SDL_LoadFile_RW() 2024-01-27 12:19:59 -08:00
Sam Lantinga
dff76bf295 Enable text input on video initialization without popping up an on-screen keyboard
Fixes https://github.com/libsdl-org/SDL/issues/8561

(cherry picked from commit 4ff3b28273)
2024-01-27 12:00:39 -08:00
Sam Lantinga
b9ea2dde44 Added VisionOS as a supported target to the Xcode project
Also added SDL_PLATFORM_VISIONOS to the platform definitions and generally switched from TARGET_OS_* macros to SDL_PLATFORM_* macros.
2024-01-27 11:07:21 -08:00
Ryan C. Gordon
7a7875c904 wasapi: A few tweaks to buffer management.
These were previously applied, in a different form, in SDL2.

Reference Issue #8924.
2024-01-27 14:05:09 -05:00
Frank Praznik
e71e16950a wayland: Use the preferred order of displays exposed by KDE
KDE provides the kde_output_order_v1 protocol, which tells clients the preferred order of all connected displays. Sort SDL displays according to the provided list at init time.
2024-01-27 02:10:49 -05:00
Sam Lantinga
e0c2cca629 Fixed fullscreen windows having rounded corners and 1px transparent borders on Windows 11.
When an app makes a fullscreen window on Windows, the window is really just resized to the monitor dimensions and positioned at 0, 0 and positioned on top of everything, including the taskbar. Added disabling rounded corners and some new DWM controlled border color (which seems to be defaulted to 1px transparent, but can be set to the theme color by users). Previous settings are restored when exiting fullscreen mode.
2024-01-26 23:05:31 -08:00
Sam Lantinga
a1a4948fda Fixed the size and position of minimized windows on Windows 2024-01-26 22:36:32 -08:00
Caiyi Hsu
5ba839e83b fix XRandR refresh rate calculation 2024-01-26 20:44:23 -08:00
Ozkan Sezer
5ab879f89a SDL_kmsdrmvideo.c: move SDL_kmsdrmvulkan.h include to before all others
Fixes vulkan redefinition errors:

In file included from /tmp/SDL3/src/video/kmsdrm/.././khronos/vulkan/vulkan.h:11,
                 from /tmp/SDL3/src/video/kmsdrm/../SDL_vulkan_internal.h:52,
                 from /tmp/SDL3/src/video/kmsdrm/SDL_kmsdrmvulkan.h:32,
                 from /tmp/SDL3/src/video/kmsdrm/SDL_kmsdrmvideo.c:44:
/tmp/SDL3/src/video/kmsdrm/.././khronos/vulkan/vulkan_core.h:101: error: redefinition of typedef ‘VkInstance’
/tmp/SDL3/include/SDL3/SDL_vulkan.h:52: note: previous declaration of ‘VkInstance’ was here
In file included from /tmp/SDL3/src/video/kmsdrm/.././khronos/vulkan/vulkan.h:11,
                 from /tmp/SDL3/src/video/kmsdrm/../SDL_vulkan_internal.h:52,
                 from /tmp/SDL3/src/video/kmsdrm/SDL_kmsdrmvulkan.h:32,
                 from /tmp/SDL3/src/video/kmsdrm/SDL_kmsdrmvideo.c:44:
/tmp/SDL3/src/video/kmsdrm/.././khronos/vulkan/vulkan_core.h:7513: error: redefinition of typedef ‘VkSurfaceKHR’
/tmp/SDL3/include/SDL3/SDL_vulkan.h:53: note: previous declaration of ‘VkSurfaceKHR’ was here
make[2]: *** [CMakeFiles/SDL3-shared.dir/src/video/kmsdrm/SDL_kmsdrmvideo.c.o] Error 1
2024-01-26 03:20:14 +03:00
Frank Praznik
22ea59425d wayland: Fix whitespace 2024-01-25 16:14:41 -05:00
Frank Praznik
c202893fbb wayland: Make sure the primary display is always first under GNOME
GNOME can deliver displays in arbitrary order, which can even change across sleep/wake cycles, so use a DBus method to find the primary display, and try to make sure it is the first exposed by SDL.

On other window managers, continue to assume that the order in which displays are exposed is the preferred order.

This can eventually be replaced by a Wayland protocol that serves the same purpose, if the pending ones are ever finalized.
2024-01-25 16:01:32 -05:00
Ryan C. Gordon
b8081e8e35 video: lowercase some video backend names. 2024-01-25 15:22:57 -05:00
Sam Lantinga
2670eb44af Improved timing accuracy of SDL_WaitEventTimeout() on Windows
We don't need to use the hack of setting a timer and waiting for a timer message, MsgWaitForMultipleObjects() will allow us to wait for input directly with a timeout.

Before this change, sleeping for 20 ms would actually sleep for around 30 ms, with this change the sleep time is pretty accurate at 20-21 ms.
2024-01-25 06:30:07 -08:00
Ningyuan Li
d6ebbc2fa4 mayflash adapter PS4 support 2024-01-24 19:25:35 -08:00
Sam Lantinga
006edcab60 Switch to using SDL_powf() instead of pow() 2024-01-24 12:38:07 -08:00
Ozkan Sezer
6b3b7c7d4b SDL_hidapi_ps3.c: adjust for new SDL_PLATFORM_WINDOWS meaning. 2024-01-24 21:20:50 +03:00
Ozkan Sezer
81314c4998 SDL_render_gl.c: adjust for new SDL_PLATFORM_WINDOWS meaning. 2024-01-24 21:20:50 +03:00
Ozkan Sezer
1c79edbe02 SDL_test_memory.c: adjust for new SDL_PLATFORM_WINDOWS meaning. 2024-01-24 21:20:50 +03:00
Ozkan Sezer
07a0c0e402 SDL_hidapi.c: adjust for new SDL_PLATFORM_WINDOWS meaning. 2024-01-24 21:20:50 +03:00
Ozkan Sezer
34f03207c4 SDL_cpuinfo.c: adjust for new SDL_PLATFORM_WINDOWS meaning. 2024-01-24 21:20:50 +03:00
Sam Lantinga
1ac9602909 Make sure we include the matching copy of vk_video headers 2024-01-24 09:40:16 -08:00
Sam Lantinga
fc74bf8455 Update to the latest version of the Khronos headers 2024-01-24 09:40:16 -08:00
Simon McVittie
f61870cfb4 Go back to using compiler built-in macros in ARM assembly code
These files don't #include SDL headers, so SDL-specific macros will
never be defined here.

This partially reverts commit 31d133db.

Fixes: 31d133db "Define SDL_PLATFORM_* macros instead of underscored ones (#8875)"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-24 14:12:50 +03:00
Simon McVittie
ed421f4fd8 Revert Khronos headers to upstream version
These are third-party headers, so it's best if they're identical to the
upstream version rather than using SDL-specific macros or coding style.

This partially reverts commits b6ae281e and 31d133db.

Fixes: 31d133db "Define SDL_PLATFORM_* macros instead of underscored ones (#8875)"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-24 14:12:50 +03:00
Sam Lantinga
8fe257b541 Added support for other HDR color primaries
Specifically, SDL_COLOR_PRIMARIES_XYZ, SDL_COLOR_PRIMARIES_SMPTE431, and SDL_COLOR_PRIMARIES_SMPTE432
2024-01-23 20:35:29 -08:00
Anonymous Maarten
31d133db40 Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
Sam Lantinga
7cd914593f Added HDR surface properties and tone mapping from HDR to SDR
This currently only supports PQ, but can be expanded in the future
2024-01-23 17:19:41 -08:00
Sam Lantinga
a71f99c71f Fixed ambiguity between std::byte and byte in rpcndr.h
Fixes https://github.com/libsdl-org/SDL/issues/8911
2024-01-23 09:00:02 -08:00
Sam Lantinga
cd231a65f6 Added SDL_GetJoystickCaps() and SDL_GetGamepadCaps() to get the capabilities of controllers
Also added SDL_GAMEPAD_CAP_PLAYER_LED to let the application know if the controller has a visible player LED
2024-01-22 19:23:42 -08:00
Ryan C. Gordon
c88c12148d SDL_ShowMessageBox: Remove #ifdefs and respect SDL_VIDEO_DRIVER hint.
Fixes #8892.
2024-01-22 19:29:36 -05:00
Frank Praznik
5f65fd360d wayland: Free the input struct in all initialization failure paths 2024-01-22 13:01:04 -05:00
Frank Praznik
84e47b4af5 wayland: Always create the backing input store, even if there is no seat
Fixes a crash if no seat was available at initialization, but still allows for one to still be created later if an input device is added.

Removes some unnecessary abstractions in the process.
2024-01-22 12:37:24 -05:00
Sam Lantinga
99ce8af439 Fixed warning C4244: '=': conversion from 'Sint64' to 'int', possible loss of data
(cherry picked from commit 12bab1c981)
2024-01-22 08:39:47 -08:00
Sam Lantinga
052b958bf2 Made SDL_HapticEffect const in the API
Also added some additional parameter validation to haptic effect functions
2024-01-21 11:29:40 -08:00
Sam Lantinga
fa5bfe577c Fixed warnings building for UWP 2024-01-21 06:55:29 -08:00