mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
Smoother mouse wheel scrolling
This commit is contained in:
parent
5a5287bc8b
commit
84aecbca81
11 changed files with 20 additions and 15 deletions
|
@ -20,7 +20,7 @@ typedef void (*BFWindow_MouseMove)(BFWindow* window, int x, int y);
|
|||
typedef void (*BFWindow_MouseProxyMove)(BFWindow* window, int x, int y);
|
||||
typedef void (*BFWindow_MouseDown)(BFWindow* window, int x, int y, int btn, int btnCount);
|
||||
typedef void (*BFWindow_MouseUp)(BFWindow* window, int x, int y, int btn);
|
||||
typedef void (*BFWindow_MouseWheel)(BFWindow* window, int x, int y, int delta);
|
||||
typedef void (*BFWindow_MouseWheel)(BFWindow* window, int x, int y, float delta);
|
||||
typedef void (*BFWindow_MouseLeave)(BFWindow* window);
|
||||
typedef void (*BFWindow_MenuItemSelectedFunc)(BFWindow* window, BFMenu* menu);
|
||||
|
||||
|
|
|
@ -634,11 +634,16 @@ LRESULT WinBFWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
aWindow->mIsMouseInside = true;
|
||||
cursorWindow = aWindow;
|
||||
}
|
||||
}
|
||||
}
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
UINT ucNumLines = 0;
|
||||
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &ucNumLines, 0);
|
||||
if (ucNumLines == 0)
|
||||
ucNumLines = 3; // Default
|
||||
|
||||
if ((cursorWindow != this) && (mIsMouseInside))
|
||||
{
|
||||
mMouseLeaveFunc(this);
|
||||
|
@ -648,7 +653,7 @@ LRESULT WinBFWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
POINT pt = {x, y};
|
||||
ScreenToClient(cursorWindow->mHWnd, &pt);
|
||||
|
||||
int delta = ((int16)HIWORD(wParam)) / 120;
|
||||
float delta = ((int16)HIWORD(wParam)) / 120.0f * (float)ucNumLines;
|
||||
mMouseWheelFunc(cursorWindow, pt.x, pt.y, delta);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue