Commit Graph

1259 Commits

Author SHA1 Message Date
Eric Wasylishen
ab81a559f4 Windows DPI scaling/highdpi support
Adds hint "SDL_WINDOWS_DPI_SCALING" which can be set to "1" to
change the SDL coordinate system units to be DPI-scaled points, rather
than pixels everywhere.

This means windows will be appropriately sized, even when created on
high-DPI displays with scaling.

e.g. requesting a 640x480 window from SDL, on a display with 125%
scaling in Windows display settings, will create a window with an
800x600 client area (in pixels).

Setting this to "1" implicitly requests process DPI awareness
(setting SDL_WINDOWS_DPI_AWARENESS is unnecessary),
and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
2022-06-11 14:19:01 -07:00
Eric Wasylishen
51ebefeeee Support PMv2 DPI awareness, add SDL_HINT_WINDOWS_DPI_AWARENESS
The hint allows setting a specific DPI awareness ("unaware", "system", "permonitor", "permonitorv2").

This is the first part of High-DPI support on Windows ( https://github.com/libsdl-org/SDL/issues/2119 ).
It doesn't implement a virtualized SDL coordinate system, which will be
addressed in a later commit. (This hint could be useful for SDL apps
that want 1 SDL unit = 1 pixel, though.)

Detecting and behaving correctly under per-monitor V2
(calling AdjustWindowRectExForDpi where needed) should fix the
following issues:

https://github.com/libsdl-org/SDL/issues/3286
https://github.com/libsdl-org/SDL/issues/4712
2022-06-11 14:19:01 -07:00
Frank Praznik
e1c8350439 wayland: Add a hint to disable video mode emulation under Wayland
Add the hint "SDL_VIDEO_WAYLAND_MODE_EMULATION", which can be used to disable mode emulation under Wayland. When disabled, only the desktop and/or native display resolution is exposed.
2022-06-10 14:24:12 -07:00
Guldoman
74bcc5a0a3 stdlib: Add SDL_utf8strnlen 2022-06-09 15:18:50 -07:00
chalonverse
b9c2ad8395 Added additional check for HAVE_D3D12_H and missing SDL_VIDEO_RENDER_D3D12 in SDL_config.h.cmake 2022-06-07 22:36:06 -07:00
SDL Wiki Bot
ef4e0e921a Sync wiki -> header 2022-06-07 00:44:04 +00:00
chalonverse
4082821822
DirectX 12 Renderer (#5761)
* DirectX 12 Renderer (27 squashed commits)

* Add missing SDL_hidapi.h of merge of SDL.vcxproj.filters

* Fixed OpenWatcom build failure

* Dynapi fix

Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
2022-06-06 17:42:30 -07:00
SDL Wiki Bot
7cd165e2d9 Sync wiki -> header 2022-06-06 15:51:04 +00:00
yuanhecai
17f63e53f8 Add loongarch support
LSX and LASX are enabled by default if compiler supports them.
2022-06-06 08:49:09 -07:00
SDL Wiki Bot
3807e95029 Sync wiki -> header 2022-06-05 00:24:04 +00:00
Christoph Reichenbach
3a20274ddf Refactoring: move GUID operations out of Joystick
- SDL_JoystickGUID -> SDL_GUID (though we retain a type alias)
- Operations for GUID <-> String ops are now in
  src/SDL_guid.c and include/SDL_guid.h
- The corresponding Joystick operations delegate to SDL_guid.c
- Added test/testguid.c
2022-06-04 17:22:13 -07:00
SDL Wiki Bot
3604ae1d1b Sync wiki -> header 2022-06-04 01:52:04 +00:00
Sam Lantinga
423141bfca Added a function to get the controller firmware version 2022-06-03 18:50:00 -07:00
SDL Wiki Bot
4ddf85b1d5 Sync wiki -> header 2022-05-30 14:31:05 +00:00
Ryan C. Gordon
195ca499ca
include/SDL_video.h: You can google it.
This looks bad when reading Markdown as plain text, as one would do when
reading the headers directly.
2022-05-25 10:46:06 -04:00
Ryan C. Gordon
7ce311bead
include/SDL_system.h: Fixed a link that was still hg.libsdl.org 2022-05-25 10:43:14 -04:00
SDL Wiki Bot
a8e7548797 Sync wiki -> header 2022-05-24 22:57:04 +00:00
SDL Wiki Bot
179765561c Sync wiki -> header 2022-05-24 18:26:05 +00:00
Sam Lantinga
e97b506242 Need SDL_stdinc.h for _SDL_HAS_BUILTIN 2022-05-21 10:06:05 -07:00
Sam Lantinga
626a3c5ef7 Use _SDL_HAS_BUILTIN() instead of __has_builtin 2022-05-21 09:58:39 -07:00
David Carlier
1f48f8cd28 SDL_TriggerBreakPoint update using builtin instead of assembly versions if available 2022-05-21 09:50:04 -07:00
Simon McVittie
b0a27cb1de Avoid unintended float -> double conversion in SDL_FRectEqualsEpsilon
Resolves: https://github.com/libsdl-org/SDL/issues/5691
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-19 11:47:03 -07:00
Cameron Cawley
9dfa000bc0 Initial support for building for Windows with OpenWatcom 2022-05-19 20:11:10 +03:00
Ozkan Sezer
efa2e6a1ea SDL_thread.h: use SDL_ThreadFunction for SDL_CreateThreadWithStackSize 2022-05-19 18:55:02 +03:00
Cameron Cawley
0cca71a846 Use SDLCALL for callbacks in public APIs 2022-05-18 15:01:27 -07:00
Ivan Epifanov
8c5bda6acd Vita: remove Vita-specific RWOps code 2022-05-18 08:29:25 -07:00
Sam Lantinga
f0bc5c9cbf Added effects support for virtual controllers 2022-05-16 07:21:28 -07:00
SDL Wiki Bot
5953422c09 Sync wiki -> header 2022-05-16 03:52:04 +00:00
Sam Lantinga
bfac54b59c Added the ability to specify which buttons and axes are present for virtual controllers 2022-05-15 20:34:44 -07:00
SDL Wiki Bot
49ca8bf520 Sync wiki -> header 2022-05-16 03:03:04 +00:00
Sam Lantinga
94eeb587c1 First pass at extending virtual controller functionality
Added the ability to specify a name and the product VID/PID for a virtual controller

Also added a test case to testgamecontroller, if you pass --virtual as a parameter
2022-05-15 20:01:12 -07:00
Cameron Cawley
e0f3da497f Remove unused SDL_ASSEMBLY_ROUTINES define 2022-05-12 14:37:00 +03:00
SDL Wiki Bot
f93e810780 Sync wiki -> header 2022-05-12 07:39:04 +00:00
Sylvain
6b9884d40a
Fixed bug #4213 - update documentation to reflect SDL2 behavior of SDL_RenderGetLogicalSize 2022-05-12 09:36:49 +02:00
Michael Fitzmayer
9b75fa0165
N-Gage port: add changes from code reviews, overall cleanup (#5618)
* Add changes from code review by @ccawley2011, #5597, overall cleanup

* Update N-Gage README, minor cleanup and rephrasing

* Call SDL_SetMainReady() before calling SDL_main, return SDL_main instead of main
2022-05-11 09:31:34 -07:00
Sam Lantinga
2c2cbbe664 Fixed function reference for SDL_SIMDGetAlignment() 2022-05-11 09:04:23 -07:00
Cameron Cawley
2f924020e8 Add SDL_SCANCODE_CALL and SDL_SCANCODE_ENDCALL 2022-05-10 16:12:10 -07:00
Cameron Cawley
2bc373622b Add SDL_SCANCODE_SOFTLEFT and SDL_SCANCODE_SOFTRIGHT 2022-05-10 16:12:10 -07:00
Alex Szpakowski
f871c178b9 macOS: remove dead code for supporting 10.6 at runtime. 2022-05-10 14:04:14 -07:00
Simon McVittie
8ab3ae98f0 stdinc: Add a comment to clarify why inline functions are needed here
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-10 06:50:54 -07:00
Alex Szpakowski
d35c737f1c macOS: change min supported OS from 10.6 to 10.7. 2022-05-09 21:53:40 -07:00
Simon McVittie
f661654fad stdinc: Add overflow-checking add and multiply for size_t
This can be used to check whether untrusted sizes would cause overflow
when used to calculate how much memory is needed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-09 21:31:39 -07:00
Simon McVittie
cd7c2f1de7 Switch versioning scheme to be the same as GLib and Flatpak
For stable releases, this gives us the ability to make bugfix-only point
releases such as 2.24.1 if we want to, and distinguish between them
programmatically. For example, this ability could have been useful after
2.0.16 to fix Xwayland regressions, and after 2.0.18 to fix event loop
regressions.

For development releases, this gives us the ability to make multiple
prereleases during the same feature cycle, and distinguish between them
programmatically. For example, this would have been useful during 2.0.22
development, which went through three prereleases before reaching the
final release.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie
ba6f96275e Document SDL_VERSIONNUM as able to encode larger minor versions
Now that we've said this will be removed from SDL 3, we're free to use
any encoding that is compatible with existing SDL versions and will still
compare correctly for all SDL 2 version numbers. This allows the SDL 2
minor version to go beyond 1 digit, limited only by the size of
SDL_version.minor (which is 8 bits), making the largest possible version
number 2.255.99.

The patchlevel (micro version) is still limited to 2 digits.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie
e0daa2a530 Deprecate SDL_COMPILEDVERSION and SDL_VERSIONNUM, to be removed in 3.x
The encoding used in SDL_VERSIONNUM (e.g. 2.0.22 -> 2022) cannot
represent 2-digit minor versions without overflowing from the hundreds
digit into the thousands digit, which produces confusing version
numbers that will compare incorrectly when the major version is increased
to 3.

However, we can sidestep this problem by declaring that SDL_VERSIONNUM
will no longer be present in SDL 3, which means it only needs to be able
to represent SDL 2 version numbers losslessly.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Simon McVittie
f9a5cf77b8 Make SDL_VERSION_ATLEAST future-proof against larger version numbers
This comparison normally happens at compile-time, not at runtime, so
it doesn't matter if it isn't optimal. This avoids incorrect comparison
if the minor version in SDL_COMPILEDVERSION and SDL_VERSIONNUM has more
than one digit, which would cause it to overflow from the hundreds place
into the thousands place.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 09:55:35 -07:00
Cameron Cawley
b398a847be Add SDL_FLOATWORDORDER for older ARM toolchains 2022-05-04 09:52:11 -07:00
atfrase
db9e14e504 disabled linux joystick debugging outputs and reverted unnecessary comment edit 2022-05-03 10:44:09 -07:00
atfrase
3696e23d09 added hints SDL_HINT_LINUX_DIGITAL_HATS and SDL_HINT_LINUX_HAT_DEADZONES to control the new Linux hat handling; added define DEBUG_GAMEPAD_MAPPINGS to log messages when generating default gamepad mapings for Linux joysticks 2022-05-03 10:44:09 -07:00
Michael Fitzmayer
fbd230bb6c
Add support for the Nokia N-Gage (#5597)
* Add initial support for the Nokia N-Gage

* N-Gage: disable clipping for the time being, issue needs to be resolved later

* Move va_copy definition to SDL_internal.h

* Move stdlib.h include to SDL_config_ngage.h, much cleaner this way

* Remove redundant include, add HAVE_STDLIB_H

* Revert "N-Gage: disable clipping for the time being, issue needs to be resolved later"

This reverts commit 4f5f0fc36cc7f34fad05e45671dfa7b8dc32fd51.

* N-Gage: fix clipping issue by providing proper math functions
2022-05-03 08:51:49 -07:00