riched20: Fix-up the scrollbar visibility in the host.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-22 08:55:53 +00:00 committed by Alexandre Julliard
parent b406377da2
commit ca47818cd0
2 changed files with 20 additions and 22 deletions

View File

@ -1057,7 +1057,6 @@ static void set_scroll_range_pos( ITextHost *host, INT bar, SCROLLINFO *info, BO
void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
{
BOOL old_vis, new_vis;
int scrollX = 0, scrollY = 0;
if (editor->horz_si.nPos != x) {
@ -1076,33 +1075,14 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
set_scroll_range_pos( editor->texthost, SB_VERT, &editor->vert_si, FALSE );
}
if (abs(scrollX) > editor->sizeWindow.cx ||
abs(scrollY) > editor->sizeWindow.cy)
if (abs(scrollX) > editor->sizeWindow.cx || abs(scrollY) > editor->sizeWindow.cy)
ITextHost_TxInvalidateRect(editor->texthost, NULL, TRUE);
else
ITextHost_TxScrollWindowEx(editor->texthost, scrollX, scrollY,
&editor->rcFormat, &editor->rcFormat,
NULL, NULL, SW_INVALIDATE);
ME_Repaint(editor);
if (editor->hWnd)
{
LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
if (editor->scrollbars & WS_HSCROLL)
{
old_vis = winStyle & WS_HSCROLL;
new_vis = editor->horz_sb_enabled || editor->scrollbars & ES_DISABLENOSCROLL;
if (!old_vis ^ !new_vis) ITextHost_TxShowScrollBar( editor->texthost, SB_HORZ, new_vis );
}
if (editor->scrollbars & WS_VSCROLL)
{
old_vis = winStyle & WS_VSCROLL;
new_vis = editor->vert_sb_enabled || editor->scrollbars & ES_DISABLENOSCROLL;
if (!old_vis ^ !new_vis) ITextHost_TxShowScrollBar( editor->texthost, SB_VERT, new_vis );
}
}
ME_UpdateScrollBar(editor);
ME_Repaint(editor);
}
void ME_HScrollAbs(ME_TextEditor *editor, int x)

View File

@ -222,6 +222,24 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollPos,16)
DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost *iface, INT bar, INT pos, BOOL redraw )
{
struct host *host = impl_from_ITextHost( iface );
DWORD style = GetWindowLongW( host->window, GWL_STYLE );
DWORD mask = (bar == SB_HORZ) ? WS_HSCROLL : WS_VSCROLL;
BOOL show = TRUE, shown = style & mask;
if (bar != SB_HORZ && bar != SB_VERT)
{
FIXME( "Unexpected bar %d\n", bar );
return FALSE;
}
/* If the application has adjusted the scrollbar's visibility it is reset */
if (!(host->scrollbars & ES_DISABLENOSCROLL))
{
if (bar == SB_HORZ) ITextServices_TxGetHScroll( host->text_srv, NULL, NULL, NULL, NULL, &show );
else ITextServices_TxGetVScroll( host->text_srv, NULL, NULL, NULL, NULL, &show );
}
if (!show ^ !shown) ShowScrollBar( host->window, bar, show );
return SetScrollPos( host->window, bar, pos, redraw ) != 0;
}