mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[0.4.7] Update Scrollbar code to state of master 2023-March-12
by porting back: 0.4.15-dev-5784-g2aea4ab945
[NTUSER] Scrollbar.c pure whitespace fixes 0.4.15-dev-5680-g5ad5737370
CORE-18050 [NTUSER] Delete temporary workarounds in co_IntSetScrollInfo() (#4985) 0.4.15-dev-5355-g0484beb04b
CORE-18593 [NTUSER] Don't redraw scrollbar if it is hidden command prompt (#4849) 0.4.15-dev-4492-g03422451b3
Add '\n' to debug logs (partially, only the scrollbar.c part) 0.4.15-dev-3875-g977c129f33
CORE-18048 [USER32] SetScrollPos should not bypass UserApiHook (#4372) 0.4.15-dev-3849-gfd28a69de6
CORE-17780 [WIN32SS] Store the scrollbar theming enabled flag in the scrollbar (#4367) 0.4.15-dev-3175-g222acf5a3e
CORE-17777 [NTUSER] Scrollbar.c, Avoid potential out-of-bounds-accesses in co_IntSetScrollInfo() 0.4.15-dev-3174-gdda9c3979e
CORE-17769 'Rapps Listview manual resize may erroneously not draw the triangles sometimes' 0.4.15-dev-3147-g3bf7e3ac13
CORE-17754 and CORE-17755 [NTUSER] Improve Themed Scrollbars by Minimizing Updates (#3953) 0.4.15-dev-3086-g236649c626
CORE-16375 [UXTHEME][NTUSER] Fix flashing of scrollbar when scrolling (#3868) 0.4.15-dev-2375-gffea5152e6
[WIN32SS][NTUSER] Fix an integer underflow within scrollbar info setting 0.4.14-dev-1134-g00adb1a3f9
[WIN32SS] Improve Drawing Scrollbars - CORE-14755 fixed, flashing scrollbar triangles (we know 131 affected apps just from rapps!) - CORE-13931 fixed, FamiTracker invisible about-dlg - CORE-14685 improves a bit, but is not entirely fixed - CORE-11561 'Notepad scrollbars problem' fixed This will also speed up NSIS installers that display their file-copy-progress by a self-scrolling listview.
This commit is contained in:
parent
e3ee3d3706
commit
88908edc19
4 changed files with 268 additions and 303 deletions
|
@ -5,7 +5,7 @@
|
|||
* PURPOSE: uxtheme user api hook functions
|
||||
* PROGRAMMER: Giannis Adamopoulos
|
||||
*/
|
||||
|
||||
|
||||
#include "uxthemep.h"
|
||||
|
||||
USERAPIHOOK g_user32ApiHook;
|
||||
|
@ -21,14 +21,14 @@ PWND_DATA ThemeGetWndData(HWND hWnd)
|
|||
pwndData = (PWND_DATA)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext));
|
||||
if(pwndData == NULL)
|
||||
{
|
||||
pwndData = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
pwndData = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(WND_DATA));
|
||||
if(pwndData == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), pwndData);
|
||||
}
|
||||
|
||||
|
@ -267,19 +267,19 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos)
|
|||
|
||||
static LRESULT CALLBACK
|
||||
ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
{
|
||||
if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
|
||||
{
|
||||
return g_user32ApiHook.DefWindowProcW(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
return g_user32ApiHook.DefWindowProcW(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam);
|
||||
}
|
||||
|
||||
return ThemeWndProc(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam,
|
||||
return ThemeWndProc(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam,
|
||||
g_user32ApiHook.DefWindowProcW);
|
||||
}
|
||||
|
||||
|
@ -288,16 +288,16 @@ ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
|
||||
{
|
||||
return g_user32ApiHook.DefWindowProcA(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
return g_user32ApiHook.DefWindowProcA(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam);
|
||||
}
|
||||
|
||||
return ThemeWndProc(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam,
|
||||
return ThemeWndProc(hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam,
|
||||
g_user32ApiHook.DefWindowProcA);
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ ThemeDlgPostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_
|
|||
|
||||
GetDiaogTextureBrush(hTheme, hwndTarget, hdc, phbrush, Msg != WM_CTLCOLORDLG);
|
||||
|
||||
#if 1
|
||||
#if 1
|
||||
{
|
||||
WCHAR controlClass[32];
|
||||
GetClassNameW (hwndTarget, controlClass, sizeof(controlClass) / sizeof(controlClass[0]));
|
||||
|
@ -538,16 +538,16 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
|
|||
if (pwndData == NULL)
|
||||
goto dodefault;
|
||||
|
||||
/*
|
||||
* Uxtheme needs to handle the tracking of the scrollbar itself
|
||||
/*
|
||||
* Uxtheme needs to handle the tracking of the scrollbar itself
|
||||
* This means than if an application needs to get the track position
|
||||
* with GetScrollInfo, it will get wrong data. So uxtheme needs to
|
||||
* hook it and set the correct tracking position itself
|
||||
*/
|
||||
ret = g_user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
|
||||
if ( lpsi &&
|
||||
if ( lpsi &&
|
||||
(lpsi->fMask & SIF_TRACKPOS) &&
|
||||
pwndData->SCROLL_TrackingWin == hwnd &&
|
||||
pwndData->SCROLL_TrackingWin == hwnd &&
|
||||
pwndData->SCROLL_TrackingBar == fnBar)
|
||||
{
|
||||
lpsi->nTrackPos = pwndData->SCROLL_TrackingVal;
|
||||
|
@ -558,11 +558,34 @@ dodefault:
|
|||
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
|
||||
*/
|
||||
|
||||
BOOL CALLBACK
|
||||
BOOL CALLBACK
|
||||
ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
|
||||
{
|
||||
if (!puah || State != uahLoadInit)
|
||||
|
@ -577,7 +600,7 @@ ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
|
|||
|
||||
/* Store the original functions from user32 */
|
||||
g_user32ApiHook = *puah;
|
||||
|
||||
|
||||
puah->DefWindowProcA = ThemeDefWindowProcA;
|
||||
puah->DefWindowProcW = ThemeDefWindowProcW;
|
||||
puah->PreWndProc = ThemePreWindowProc;
|
||||
|
@ -593,6 +616,7 @@ ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
|
|||
|
||||
puah->SetWindowRgn = ThemeSetWindowRgn;
|
||||
puah->GetScrollInfo = ThemeGetScrollInfo;
|
||||
puah->SetScrollInfo = ThemeSetScrollInfo;
|
||||
|
||||
UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCPAINT);
|
||||
UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCACTIVATE);
|
||||
|
|
|
@ -1211,6 +1211,7 @@ extern "C" {
|
|||
#define SIF_RANGE 1
|
||||
#define SIF_DISABLENOSCROLL 8
|
||||
#define SIF_TRACKPOS 16
|
||||
#define SIF_THEMED 128
|
||||
#define SWP_DRAWFRAME 32
|
||||
#define SWP_FRAMECHANGED 32
|
||||
#define SWP_HIDEWINDOW 128
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,15 +26,11 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <user32.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(scrollbar);
|
||||
|
||||
/* GLOBAL VARIABLES ***********************************************************/
|
||||
|
||||
/* Definitions for scrollbar hit testing [See SCROLLBARINFO in MSDN] */
|
||||
#define SCROLL_NOWHERE 0x00 /* Outside the scroll bar */
|
||||
#define SCROLL_TOP_ARROW 0x01 /* Top or left arrow */
|
||||
|
@ -1725,7 +1721,7 @@ SetScrollPos(HWND hWnd, INT nBar, INT nPos, BOOL bRedraw)
|
|||
ScrollInfo.fMask = SIF_POS|SIF_PREVIOUSPOS;
|
||||
ScrollInfo.nPos = nPos;
|
||||
|
||||
return RealSetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw);
|
||||
return SetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue