Frank Praznik
47cdb532f1
video: Don't rely on memcpy undefined behavior
...
The C specification states that passing a size of 0 to functions like memcpy is valid, but even if the size is 0 and the function is essentially a no-op, the result when passing any invalid pointers is considered undefined behavior. Don't rely on undefined behavior when copying the display or mode lists.
2023-02-02 15:11:36 -08:00
Frank Praznik
166afebcad
video: Update self-referential pointers when reallocating the display list
...
The display list can contain self-referential pointers if the current mode pointer points to the desktop mode or a fullscreen mode array element, and reallocating the display or fullscreen mode lists without updating the current mode pointer in these cases can leave them pointing to freed memory or garbage data. Manually copy the list items and update the self-referential pointers if necessary.
2023-02-02 09:46:01 -08:00
Sam Lantinga
673bc57649
Don't accept official mappings for controllers that aren't unique
...
For example, the DragonRise Inc. Generic USB Joystick
See https://github.com/gabomdq/SDL_GameControllerDB/issues/202 for details
2023-02-02 08:39:54 -08:00
Sam Lantinga
917607c335
Fixed sort_controllers.py and resorted game controller database
2023-02-02 08:38:22 -08:00
Sam Lantinga
d29e1f3632
Added gamepad mappings for the Xin-Mo Dual Arcade Fightstick
2023-02-01 23:09:53 -08:00
Sasha Szpakowski
baca26d727
macOS: fix initial Metal drawable size in certain multi-display setups
2023-02-01 22:38:55 -08:00
Frank Praznik
98ae54ccc0
video: Set the ID of fullscreen modes when adding a display
...
When adding a display, traverse the list of added fullscreen modes and ensure the display ID is set to its final, valid value, or the modes added before calling SDL_AddVideoDisplay() will have an invalid display ID.
2023-02-01 16:37:57 -08:00
Anonymous Maarten
d8f0715385
Revert "Remove unused SDL_GetCPUName"
...
This reverts commit 4e6ab13d6f
.
2023-02-02 00:49:09 +01:00
Anonymous Maarten
78be9eaf38
Revert "Add testcpuinfo.c"
...
This reverts commit 5888b008b1
.
2023-02-02 00:49:09 +01:00
Anonymous Maarten
69aede6c9e
Add missing _ in SDL_EVENT_LOCALECHANGED and SSDL_EVENT_TEXTEDITING_EXT
2023-02-02 00:49:09 +01:00
Anonymous Maarten
08bcee8570
test: don't use wiki urls for documentation comments
...
Also make consistent use of \ as documentation escape character.
2023-02-02 00:49:09 +01:00
Anonymous Maarten
bff449eb24
testcpuinfo.c needs SDL3/SDL_main.h
2023-02-01 23:49:27 +01:00
Anonymous Maarten
5888b008b1
Add testcpuinfo.c
2023-02-01 23:34:37 +01:00
Anonymous Maarten
4e6ab13d6f
Remove unused SDL_GetCPUName
2023-02-01 23:17:15 +01:00
Sam Lantinga
177a6f38e0
Only minimize the window for an assert if it's in exclusive fullscreen mode
2023-02-01 12:05:25 -08:00
Sam Lantinga
ac75fe9324
Folded SDL_WINDOW_FULLSCREEN_EXCLUSIVE and SDL_WINDOW_FULLSCREEN_DESKTOP into a single SDL_WINDOW_FULLSCREEN flag
...
The fullscreen video mode used by the window can be used to determine whether it's in exclusive fullscreen or fullscreen desktop mode.
2023-02-01 12:05:25 -08:00
Sam Lantinga
14338ab459
Removed display mode flags
...
They weren't really adding any value and added complexity to the API
2023-02-01 12:05:25 -08:00
Sam Lantinga
9ff1055489
Workaround for Visual Studio 2019 const warning
...
Visual Studio 2022, gcc, and clang all agree that "const SDL_DisplayMode **" is a non-const pointer to const data, but Visual Studio 2019 warns about this, so we'll just add a cast to the SDL_free() call for now.
Apparently this was a legitimate bug that has been recently fixed:
https://stackoverflow.com/questions/10403713/why-does-visual-c-warn-on-implicit-cast-from-const-void-to-void-in-c-but
2023-02-01 12:05:25 -08:00
Sam Lantinga
6b137579ea
Windows default to fullscreen desktop mode if they don't pick an explicit video mode
...
Rather than iterating over display modes using an index, there is a new function SDL_GetFullscreenDisplayModes() to get the list of available fullscreen modes on a display.
{
SDL_DisplayID display = SDL_GetPrimaryDisplay();
int num_modes = 0;
SDL_DisplayMode **modes = SDL_GetFullscreenDisplayModes(display, &num_modes);
if (modes) {
for (i = 0; i < num_modes; ++i) {
SDL_DisplayMode *mode = modes[i];
SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gHz, %d%% scale\n",
display, i, mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f));
}
SDL_free(modes);
}
}
SDL_GetDesktopDisplayMode() and SDL_GetCurrentDisplayMode() return pointers to display modes rather than filling in application memory.
Windows now have an explicit fullscreen mode that is set, using SDL_SetWindowFullscreenMode(). The fullscreen mode for a window can be queried with SDL_GetWindowFullscreenMode(), which returns a pointer to the mode, or NULL if the window will be fullscreen desktop. SDL_SetWindowFullscreen() just takes a boolean value, setting the correct fullscreen state based on the selected mode.
2023-02-01 12:05:25 -08:00
Anonymous Maarten
048df6260c
Remove disabled self test main functions in src/SDL_error.c
2023-02-01 20:14:48 +01:00
Anonymous Maarten
4af93990a9
Remove disabled self test main functions
2023-02-01 20:13:34 +01:00
Anonymous Maarten
e73151f544
ci: don't upload test directory for ps2 workflow separately
2023-02-01 20:04:47 +01:00
Anonymous Maarten
2afee88c81
ci+haiku: ignore return code of sv force-restart
2023-02-01 19:43:11 +01:00
Frank Praznik
d58693928d
video: Return the display ID when the window is fully enclosed
...
If the window was fully enclosed, GetDisplayForRect() would return the index of the display ID in the array instead of the display ID itself. Return the display ID itself.
2023-01-31 20:23:52 +01:00
Sam Lantinga
c5f570b30b
Make sure count is 0 in out of memory conditions
...
This prevents a crash if the caller assumes that they can always dereference the returned pointer if there is a non-zero count.
2023-01-31 10:04:51 -08:00
Vladyslav Serhiienko
47deebe23f
Fixes for Android builds
2023-01-31 08:39:51 -08:00
Anonymous Maarten
0a3d038ff7
cmake: fix installed SDL3::SDL3_test + test on ci
2023-01-31 05:29:38 +01:00
Anonymous Maarten
72f40cb1f5
ci: restart VM after installing haiku dependencies
2023-01-31 01:59:21 +01:00
Anonymous Maarten
25b723cc82
cmake: detect Emscripten architecture as emscripten
2023-01-31 01:59:21 +01:00
Anonymous Maarten
53d434fd24
cmake: add CPack support for creating binary archives
2023-01-31 01:59:21 +01:00
Anonymous Maarten
64c97906c9
ci: fail CMake configuration on warning
2023-01-31 01:59:21 +01:00
Anonymous Maarten
23c2c15a70
cmake: capitalize SDL3::Headers target
2023-01-31 01:59:21 +01:00
Anonymous Maarten
d45f0a0566
ci: upload artifacts for main workflow
2023-01-31 01:59:21 +01:00
Anonymous Maarten
32e7921f98
cmake: by default, link tests to SDL3.dll on Windows
2023-01-31 01:59:21 +01:00
Anonymous Maarten
13c294eec3
cmake: add support for creating Apple frameworks with CMake
2023-01-31 01:59:21 +01:00
Anonymous Maarten
93c25e650c
cmake: create SDL3::headers for include path + no exported CMake variables
2023-01-31 01:59:21 +01:00
Anonymous Maarten
5690dfb65b
cmake: don't install Android.mk files for Android
2023-01-31 01:59:21 +01:00
Anonymous Maarten
09e2f83e17
cmake: no more SDL3_* cache variables
2023-01-31 01:59:21 +01:00
Anonymous Maarten
19d162281c
cmake: detect cpu architecture in SDL_DetectCPUArchitecture
...
Stop looking for arch, when one is found
2023-01-31 01:59:21 +01:00
Anonymous Maarten
9cf34908a1
cmake: pass VERSION to project() + don't use SDL_VERSION
2023-01-31 01:59:21 +01:00
Anonymous Maarten
3aa456dead
cmake: remove MSCOS_RPATH related FIXME
...
The Macos CI does not show any warnings, so assume it's fixed
2023-01-31 01:59:21 +01:00
Bruno Sanches
7c085862e1
SDL_Video.h - audio driver
...
I believe you intend to say "video driver", not audio driver
2023-01-30 08:13:16 -08:00
Sylvain
d66f27376e
Prevent setting an error "invalid display" when the parameter displayID hasn't been set.
2023-01-30 10:57:51 +01:00
Sam Lantinga
b07f8e987b
Fixed checking the return values of SDL_AddBasicVideoDisplay() and SDL_AddVideoDisplay()
...
Also fixed Wayland and Windows usage of SDL_DelVideoDisplay()
https://github.com/libsdl-org/SDL/issues/7192
2023-01-29 21:58:15 -08:00
Sam Lantinga
1ffc09c6e6
Changed SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED to be the same value as SDL_EVENT_WINDOW_SIZE_CHANGED so SDL2 applications continue to work as expected.
2023-01-29 21:37:51 -08:00
Sam Lantinga
de766fdcd7
Fixed Haiku build
2023-01-29 21:35:45 -08:00
SDL Wiki Bot
87af6c0019
Sync SDL3 wiki -> header
2023-01-30 03:26:14 +00:00
Sam Lantinga
22c69bccdf
Displays are now referenced by instance ID instead of index
2023-01-29 19:25:15 -08:00
Anonymous Maarten
758c0dd6d8
Rename mouse BUTTON(DOWN|UP) event to BUTTON_(DOWN|UP)
2023-01-29 19:24:48 -08:00
Sylvain
413376cdb3
migration: replace SDL_DisplayMode w and h by screen_w and screen_h
2023-01-29 12:19:09 -08:00