From 401d0ff33f804ae7e5a08706e100d6d38ddb682b Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 11 Dec 2021 20:52:04 +0000 Subject: [PATCH] DiabloUI: Handle mouse wheel in SDL 1.2 --- Source/DiabloUI/diabloui.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/DiabloUI/diabloui.cpp b/Source/DiabloUI/diabloui.cpp index ec5008e7a..cd724b066 100644 --- a/Source/DiabloUI/diabloui.cpp +++ b/Source/DiabloUI/diabloui.cpp @@ -352,7 +352,7 @@ void UiFocusNavigation(SDL_Event *event) if (HandleMenuAction(GetMenuAction(*event))) return; -#ifndef USE_SDL1 +#if SDL_VERSION_ATLEAST(2, 0, 0) if (event->type == SDL_MOUSEWHEEL) { if (event->wheel.y > 0) { UiFocusUp(); @@ -361,6 +361,17 @@ void UiFocusNavigation(SDL_Event *event) } return; } +#else + if (event->type == SDL_MOUSEBUTTONDOWN) { + switch (event->button.button) { + case SDL_BUTTON_WHEELUP: + UiFocusUp(); + return; + case SDL_BUTTON_WHEELDOWN: + UiFocusDown(); + return; + } + } #endif if (textInputActive) {