From bfcb47e2da20a3d01ae9e404ad1ffadb59e8ad80 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sat, 5 Feb 2011 19:42:53 +0000 Subject: [PATCH] Implemented proper mouse wheel event handling in the Windows debugger. [Curt Coder] --- src/osd/windows/debugwin.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index 7d3cc059483..228f023e735 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -742,7 +742,17 @@ static LRESULT CALLBACK debugwin_window_proc(HWND wnd, UINT message, WPARAM wpar // mouse wheel: forward to the first view case WM_MOUSEWHEEL: { - int delta = (INT16)HIWORD(wparam) / WHEEL_DELTA; + static int units_carryover = 0; + + UINT lines_per_click; + if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &lines_per_click, 0)) + lines_per_click = 3; + + int units = GET_WHEEL_DELTA_WPARAM(wparam) + units_carryover; + int clicks = units / WHEEL_DELTA; + units_carryover = units % WHEEL_DELTA; + + int delta = clicks * lines_per_click; int viewnum = 0; POINT point; HWND child; @@ -763,10 +773,10 @@ static LRESULT CALLBACK debugwin_window_proc(HWND wnd, UINT message, WPARAM wpar // send the appropriate message to this view's scrollbar if (info->view[viewnum].wnd && info->view[viewnum].vscroll) { - int message_type = SB_LINELEFT; + int message_type = SB_LINEUP; if (delta < 0) { - message_type = SB_LINERIGHT; + message_type = SB_LINEDOWN; delta = -delta; } while (delta > 0)