|
@@ -18,6 +18,11 @@
|
|
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
|
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
|
// - Introduction, links and more at the top of imgui.cpp
|
|
// - Introduction, links and more at the top of imgui.cpp
|
|
|
|
|
|
|
|
+// About Emscripten support:
|
|
|
|
+// - Emscripten provides its own GLFW (3.2.1) implementation (syntax: "-sUSE_GLFW=3"), but Joystick is broken and several features are not supported (multiple windows, clipboard, timer, etc.)
|
|
|
|
+// - A third-party Emscripten GLFW (3.4.0) implementation (syntax: "--use-port=contrib.glfw3") fixes the Joystick issue and implements all relevant features for the browser.
|
|
|
|
+// See https://github.com/pongasoft/emscripten-glfw/blob/master/docs/Comparison.md for details.
|
|
|
|
+
|
|
// CHANGELOG
|
|
// CHANGELOG
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
|
|
// 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO:
|
|
@@ -560,7 +565,7 @@ void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows)
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef __EMSCRIPTEN__
|
|
#ifdef __EMSCRIPTEN__
|
|
-#if EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 >= 3'4'0'20240817
|
|
|
|
|
|
+#if EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 >= 34020240817
|
|
void ImGui_ImplGlfw_EmscriptenOpenURL(const char* url) { if (url) emscripten::glfw3::OpenURL(url); }
|
|
void ImGui_ImplGlfw_EmscriptenOpenURL(const char* url) { if (url) emscripten::glfw3::OpenURL(url); }
|
|
#else
|
|
#else
|
|
EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (const char* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); });
|
|
EM_JS(void, ImGui_ImplGlfw_EmscriptenOpenURL, (const char* url), { url = url ? UTF8ToString(url) : null; if (url) window.open(url, '_blank'); });
|
|
@@ -639,6 +644,21 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
|
::SetWindowLongPtrW((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc);
|
|
::SetWindowLongPtrW((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ // Emscripten: the same application can run on various platforms, so we detect the Apple platform at runtime
|
|
|
|
+ // to override io.ConfigMacOSXBehaviors from its default (which is always false in Emscripten).
|
|
|
|
+#if EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3 >= 34020240817
|
|
|
|
+ if (emscripten::glfw3::IsRuntimePlatformApple())
|
|
|
|
+ {
|
|
|
|
+ ImGui::GetIO().ConfigMacOSXBehaviors = true;
|
|
|
|
+
|
|
|
|
+ // Due to how the browser (poorly) handles the Meta Key, this line essentially disables repeats when used.
|
|
|
|
+ // This means that Meta + V only registers a single key-press, even if the keys are held.
|
|
|
|
+ // This is a compromise for dealing with this issue in ImGui since ImGui implements key repeat itself.
|
|
|
|
+ // See https://github.com/pongasoft/emscripten-glfw/blob/v3.4.0.20240817/docs/Usage.md#the-problem-of-the-super-key
|
|
|
|
+ emscripten::glfw3::SetSuperPlusKeyTimeouts(10, 10);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+
|
|
bd->ClientApi = client_api;
|
|
bd->ClientApi = client_api;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|