|
@@ -20,6 +20,7 @@
|
|
|
|
|
|
// CHANGELOG
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
+// 2024-07-08: *BREAKING* Renamed ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback to ImGui_ImplGlfw_InstallEmscriptenCallbacks(), added GLFWWindow* parameter.
|
|
|
// 2024-07-02: Emscripten: Added io.PlatformOpenInShellFn() handler for Emscripten versions.
|
|
|
// 2023-12-19: Emscripten: Added ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback() to register canvas selector and auto-resize GLFW window.
|
|
|
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys.
|
|
@@ -611,12 +612,6 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
|
|
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
|
|
if (install_callbacks)
|
|
|
ImGui_ImplGlfw_InstallCallbacks(window);
|
|
|
- // Register Emscripten Wheel callback to workaround issue in Emscripten GLFW Emulation (#6096)
|
|
|
- // We intentionally do not check 'if (install_callbacks)' here, as some users may set it to false and call GLFW callback themselves.
|
|
|
- // FIXME: May break chaining in case user registered their own Emscripten callback?
|
|
|
-#ifdef __EMSCRIPTEN__
|
|
|
- emscripten_set_wheel_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, nullptr, false, ImGui_ImplEmscripten_WheelCallback);
|
|
|
-#endif
|
|
|
|
|
|
// Set platform dependent data in viewport
|
|
|
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
|
@@ -664,7 +659,8 @@ void ImGui_ImplGlfw_Shutdown()
|
|
|
if (bd->InstalledCallbacks)
|
|
|
ImGui_ImplGlfw_RestoreCallbacks(bd->Window);
|
|
|
#ifdef __EMSCRIPTEN__
|
|
|
- emscripten_set_wheel_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, nullptr, false, nullptr);
|
|
|
+ if (bd->CanvasSelector)
|
|
|
+ emscripten_set_wheel_callback(bd->CanvasSelector, nullptr, false, nullptr);
|
|
|
#endif
|
|
|
|
|
|
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
|
|
@@ -844,7 +840,7 @@ static EM_BOOL ImGui_ImplEmscripten_FullscreenChangeCallback(int event_type, con
|
|
|
|
|
|
// 'canvas_selector' is a CSS selector. The event listener is applied to the first element that matches the query.
|
|
|
// STRING MUST PERSIST FOR THE APPLICATION DURATION. PLEASE USE A STRING LITERAL OR ENSURE POINTER WILL STAY VALID.
|
|
|
-void ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback(const char* canvas_selector)
|
|
|
+void ImGui_ImplGlfw_InstallEmscriptenCallbacks(GLFWwindow*, const char* canvas_selector)
|
|
|
{
|
|
|
IM_ASSERT(canvas_selector != nullptr);
|
|
|
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
|
@@ -856,6 +852,11 @@ void ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback(const char* canvas_sel
|
|
|
|
|
|
// Change the size of the GLFW window according to the size of the canvas
|
|
|
ImGui_ImplGlfw_OnCanvasSizeChange(EMSCRIPTEN_EVENT_RESIZE, {}, bd);
|
|
|
+
|
|
|
+ // Register Emscripten Wheel callback to workaround issue in Emscripten GLFW Emulation (#6096)
|
|
|
+ // We intentionally do not check 'if (install_callbacks)' here, as some users may set it to false and call GLFW callback themselves.
|
|
|
+ // FIXME: May break chaining in case user registered their own Emscripten callback?
|
|
|
+ emscripten_set_wheel_callback(bd->CanvasSelector, nullptr, false, ImGui_ImplEmscripten_WheelCallback);
|
|
|
}
|
|
|
#endif
|
|
|
|