From 3aba4a7259455c2eafa74cec6055fb07a2e1bdb6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 4 Aug 2015 23:01:59 -0500 Subject: [PATCH 1/4] SDL mouse wheel speed fix. Default scroll speed wasn't delta-modified, so scroll gui controls were very slow when scrolled via mouse wheel.. This corrects the issue. --- Engine/source/windowManager/sdl/sdlWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index 140673313..10f4cce4a 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -434,7 +434,7 @@ void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt) void PlatformWindowSDL::_triggerMouseWheelNotify(const SDL_Event& evt) { - wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y); + wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y * WHEEL_DELTA); } void PlatformWindowSDL::_triggerMouseButtonNotify(const SDL_Event& event) From 8248ecdeac1e7acf564427cfa3cdf020bbbbef3c Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 5 Aug 2015 17:44:55 -0500 Subject: [PATCH 2/4] Looks like WHEEL_DELTA is defined for win and osx, but not linux. Retooling to utilize a $pref instead, as that will let the scroll speed be modifiable for any projects that need it. --- Engine/source/windowManager/sdl/sdlWindow.cpp | 2 +- Templates/Empty/game/core/scripts/client/defaults.cs | 1 + Templates/Full/game/core/scripts/client/defaults.cs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index 10f4cce4a..1d92c6f2e 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -434,7 +434,7 @@ void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt) void PlatformWindowSDL::_triggerMouseWheelNotify(const SDL_Event& evt) { - wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y * WHEEL_DELTA); + wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y * Con::getIntVariable("$pref::Input::MouseWheelSpeed")); } void PlatformWindowSDL::_triggerMouseButtonNotify(const SDL_Event& event) diff --git a/Templates/Empty/game/core/scripts/client/defaults.cs b/Templates/Empty/game/core/scripts/client/defaults.cs index 87a77b295..0142a9410 100644 --- a/Templates/Empty/game/core/scripts/client/defaults.cs +++ b/Templates/Empty/game/core/scripts/client/defaults.cs @@ -41,6 +41,7 @@ $pref::Input::KeyboardEnabled = 1; $pref::Input::MouseEnabled = 1; $pref::Input::JoystickEnabled = 0; $pref::Input::KeyboardTurnSpeed = 0.1; +$pref::Input::MouseWheelSpeed = 120; $sceneLighting::cacheSize = 20000; $sceneLighting::purgeMethod = "lastCreated"; diff --git a/Templates/Full/game/core/scripts/client/defaults.cs b/Templates/Full/game/core/scripts/client/defaults.cs index 87a77b295..0142a9410 100644 --- a/Templates/Full/game/core/scripts/client/defaults.cs +++ b/Templates/Full/game/core/scripts/client/defaults.cs @@ -41,6 +41,7 @@ $pref::Input::KeyboardEnabled = 1; $pref::Input::MouseEnabled = 1; $pref::Input::JoystickEnabled = 0; $pref::Input::KeyboardTurnSpeed = 0.1; +$pref::Input::MouseWheelSpeed = 120; $sceneLighting::cacheSize = 20000; $sceneLighting::purgeMethod = "lastCreated"; From 68a2c9fa894d89c4c421325f0c9704e90dd2d763 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 6 Aug 2015 18:29:01 -0500 Subject: [PATCH 3/4] Added a default value just in case the pref is not defined. --- Engine/source/windowManager/sdl/sdlWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index 1d92c6f2e..a0d57905e 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -434,7 +434,7 @@ void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt) void PlatformWindowSDL::_triggerMouseWheelNotify(const SDL_Event& evt) { - wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y * Con::getIntVariable("$pref::Input::MouseWheelSpeed")); + wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y * Con::getIntVariable("$pref::Input::MouseWheelSpeed", 120)); } void PlatformWindowSDL::_triggerMouseButtonNotify(const SDL_Event& event) From 5efc04dd472dbf0ca91f2411d22978e0ec618059 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 6 Aug 2015 22:18:10 -0500 Subject: [PATCH 4/4] Also apply scroll strength to horizontal scrolling. --- Engine/source/windowManager/sdl/sdlWindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index a0d57905e..60c3c4065 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -434,7 +434,8 @@ void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt) void PlatformWindowSDL::_triggerMouseWheelNotify(const SDL_Event& evt) { - wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y * Con::getIntVariable("$pref::Input::MouseWheelSpeed", 120)); + S32 wheelDelta = Con::getIntVariable("$pref::Input::MouseWheelSpeed", 120); + wheelEvent.trigger(getWindowId(), 0, evt.wheel.x * wheelDelta, evt.wheel.y * wheelDelta); } void PlatformWindowSDL::_triggerMouseButtonNotify(const SDL_Event& event)