Backends: SDL: Removed SDL_MOUSEWHEEL value clamping. (#4019, #6096, #6081)

+ Fix warnings.
This commit is contained in:
ocornut 2023-02-02 14:23:39 +01:00
parent 3617a96372
commit f822e07d76
3 changed files with 9 additions and 5 deletions

View File

@ -112,6 +112,7 @@
#endif #endif
#if defined(__GNUC__) #if defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx'
#pragma GCC diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types #pragma GCC diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types
#endif #endif

View File

@ -18,6 +18,7 @@
// 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)
// 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) // 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. // 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
// 2022-09-26: Inputs: Disable SDL 2.0.22 new "auto capture" (SDL_HINT_MOUSE_AUTO_CAPTURE) which prevents drag and drop across windows for multi-viewport support + don't capture when drag and dropping. (#5710) // 2022-09-26: Inputs: Disable SDL 2.0.22 new "auto capture" (SDL_HINT_MOUSE_AUTO_CAPTURE) which prevents drag and drop across windows for multi-viewport support + don't capture when drag and dropping. (#5710)
@ -261,8 +262,8 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
} }
case SDL_MOUSEWHEEL: case SDL_MOUSEWHEEL:
{ {
float wheel_x = (event->wheel.x < 0) ? 1.0f : (event->wheel.x > 0) ? -1.0f : 0.0f; // About the clamping and flipped axis: see #4019 float wheel_x = -(float)event->wheel.x;
float wheel_y = (event->wheel.y > 0) ? 1.0f : (event->wheel.y < 0) ? -1.0f : 0.0f; float wheel_y = (float)event->wheel.y;
io.AddMouseWheelEvent(wheel_x, wheel_y); io.AddMouseWheelEvent(wheel_x, wheel_y);
return true; return true;
} }

View File

@ -91,6 +91,8 @@ All changes:
can exacerbate that. (#6114, #3644) can exacerbate that. (#6114, #3644)
- Backends: OSX: Fixed scroll/wheel scaling for devices emitting events with - Backends: OSX: Fixed scroll/wheel scaling for devices emitting events with
hasPreciseScrollingDeltas==false (e.g. non-Apple mices). hasPreciseScrollingDeltas==false (e.g. non-Apple mices).
- Backends: SDL: Removed SDL_MOUSEWHEEL value clamping. (#4019, #6096, #6081)
Latest Emscripten seems to emit correct values.
- Backend: WebGPU: Fix building for latest WebGPU specs (remove implicit layout generation). - Backend: WebGPU: Fix building for latest WebGPU specs (remove implicit layout generation).
(#6117, #4116, #3632) [@tonygrue, @bfierz] (#6117, #4116, #3632) [@tonygrue, @bfierz]
- Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call - Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call