Commit fb63cd0c authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

winhlp32: Use EM_SCROLL to scroll richedit control.

Previously the richedit control contents were scrolled directly using ScrollWindow. This caused the richedit control to not actually scroll, but only look like it scrolled, therefore causing plenty of glitches.
parent b9cac153
......@@ -1263,8 +1263,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
{
WINHELP_WINDOW *win;
WINHELP_BUTTON *button;
RECT rect;
INT curPos, min, max, dy, keyDelta;
INT keyDelta;
HWND hTextWnd;
LRESULT ret;
......@@ -1379,42 +1378,23 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_KEYDOWN:
keyDelta = 0;
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
switch (wParam)
{
case VK_UP:
SendMessage(hTextWnd, EM_SCROLL, SB_LINEUP, 0);
return 0;
case VK_DOWN:
keyDelta = GetSystemMetrics(SM_CXVSCROLL);
if (wParam == VK_UP)
keyDelta = -keyDelta;
SendMessage(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0);
return 0;
case VK_PRIOR:
SendMessage(hTextWnd, EM_SCROLL, SB_PAGEUP, 0);
return 0;
case VK_NEXT:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
curPos = GetScrollPos(hTextWnd, SB_VERT);
GetScrollRange(hTextWnd, SB_VERT, &min, &max);
if (keyDelta == 0)
{
GetClientRect(hTextWnd, &rect);
keyDelta = (rect.bottom - rect.top) / 2;
if (wParam == VK_PRIOR)
keyDelta = -keyDelta;
}
curPos += keyDelta;
if (curPos > max)
curPos = max;
else if (curPos < min)
curPos = min;
dy = GetScrollPos(hTextWnd, SB_VERT) - curPos;
SetScrollPos(hTextWnd, SB_VERT, curPos, TRUE);
ScrollWindow(hTextWnd, 0, dy, NULL, NULL);
UpdateWindow(hTextWnd);
SendMessage(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0);
return 0;
case VK_ESCAPE:
MACRO_Exit();
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment