wineconsole: Handle mouse wheel scrolling for user backend.
The mouse wheel will scroll if the buffer height is greater than the console window's height in lines, otherwise console mouse input events are generated.
This commit is contained in:
parent
b6439286b6
commit
3fbe40e2f9
|
@ -1197,9 +1197,6 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
case WM_RBUTTONDBLCLK:
|
case WM_RBUTTONDBLCLK:
|
||||||
WCUSER_GenerateMouseInputRecord(data, WCUSER_GetCell(data, lParam), wParam, DOUBLE_CLICK);
|
WCUSER_GenerateMouseInputRecord(data, WCUSER_GetCell(data, lParam), wParam, DOUBLE_CLICK);
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEWHEEL:
|
|
||||||
WCUSER_GenerateMouseInputRecord(data, WCUSER_GetCell(data, lParam), wParam, MOUSE_WHEELED);
|
|
||||||
break;
|
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
if (data->curcfg.cursor_visible)
|
if (data->curcfg.cursor_visible)
|
||||||
{
|
{
|
||||||
|
@ -1240,19 +1237,35 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
if (data->curcfg.sb_height <= data->curcfg.win_height)
|
||||||
|
{
|
||||||
|
WCUSER_GenerateMouseInputRecord(data, WCUSER_GetCell(data, lParam), wParam, MOUSE_WHEELED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* else fallthrough */
|
||||||
case WM_VSCROLL:
|
case WM_VSCROLL:
|
||||||
{
|
{
|
||||||
int pos = data->curcfg.win_pos.Y;
|
int pos = data->curcfg.win_pos.Y;
|
||||||
|
|
||||||
switch (LOWORD(wParam))
|
if (uMsg == WM_MOUSEWHEEL)
|
||||||
{
|
{
|
||||||
case SB_PAGEUP: pos -= 8; break;
|
UINT scrollLines = 3;
|
||||||
case SB_PAGEDOWN: pos += 8; break;
|
SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0);
|
||||||
case SB_LINEUP: pos--; break;
|
scrollLines *= -GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
|
||||||
case SB_LINEDOWN: pos++; break;
|
pos += scrollLines;
|
||||||
case SB_THUMBTRACK: pos = HIWORD(wParam); break;
|
} else {
|
||||||
default: break;
|
switch (LOWORD(wParam))
|
||||||
}
|
{
|
||||||
|
case SB_PAGEUP: pos -= 8; break;
|
||||||
|
case SB_PAGEDOWN: pos += 8; break;
|
||||||
|
case SB_LINEUP: pos--; break;
|
||||||
|
case SB_LINEDOWN: pos++; break;
|
||||||
|
case SB_THUMBTRACK: pos = HIWORD(wParam); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pos < 0) pos = 0;
|
if (pos < 0) pos = 0;
|
||||||
if (pos > data->curcfg.sb_height - data->curcfg.win_height)
|
if (pos > data->curcfg.sb_height - data->curcfg.win_height)
|
||||||
pos = data->curcfg.sb_height - data->curcfg.win_height;
|
pos = data->curcfg.sb_height - data->curcfg.win_height;
|
||||||
|
@ -1268,6 +1281,7 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue