Compare commits

...

3 Commits

Author SHA1 Message Date
Ryan C. Gordon
737be31c63 emscripten: Prevent fullscreen transitions while one is already in progress.
Some checks failed
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Fixes #14533.
2025-12-01 23:33:30 -05:00
Cameron Gutman
6d99204a82 quit: don't call signal() if we're using sigaction()
At best, this is a no-op.

At worst, it might:
 - Clobber a signal handler someone registered after us
 - Overwrite the signal mask or flags
 - Cause unregistration to fail (sigaction() isn't guaranteed to return the exact pointer passed to signal())
2025-12-01 17:31:55 -06:00
Evan Hemsley
2b1904a849 GPU: Prefer D3D12 over Vulkan when available 2025-12-01 17:50:23 -05:00
5 changed files with 22 additions and 4 deletions

View File

@@ -46,8 +46,10 @@ static bool send_foregrounding_pending = false;
static void SDL_HandleSIG(int sig)
{
// Reset the signal handler
#ifndef HAVE_SIGACTION
// Reset the signal handler if it was installed with signal()
(void)signal(sig, SDL_HandleSIG);
#endif
// Send a quit event next time the event loop pumps.
// We can't send it in signal handler; SDL_malloc() might be interrupted!

View File

@@ -318,11 +318,11 @@ static const SDL_GPUBootstrap *backends[] = {
#ifdef SDL_GPU_METAL
&MetalDriver,
#endif
#ifdef SDL_GPU_VULKAN
&VulkanDriver,
#endif
#ifdef SDL_GPU_D3D12
&D3D12Driver,
#endif
#ifdef SDL_GPU_VULKAN
&VulkanDriver,
#endif
NULL
};

View File

@@ -480,6 +480,8 @@ static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const Emscripten
{
SDL_WindowData *window_data = userData;
window_data->fullscreen_change_in_progress = false;
if (fullscreenChangeEvent->isFullscreen) {
SDL_SendWindowEvent(window_data->window, SDL_EVENT_WINDOW_ENTER_FULLSCREEN, 0, 0);
window_data->fullscreen_mode_flags = 0;

View File

@@ -674,6 +674,17 @@ static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_thi
if (window->internal) {
data = window->internal;
if (data->fullscreen_change_in_progress) {
return SDL_FULLSCREEN_FAILED;;
}
EmscriptenFullscreenChangeEvent fsevent;
if (emscripten_get_fullscreen_status(&fsevent) == EMSCRIPTEN_RESULT_SUCCESS) {
if ((fullscreen == SDL_FULLSCREEN_OP_ENTER) == fsevent.isFullscreen) {
return SDL_FULLSCREEN_SUCCEEDED; // already there.
}
}
if (fullscreen) {
EmscriptenFullscreenStrategy strategy;
bool is_fullscreen_desktop = !window->fullscreen_exclusive;
@@ -704,8 +715,10 @@ static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_thi
}
if (res == EMSCRIPTEN_RESULT_SUCCESS) {
data->fullscreen_change_in_progress = true; // even on success, this might animate to the new state.
return SDL_FULLSCREEN_SUCCEEDED;
} else if (res == EMSCRIPTEN_RESULT_DEFERRED) {
data->fullscreen_change_in_progress = true;
return SDL_FULLSCREEN_PENDING;
} else {
return SDL_FULLSCREEN_FAILED;

View File

@@ -46,6 +46,7 @@ struct SDL_WindowData
Uint32 fullscreen_mode_flags;
bool fullscreen_resize;
bool fullscreen_change_in_progress;
bool has_pointer_lock;