mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 19:43:04 +00:00
Squashed backport of: 0.4.15-dev-3086-g236649c626
(#3868) and 0.4.15-dev-3147-g3bf7e3ac13
(#3953) to fix some regressions for themed scrollbars that were introduced by 0.4.14-dev-1134-g00adb1a3f9
fixes all or most parts of CORE-16735 without introducing CORE-17754 and CORE-17755
This commit is contained in:
parent
c437ff6128
commit
2671cc4d9d
3 changed files with 77 additions and 11 deletions
|
@ -576,6 +576,29 @@ dodefault:
|
||||||
return g_user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
|
return g_user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT WINAPI ThemeSetScrollInfo(HWND hWnd, int fnBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
|
{
|
||||||
|
PWND_DATA pwndData;
|
||||||
|
SCROLLINFO siout;
|
||||||
|
LPSCROLLINFO lpsiout = &siout;
|
||||||
|
BOOL IsThemed = FALSE;
|
||||||
|
|
||||||
|
pwndData = ThemeGetWndData(hWnd);
|
||||||
|
|
||||||
|
if (!pwndData)
|
||||||
|
goto dodefault;
|
||||||
|
|
||||||
|
if (pwndData->hthemeScrollbar)
|
||||||
|
IsThemed = TRUE;
|
||||||
|
|
||||||
|
memcpy(&siout, lpsi, sizeof(SCROLLINFO));
|
||||||
|
if (IsThemed)
|
||||||
|
siout.fMask |= SIF_THEMED;
|
||||||
|
|
||||||
|
dodefault:
|
||||||
|
return g_user32ApiHook.SetScrollInfo(hWnd, fnBar, lpsiout, bRedraw);
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Exports
|
* Exports
|
||||||
*/
|
*/
|
||||||
|
@ -611,6 +634,7 @@ ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
|
||||||
|
|
||||||
puah->SetWindowRgn = ThemeSetWindowRgn;
|
puah->SetWindowRgn = ThemeSetWindowRgn;
|
||||||
puah->GetScrollInfo = ThemeGetScrollInfo;
|
puah->GetScrollInfo = ThemeGetScrollInfo;
|
||||||
|
puah->SetScrollInfo = ThemeSetScrollInfo;
|
||||||
|
|
||||||
UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCPAINT);
|
UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCPAINT);
|
||||||
UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCACTIVATE);
|
UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCACTIVATE);
|
||||||
|
|
|
@ -1221,6 +1221,7 @@ extern "C" {
|
||||||
#define SIF_RANGE 1
|
#define SIF_RANGE 1
|
||||||
#define SIF_DISABLENOSCROLL 8
|
#define SIF_DISABLENOSCROLL 8
|
||||||
#define SIF_TRACKPOS 16
|
#define SIF_TRACKPOS 16
|
||||||
|
#define SIF_THEMED 128 /* REACTOS Specific Only */
|
||||||
#define SWP_DRAWFRAME 32
|
#define SWP_DRAWFRAME 32
|
||||||
#define SWP_FRAMECHANGED 32
|
#define SWP_FRAMECHANGED 32
|
||||||
#define SWP_HIDEWINDOW 128
|
#define SWP_HIDEWINDOW 128
|
||||||
|
|
|
@ -276,6 +276,7 @@ co_IntGetScrollInfo(PWND Window, INT nBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
|
lpsi->fMask &= ~SIF_THEMED; // Remove Theme bit
|
||||||
if(!SBID_IS_VALID(nBar))
|
if(!SBID_IS_VALID(nBar))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
@ -334,6 +335,7 @@ NEWco_IntGetScrollInfo(
|
||||||
UINT Mask;
|
UINT Mask;
|
||||||
PSBTRACK pSBTrack = pWnd->head.pti->pSBTrack;
|
PSBTRACK pSBTrack = pWnd->head.pti->pSBTrack;
|
||||||
|
|
||||||
|
lpsi->fMask &= ~SIF_THEMED; // Remove Theme bit
|
||||||
if (!SBID_IS_VALID(nBar))
|
if (!SBID_IS_VALID(nBar))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
@ -486,10 +488,13 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
UINT new_flags;
|
UINT new_flags;
|
||||||
INT action = 0;
|
INT action = 0;
|
||||||
PSBDATA pSBData;
|
PSBDATA pSBData;
|
||||||
DWORD OldPos = 0;
|
DWORD OldPos = 0, CurrentPos = 0;
|
||||||
BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't change */
|
BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't change */
|
||||||
UINT MaxPage;
|
UINT MaxPage;
|
||||||
int MaxPos;
|
int MaxPos;
|
||||||
|
/* [0] = HORZ, [1] = VERT */
|
||||||
|
static PWND PrevHwnd[2] = { 0 };
|
||||||
|
static DWORD PrevPos[2] = { 0 };
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
|
@ -511,7 +516,7 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (lpsi->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL | SIF_PREVIOUSPOS))
|
if ((lpsi->fMask & ~SIF_THEMED) & ~(SIF_ALL | SIF_DISABLENOSCROLL | SIF_PREVIOUSPOS))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -611,7 +616,7 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Show and enable scroll-bar only if no page only changed. */
|
else /* Show and enable scroll-bar only if no page only changed. */
|
||||||
if (lpsi->fMask != SIF_PAGE)
|
if ((lpsi->fMask & ~SIF_THEMED) != SIF_PAGE)
|
||||||
{
|
{
|
||||||
if ((nBar != SB_CTL) && bChangeParams)
|
if ((nBar != SB_CTL) && bChangeParams)
|
||||||
{
|
{
|
||||||
|
@ -643,19 +648,55 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; /* SetWindowPos() already did the painting */
|
return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; /* SetWindowPos() already did the painting */
|
||||||
if (bRedraw)
|
if (bRedraw)
|
||||||
{
|
{
|
||||||
if (action & SA_SSI_REPAINT_ARROWS)
|
if (!(lpsi->fMask & SIF_THEMED)) /* Not Using Themes */
|
||||||
{ // Redraw the entire bar.
|
{
|
||||||
|
TRACE("Not using themes.\n");
|
||||||
|
if (action & SA_SSI_REPAINT_ARROWS)
|
||||||
|
{
|
||||||
|
// Redraw the entire bar.
|
||||||
|
RECTL UpdateRect = psbi->rcScrollBar;
|
||||||
|
UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
|
||||||
|
UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
|
||||||
|
UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
|
||||||
|
UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
|
||||||
|
co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Redraw only the interior part of the bar.
|
||||||
|
IntRefeshScrollInterior(Window, nBar, psbi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* Using Themes */
|
||||||
|
{
|
||||||
RECTL UpdateRect = psbi->rcScrollBar;
|
RECTL UpdateRect = psbi->rcScrollBar;
|
||||||
|
TRACE("Using themes.\n");
|
||||||
UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
|
UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
|
||||||
UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
|
UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
|
||||||
UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
|
UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
|
||||||
UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
|
UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
|
||||||
co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME);
|
/* Just paint the interior and not the arrows. */
|
||||||
}
|
if (!(action & SA_SSI_REPAINT_ARROWS))
|
||||||
else
|
{
|
||||||
{
|
if (nBar == SB_HORZ)
|
||||||
// Redraw only the interior part of the bar.
|
{
|
||||||
IntRefeshScrollInterior(Window, nBar, psbi);
|
UpdateRect.left += psbi->dxyLineButton;
|
||||||
|
UpdateRect.right -= psbi->dxyLineButton;
|
||||||
|
}
|
||||||
|
if (nBar == SB_VERT)
|
||||||
|
{
|
||||||
|
UpdateRect.top += psbi->dxyLineButton;
|
||||||
|
UpdateRect.bottom -= psbi->dxyLineButton;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CurrentPos = lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos;
|
||||||
|
/* Check for changes to Window or CurrentPos */
|
||||||
|
if ((Window != PrevHwnd[nBar]) || (CurrentPos != PrevPos[nBar]))
|
||||||
|
{
|
||||||
|
co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME);
|
||||||
|
PrevHwnd[nBar] = Window;
|
||||||
|
PrevPos[nBar] = CurrentPos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // FIXME: Arrows
|
} // FIXME: Arrows
|
||||||
/* else if( action & SA_SSI_REPAINT_ARROWS )
|
/* else if( action & SA_SSI_REPAINT_ARROWS )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue