Skip to content

Commit

Permalink
Support for SDL2's mouse wheel event in the GUI1 scrollbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Mar 14, 2014
1 parent 85e8c45 commit 5e96c47
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/widgets/scrollbar.cpp
Expand Up @@ -375,6 +375,21 @@ void scrollbar::handle_event(const SDL_Event& event)
}
break;
}
#if SDL_VERSION_ATLEAST(2,0,0)
case SDL_MOUSEWHEEL:
{
const SDL_MouseWheelEvent& e = event.wheel;
int x, y;
SDL_GetMouseState(&x, &y);
bool on_groove = point_in_rect(x, y, groove);
if (on_groove && e.y < 0) {
move_position(scroll_rate_);
} else if (on_groove && e.y > 0) {
move_position(-scroll_rate_);
}
break;
}
#endif
default:
break;
}
Expand Down

0 comments on commit 5e96c47

Please sign in to comment.