aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2026-02-12 19:03:37 +0100
committerGitHub <noreply@github.com>2026-02-12 19:03:37 +0100
commitd49490bfc57b7759a6bce3c6a06e7c8a0e241f93 (patch)
treea33bcc2016bbf758c9aca982e53468c742f6d0d6
parent9c8853a9a1cd18a7c35b24986a1a11663b4565eb (diff)
parente84b4c7d766bc36b65ec1ed7c537a573f565746a (diff)
Merge pull request #1442 from floooh/issue1441/mouse-wheel-zoom
sokol_app.h win: harmonize mouse wheel speed with glfw
-rw-r--r--CHANGELOG.md10
-rw-r--r--sokol_app.h10
2 files changed, 15 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec7486c7..4599b7bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,15 @@
## Updates
+### 12-Feb-2026
+
+- sokol_app.h: 'harmonized' mouse wheel scaling with GLFW. This only affects
+ Windows and Emscripten. Basically, on Windows and Emscripten mouse wheel
+ events where scaled to be 4x 'faster' than intended (e.g. a mouse wheel
+ 'click' was 4 units instead of 1). On macOS and Linux the scaling was already
+ correct.
+
+ PR: https://github.com/floooh/sokol/pull/1442
+
### 08-Feb-2026
- sokol_app.h ios/mtl: Fix a spurious assert when applying scissor rect after
diff --git a/sokol_app.h b/sokol_app.h
index 3b965980..b6e54ede 100644
--- a/sokol_app.h
+++ b/sokol_app.h
@@ -7289,7 +7289,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_wheel_cb(int emsc_type, const EmscriptenWheelE
/* see https://github.com/floooh/sokol/issues/339 */
float scale;
switch (emsc_event->deltaMode) {
- case DOM_DELTA_PIXEL: scale = -0.04f; break;
+ case DOM_DELTA_PIXEL: scale = -0.01f; break;
case DOM_DELTA_LINE: scale = -1.33f; break;
case DOM_DELTA_PAGE: scale = -10.0f; break; // FIXME: this is a guess
default: scale = -0.1f; break; // shouldn't happen
@@ -9072,8 +9072,8 @@ _SOKOL_PRIVATE void _sapp_win32_scroll_event(float x, float y) {
if (_sapp_events_enabled()) {
_sapp_init_event(SAPP_EVENTTYPE_MOUSE_SCROLL);
_sapp.event.modifiers = _sapp_win32_mods();
- _sapp.event.scroll_x = -x / 30.0f;
- _sapp.event.scroll_y = y / 30.0f;
+ _sapp.event.scroll_x = x;
+ _sapp.event.scroll_y = y;
_sapp_call_event(&_sapp.event);
}
}
@@ -9386,10 +9386,10 @@ _SOKOL_PRIVATE LRESULT CALLBACK _sapp_win32_wndproc(HWND hWnd, UINT uMsg, WPARAM
}
break;
case WM_MOUSEWHEEL:
- _sapp_win32_scroll_event(0.0f, (float)((SHORT)HIWORD(wParam)));
+ _sapp_win32_scroll_event(0.0f, (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA);
break;
case WM_MOUSEHWHEEL:
- _sapp_win32_scroll_event((float)((SHORT)HIWORD(wParam)), 0.0f);
+ _sapp_win32_scroll_event(-(float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA, 0.0f);
break;
case WM_CHAR:
_sapp_win32_char_event((uint32_t)wParam, !!(lParam&0x40000000));