fix(vpinball): skip SDL_SetWindowIcon on the Emscripten target
SDL3's Emscripten video backend emulates SetWindowIcon by pointing the page's <link rel="icon"> at a blob: URL of the encoded surface - a reasonable desktop-icon mapping in general, but unwanted for an embeddable widget where the host page already has its own favicon. Verified via examples/basic: after this patch, no rel=icon link is ever created/mutated while a table runs (previously a consumer had to work around this with a MutationObserver reverting it every time).
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
diff --git a/src/renderer/Window.cpp b/src/renderer/Window.cpp
|
||||
index 3dff060..92a96df 100644
|
||||
--- a/src/renderer/Window.cpp
|
||||
+++ b/src/renderer/Window.cpp
|
||||
@@ -264,6 +264,12 @@ Window::Window(const string& title, const Settings& settings, VPXWindowId window
|
||||
m_pixelDensity = 1.f;
|
||||
}
|
||||
|
||||
+#ifndef __EMSCRIPTEN__
|
||||
+ // SDL3's Emscripten video backend emulates SDL_SetWindowIcon by pointing
|
||||
+ // the page's <link rel="icon"> at a blob: URL of the encoded surface -
|
||||
+ // a reasonable desktop-icon mapping in general, but unwanted here where
|
||||
+ // the embedding page already has its own favicon. Skip it on this target
|
||||
+ // rather than fight it from the host page's JS.
|
||||
if (auto icon = BaseTexture::CreateFromFile(g_app->m_fileLocator.GetAppPath(FileLocator::AppSubFolder::Assets, "vpinball.png")); icon)
|
||||
{
|
||||
SDL_Surface* pSurface = icon->ToSDLSurface();
|
||||
@@ -276,6 +282,7 @@ Window::Window(const string& title, const Settings& settings, VPXWindowId window
|
||||
else {
|
||||
PLOGE << "Failed to load window icon: " << SDL_GetError();
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Check if the platform allows positioning windows (as Wayland forbids it...)
|
||||
{
|
||||
Reference in New Issue
Block a user