[Scummvm-git-logs] scummvm master -> a20d2172fa721188fb8cb07766504e59b8985629

criezy criezy at scummvm.org
Tue Mar 21 22:08:24 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a20d2172fa SDL: Respect OS setting for wheel scroll direction on SDL 2.0.4+


Commit: a20d2172fa721188fb8cb07766504e59b8985629
    https://github.com/scummvm/scummvm/commit/a20d2172fa721188fb8cb07766504e59b8985629
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-03-21T21:06:35Z

Commit Message:
SDL: Respect OS setting for wheel scroll direction on SDL 2.0.4+

The setting was already respected on SDL < 2.0.4 (such as SDL1).
If the OS inverts the scrolling direction, this is reflected on the sign
of the y value of the SDL event. Since version 2.0.4 the SDL event
also had a flag to indicate if the direction is flipped and we were
using it to change back the y sign. That means the OS scrolling
direction setting was not respected. With this commit we now have
a consistent behaviour with all SDL versions (the OS scroll direction
setting is respected).

If our wheel events are used for something other than scrolling
however, we might want to get the actually wheel move direction
(i.e. use a Common::EVENT_WHEELDOWN when moving the wheel
down even if the OS scroll setting is to flip it). In such a case we
might want to revert this change and instead add an additional flag
to the event so that we know the scroll direction should be flipped
and use it in places where the event is used for scrolling.

Changed paths:
    backends/events/sdl/sdl-events.cpp


diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index a165746..946a1af 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -545,11 +545,6 @@ bool SdlEventSource::dispatchSDLEvent(SDL_Event &ev, Common::Event &event) {
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	case SDL_MOUSEWHEEL: {
 		Sint32 yDir = ev.wheel.y;
-#if SDL_VERSION_ATLEAST(2, 0, 4)
-		if (ev.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) {
-			yDir *= -1;
-		}
-#endif
 		// HACK: It seems we want the mouse coordinates supplied
 		// with a mouse wheel event. However, SDL2 does not supply
 		// these, thus we use whatever we got last time. It seems





More information about the Scummvm-git-logs mailing list