mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-06 10:11:22 +08:00
Compare commits
3 Commits
c1db2b4bb0
...
737be31c63
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
737be31c63 | ||
|
|
6d99204a82 | ||
|
|
2b1904a849 |
@@ -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!
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -46,6 +46,7 @@ struct SDL_WindowData
|
||||
|
||||
Uint32 fullscreen_mode_flags;
|
||||
bool fullscreen_resize;
|
||||
bool fullscreen_change_in_progress;
|
||||
|
||||
bool has_pointer_lock;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user