diff --git a/backends/imgui_impl_glut.cpp b/backends/imgui_impl_glut.cpp index 7a9a32a63..4734e4927 100644 --- a/backends/imgui_impl_glut.cpp +++ b/backends/imgui_impl_glut.cpp @@ -9,6 +9,7 @@ // [X] Platform: Partial keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLUT values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] // Issues: // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I +// [ ] Platform: Missing horizontal mouse wheel support. // [ ] Platform: Missing mouse cursor shape/visibility support. // [ ] Platform: Missing clipboard support (not supported by Glut). // [ ] Platform: Missing gamepad support. diff --git a/backends/imgui_impl_glut.h b/backends/imgui_impl_glut.h index 98d4e5989..545cd8dd3 100644 --- a/backends/imgui_impl_glut.h +++ b/backends/imgui_impl_glut.h @@ -9,6 +9,7 @@ // [X] Platform: Partial keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLUT values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] // Issues: // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I +// [ ] Platform: Missing horizontal mouse wheel support. // [ ] Platform: Missing mouse cursor shape/visibility support. // [ ] Platform: Missing clipboard support (not supported by Glut). // [ ] Platform: Missing gamepad support. diff --git a/backends/imgui_impl_osx.mm b/backends/imgui_impl_osx.mm index aa65d7131..6b34b39a8 100644 --- a/backends/imgui_impl_osx.mm +++ b/backends/imgui_impl_osx.mm @@ -24,6 +24,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2023-02-01: Fixed scroll wheel scaling for devices emitting events with hasPreciseScrollingDeltas==false (e.g. non-Apple mices). // 2022-11-02: Fixed mouse coordinates before clicking the host window. // 2022-10-06: Fixed mouse inputs on flipped views. // 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported). @@ -671,18 +672,18 @@ static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view) wheel_dy = [event scrollingDeltaY]; if ([event hasPreciseScrollingDeltas]) { - wheel_dx *= 0.1; - wheel_dy *= 0.1; + wheel_dx *= 0.01; + wheel_dy *= 0.01; } } else #endif // MAC_OS_X_VERSION_MAX_ALLOWED { - wheel_dx = [event deltaX]; - wheel_dy = [event deltaY]; + wheel_dx = [event deltaX] * 0.1; + wheel_dy = [event deltaY] * 0.1; } if (wheel_dx != 0.0 || wheel_dy != 0.0) - io.AddMouseWheelEvent((float)wheel_dx * 0.1f, (float)wheel_dy * 0.1f); + io.AddMouseWheelEvent((float)wheel_dx, (float)wheel_dy); return io.WantCaptureMouse; } diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 4a84eb02e..13f918af6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -59,6 +59,8 @@ All changes: - Misc: Tolerate zero delta-time under Emscripten as backends are imprecise in their values for io.DeltaTime, and browser features such as "privacy.resistFingerprinting=true" can exacerbate that. (#6114, #3644) +- Backends: OSX: Fixed scroll/wheel scaling for devices emitting events with + hasPreciseScrollingDeltas==false (e.g. non-Apple mices). - Backend: WebGPU: Fix building for latest WebGPU specs (remove implicit layout generation). (#6117, #4116, #3632) [@tonygrue, @bfierz] - Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call diff --git a/examples/example_emscripten_opengl3/Makefile b/examples/example_emscripten_opengl3/Makefile index b2933e108..db8e582f2 100644 --- a/examples/example_emscripten_opengl3/Makefile +++ b/examples/example_emscripten_opengl3/Makefile @@ -1,5 +1,5 @@ # -# Makefile to use with emscripten +# Makefile to use with SDL+emscripten # See https://emscripten.org/docs/getting_started/downloads.html # for installation instructions. # diff --git a/examples/example_emscripten_opengl3/main.cpp b/examples/example_emscripten_opengl3/main.cpp index a0a8d70c1..5e31d8957 100644 --- a/examples/example_emscripten_opengl3/main.cpp +++ b/examples/example_emscripten_opengl3/main.cpp @@ -49,7 +49,7 @@ int main(int, char**) SDL_DisplayMode current; SDL_GetCurrentDisplayMode(0, ¤t); SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); - g_Window = SDL_CreateWindow("Dear ImGui Emscripten example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); + g_Window = SDL_CreateWindow("Dear ImGui SDL+Emscripten example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); g_GLContext = SDL_GL_CreateContext(g_Window); if (!g_GLContext) { diff --git a/examples/example_emscripten_opengl3/shell_minimal.html b/examples/example_emscripten_opengl3/shell_minimal.html index 514385d7c..6cb61bd77 100644 --- a/examples/example_emscripten_opengl3/shell_minimal.html +++ b/examples/example_emscripten_opengl3/shell_minimal.html @@ -3,7 +3,7 @@ - Dear ImGui Emscripten example + Dear ImGui SDL+Emscripten example