From f607992885022f438a297601c96901c8861f47e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Mon, 24 Aug 2026 13:56:48 +0200 Subject: [PATCH] fix(vpinball): skip SDL_SetWindowIcon on the Emscripten target SDL3's Emscripten video backend emulates SetWindowIcon by pointing the page's 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). --- .../0009-emscripten-skip-window-icon.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 patches/vpinball/0009-emscripten-skip-window-icon.patch diff --git a/patches/vpinball/0009-emscripten-skip-window-icon.patch b/patches/vpinball/0009-emscripten-skip-window-icon.patch new file mode 100644 index 0000000..f605789 --- /dev/null +++ b/patches/vpinball/0009-emscripten-skip-window-icon.patch @@ -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 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...) + {