emscripten: Allow resize events on fullscreen windows.
Fixes browsers on phone that change screen orientation during fullscreen not getting a resize event. Fixes #15024.
This commit is contained in:
@@ -519,7 +519,6 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u
|
||||
{
|
||||
SDL_WindowData *window_data = userData;
|
||||
|
||||
if (!(window_data->window->flags & SDL_WINDOW_FULLSCREEN)) {
|
||||
bool force = false;
|
||||
|
||||
// update pixel ratio
|
||||
@@ -529,10 +528,13 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u
|
||||
force = true;
|
||||
}
|
||||
}
|
||||
|
||||
const bool fill_document = (Emscripten_fill_document_window == window_data->window);
|
||||
if (fill_document || (window_data->window->flags & SDL_WINDOW_RESIZABLE)) {
|
||||
const bool fullscreen = (window_data->window->flags & SDL_WINDOW_FULLSCREEN) != 0; // fullscreen windows can resize on Emscripten, and the canvas should fill it.
|
||||
const bool resizable = (window_data->window->flags & SDL_WINDOW_RESIZABLE) != 0;
|
||||
if (fill_document || fullscreen || resizable) {
|
||||
double w, h;
|
||||
if (fill_document) {
|
||||
if (fill_document || fullscreen) {
|
||||
w = (double) uiEvent->windowInnerWidth;
|
||||
h = (double) uiEvent->windowInnerHeight;
|
||||
} else {
|
||||
@@ -560,7 +562,6 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u
|
||||
|
||||
SDL_SendWindowEvent(window_data->window, SDL_EVENT_WINDOW_RESIZED, SDL_lroundf(w), SDL_lroundf(h));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user