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.
This commit is contained in:
Dylan Smith 2009-03-07 02:09:04 -05:00 committed by Alexandre Julliard
parent b9cac15370
commit fb63cd0c87

View file

@ -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:
case VK_DOWN:
keyDelta = GetSystemMetrics(SM_CXVSCROLL);
if (wParam == VK_UP)
keyDelta = -keyDelta;
case VK_PRIOR:
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_LINEUP, 0);
return 0;
case VK_DOWN:
SendMessage(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0);
return 0;
case VK_PRIOR:
SendMessage(hTextWnd, EM_SCROLL, SB_PAGEUP, 0);
return 0;
case VK_NEXT:
SendMessage(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0);
return 0;
case VK_ESCAPE:
MACRO_Exit();
return 0;