Commit Graph

11828 Commits

Author SHA1 Message Date
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
Frank Praznik e22f5ed7d3 wayland: Check that all required dynamic symbols have been successfully resolved at init time
Ensure that all hard dependencies are resolved when dynamically loading the libraries required for the Wayland backend and fail gracefully if a required module was not initialized successfully.
2023-01-29 11:23:08 -08:00
Sasha Szpakowski 90795291e4 Remove SDL_GL/Metal/Vulkan_GetDrawableSize().
SDL_GetWindowSizeInPixels supersedes those functions.
2023-01-29 11:20:33 -08:00
Sasha Szpakowski 0d0a34f79f iOS: fix the desktop display mode's display scale property. 2023-01-29 11:11:46 -08:00
Frank Praznik a67b441a10 wayland: Send a pixel sized change event when the drawable size changes 2023-01-28 18:37:15 -08:00
Aaron Barany 4667d65f77 Fixes for building on Mac with OpenGL disabled. 2023-01-28 17:24:25 -08:00
Sam Lantinga df7639f100 Call SDL_OnWindow* handlers after the event has been delivered
This guarantees that events which trigger other events will happen in dependency order, instead of being reversed.
2023-01-28 15:56:02 -08:00
Sam Lantinga 432af82a88 Don't deliver window events while it's being destroyed 2023-01-28 15:56:02 -08:00
Sam Lantinga bf4095359c Removed duplicated window size events, and added SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED 2023-01-28 15:56:02 -08:00
Sasha Szpakowski af0ec13fc3 iOS: fix display modes to have accurate pixel sizes and screen scales. 2023-01-28 15:48:08 -08:00
SDL Wiki Bot 8814bedc3b Sync SDL3 wiki -> header 2023-01-28 18:57:14 +00:00
Sam Lantinga 31f464153d SDL_WINDOW_INPUT_GRABBED has been renamed SDL_WINDOW_MOUSE_GRABBED 2023-01-28 10:56:38 -08:00
Sam Lantinga e83c54f271 SDL_WINDOW_FULLSCREEN and SDL_WINDOW_FULLSCREEN_DESKTOP are now distinct flags 2023-01-28 10:56:38 -08:00
Sasha Szpakowski 67037f064b macOS: remove obsolete 10.7 and 10.8-specific code. 2023-01-27 20:46:38 -08:00
Sasha Szpakowski d293145ec9 macOS: include @1x display modes with the same point-size as @2x modes
Previously they were discarded because SDL didn't expose enough information for apps to differentiate between a low-dpi and high-dpi mode which had the same size in DPI-scaled points. Now the information is available in SDL_DisplayMode.

Fixes #3025.
2023-01-27 20:43:13 -08:00
Frank Praznik ba74e76e56 wayland: Correct mode values to use pixels instead of screen units
Fixes the Wayland backend to report the desktop mode dimensions in pixels instead of screen units, adjusts enumerated fullscreen resolutions to use the correct pixel values and scaling, and changes some nomenclature to reflect the terminology used in the new DPI system.
2023-01-27 14:51:08 -08:00
Sam Lantinga 0229091f37 Fixed build 2023-01-27 14:24:06 -08:00
Sam Lantinga 24fec13ac1 Add full high DPI information to SDL_DisplayMode
SDL_DisplayMode now includes the pixel size, the screen size and the relationship between the two. For example, a 4K display at 200% scale could have a pixel size of 3840x2160, a screen size of 1920x1080, and a display scale of 2.0.
2023-01-27 12:38:46 -08:00
Sylvain b23d20cd4d Android: display_mode scale: cast to do a float division 2023-01-27 08:17:20 -08:00