Merge branch 'master' into docking

# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_sdl.cpp
This commit is contained in:
ocornut 2023-02-02 19:38:24 +01:00
commit 5ebb6a2954
4 changed files with 21 additions and 3 deletions

View File

@ -482,12 +482,12 @@ jobs:
emsdk-master/emsdk install latest
emsdk-master/emsdk activate latest
- name: Build example_emscripten_opengl3
- name: Build example_sdl_opengl3 with Emscripten
run: |
pushd emsdk-master
source ./emsdk_env.sh
popd
make -C examples/example_emscripten_opengl3
make -C examples/example_sdl_opengl3 -f Makefile.emscripten
- name: Build example_emscripten_wgpu
run: |

View File

@ -21,6 +21,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2023-02-02: Inputs: Scaling X value on Emscripten (bug?). (#4019, #6096)
// 2023-01-18: Handle unsupported glfwGetVideoMode() call on e.g. Emscripten.
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
@ -318,6 +319,10 @@ void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yo
if (bd->PrevUserCallbackScroll != nullptr && window == bd->Window)
bd->PrevUserCallbackScroll(window, xoffset, yoffset);
#ifdef __EMSCRIPTEN__
xoffset /= 100.0;
#endif
ImGuiIO& io = ImGui::GetIO();
io.AddMouseWheelEvent((float)xoffset, (float)yoffset);
}

View File

@ -21,6 +21,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2023-02-02: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data for smooth scrolling + Scaling X value on Emscripten (bug?). (#4019, #6096)
// 2023-02-02: Removed SDL_MOUSEWHEEL value clamping, as values seem correct in latest Emscripten. (#4019)
// 2023-02-01: Flipping SDL_MOUSEWHEEL 'wheel.x' value to match other backends and offer consistent horizontal scrolling direction. (#4019, #6096, #1463)
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
@ -289,8 +290,17 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
}
case SDL_MOUSEWHEEL:
{
//IMGUI_DEBUG_LOG("wheel %.2f %.2f, precise %.2f %.2f\n", (float)event->wheel.x, (float)event->wheel.y, event->wheel.preciseX, event->wheel.preciseY);
#if SDL_VERSION_ATLEAST(2,0,18) // If this fails to compile on Emscripten: update to latest Emscripten!
float wheel_x = -event->wheel.preciseX;
float wheel_y = event->wheel.preciseY;
#else
float wheel_x = -(float)event->wheel.x;
float wheel_y = (float)event->wheel.y;
#endif
#ifdef __EMSCRIPTEN__
wheel_x /= 100.0f;
#endif
io.AddMouseWheelEvent(wheel_x, wheel_y);
return true;
}

View File

@ -157,13 +157,16 @@ All changes:
- Backends: OSX: Fixed scroll/wheel scaling for devices emitting events with
hasPreciseScrollingDeltas==false (e.g. non-Apple mices).
- Backends: SDL: Removed SDL_MOUSEWHEEL value clamping. (#4019, #6096, #6081)
Latest Emscripten seems to emit correct values.
- Backends: SDL: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data
for smooth scrolling as reported by SDL. (#4019, #6096)
- Backend: WebGPU: Fix building for latest WebGPU specs (remove implicit layout generation).
(#6117, #4116, #3632) [@tonygrue, @bfierz]
- Examples: refactord all examples to use a "MainLoopStep()" function. This is in order
to be able to trivially make some compile with Emscripten. (#2492, #3699)
While not all examples are expected to compile on Emscripten, we try to keep all of them
as close as possible to each others.
- Examples: Emscripten: The main SDL+GL and GLFW+GL examples now supports Emscripten.
(the dedicated example_emscripten_opengl3/ has been removed) (#2492, #2494, #3699, #3705)
- Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call
DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted
when application is compiled without /DUNICODE. (#5725, #5961, #5975) [@markreidvfx]