[PATCH 5/5] riched20: Fix-up the scrollbar visibility in the host.
Huw Davies
huw at codeweavers.com
Mon Mar 22 03:55:53 CDT 2021
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/riched20/paint.c | 24 ++----------------------
dlls/riched20/txthost.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 0b29aba4f9f..1c957e46ee2 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -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)
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 818a28b2bc5..c1f175dc9c2 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -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;
}
--
2.23.0
More information about the wine-devel
mailing list