This is an automated email from the git hooks/post-receive script. smcv pushed a commit to tag 1.51 in repository iortcw.
commit ea30c07df52748f2791e92643e0e980da9d33357 Author: MAN-AT-ARMS <[email protected]> Date: Sun Jun 4 08:43:26 2017 -0400 All: Add mouse wheel support to UI list boxes --- MP/code/ui/ui_shared.c | 21 +++++++++++++++++++++ SP/code/ui/ui_shared.c | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/MP/code/ui/ui_shared.c b/MP/code/ui/ui_shared.c index dd65d0b..ca40216 100644 --- a/MP/code/ui/ui_shared.c +++ b/MP/code/ui/ui_shared.c @@ -2213,6 +2213,27 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole return qtrue; } } + + // Use mouse wheel in vertical and horizontal menus. + // If scrolling 3 items would replace over half of the + // displayed items, only scroll 1 item at a time. + if ( key == K_MWHEELUP ) { + int scroll = viewmax < 6 ? 1 : 3; + listPtr->startPos -= scroll; + if (listPtr->startPos < 0) { + listPtr->startPos = 0; + } + return qtrue; + } + if ( key == K_MWHEELDOWN ) { + int scroll = viewmax < 6 ? 1 : 3; + listPtr->startPos += scroll; + if (listPtr->startPos > max) { + listPtr->startPos = max; + } + return qtrue; + } + // mouse hit if ( key == K_MOUSE1 || key == K_MOUSE2 ) { if ( item->window.flags & WINDOW_LB_LEFTARROW ) { diff --git a/SP/code/ui/ui_shared.c b/SP/code/ui/ui_shared.c index c7f5545..5fff5c4 100644 --- a/SP/code/ui/ui_shared.c +++ b/SP/code/ui/ui_shared.c @@ -2206,6 +2206,27 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole return qtrue; } } + + // Use mouse wheel in vertical and horizontal menus. + // If scrolling 3 items would replace over half of the + // displayed items, only scroll 1 item at a time. + if ( key == K_MWHEELUP ) { + int scroll = viewmax < 6 ? 1 : 3; + listPtr->startPos -= scroll; + if (listPtr->startPos < 0) { + listPtr->startPos = 0; + } + return qtrue; + } + if ( key == K_MWHEELDOWN ) { + int scroll = viewmax < 6 ? 1 : 3; + listPtr->startPos += scroll; + if (listPtr->startPos > max) { + listPtr->startPos = max; + } + return qtrue; + } + // mouse hit if ( key == K_MOUSE1 || key == K_MOUSE2 ) { if ( item->window.flags & WINDOW_LB_LEFTARROW ) { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

