[REGEDIT] Reduce flickering and fix rendering (#7747)

JIRA issue: CORE-19970
- Fix status bar toggling.
- Improve behaviour of splitter.
- Add (WS_CLIPCHILDREN |
  WS_CLIPSIBLINGS) style to
  ChildWnd.
This commit is contained in:
Katayama Hirofumi MZ 2025-03-13 19:33:14 +09:00 committed by GitHub
parent 656a5dcc1f
commit e6302ccd70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 7 deletions

View file

@ -11,7 +11,7 @@
#include <shlguid.h> #include <shlguid.h>
ChildWnd* g_pChildWnd; ChildWnd* g_pChildWnd;
static int last_split; static int last_split = -1;
HBITMAP SizingPattern; HBITMAP SizingPattern;
HBRUSH SizingBrush; HBRUSH SizingBrush;
WCHAR Suggestions[256]; WCHAR Suggestions[256];
@ -99,16 +99,20 @@ extern void ResizeWnd(int cx, int cy)
const int nButtonWidth = 44; const int nButtonWidth = 44;
const int nButtonHeight = 22; const int nButtonHeight = 22;
int cyEdge = GetSystemMetrics(SM_CYEDGE); int cyEdge = GetSystemMetrics(SM_CYEDGE);
const UINT uFlags = SWP_NOZORDER | SWP_NOACTIVATE; const UINT uFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS;
SetRect(&rt, 0, 0, cx, cy);
cy = 0; cy = 0;
if (hStatusBar != NULL) if (IsWindowVisible(hStatusBar))
{ {
GetWindowRect(hStatusBar, &rs); GetWindowRect(hStatusBar, &rs);
cy = rs.bottom - rs.top; cy = rs.bottom - rs.top;
} }
GetWindowRect(g_pChildWnd->hAddressBtnWnd, &rb); GetWindowRect(g_pChildWnd->hAddressBtnWnd, &rb);
GetClientRect(g_pChildWnd->hWnd, &rt);
RedrawWindow(g_pChildWnd->hWnd, &rt, NULL, RDW_INVALIDATE | RDW_NOCHILDREN);
g_pChildWnd->nSplitPos = ClampSplitBarX(g_pChildWnd->hWnd, g_pChildWnd->nSplitPos); g_pChildWnd->nSplitPos = ClampSplitBarX(g_pChildWnd->hWnd, g_pChildWnd->nSplitPos);
cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH / 2; cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH / 2;
@ -148,7 +152,7 @@ static void draw_splitbar(HWND hWnd, int x)
{ {
RECT rt; RECT rt;
HGDIOBJ OldObj; HGDIOBJ OldObj;
HDC hdc = GetDC(hWnd); HDC hdc = GetDCEx(hWnd, NULL, DCX_CACHE);
if(!SizingPattern) if(!SizingPattern)
{ {
@ -159,7 +163,10 @@ static void draw_splitbar(HWND hWnd, int x)
{ {
SizingBrush = CreatePatternBrush(SizingPattern); SizingBrush = CreatePatternBrush(SizingPattern);
} }
GetClientRect(hWnd, &rt);
GetWindowRect(g_pChildWnd->hTreeWnd, &rt);
MapWindowPoints(NULL, hWnd, (POINT *)&rt, sizeof(rt) / sizeof(POINT));
rt.left = x - SPLIT_WIDTH/2; rt.left = x - SPLIT_WIDTH/2;
rt.right = x + SPLIT_WIDTH/2+1; rt.right = x + SPLIT_WIDTH/2+1;
OldObj = SelectObject(hdc, SizingBrush); OldObj = SelectObject(hdc, SizingBrush);

View file

@ -1446,7 +1446,8 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
// For now, the Help dialog item is disabled because of lacking of HTML Help support // For now, the Help dialog item is disabled because of lacking of HTML Help support
EnableMenuItem(GetMenu(hWnd), ID_HELP_HELPTOPICS, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(GetMenu(hWnd), ID_HELP_HELPTOPICS, MF_BYCOMMAND | MF_GRAYED);
GetClientRect(hWnd, &rc); GetClientRect(hWnd, &rc);
CreateWindowExW(0, szChildClass, NULL, WS_CHILD | WS_VISIBLE, CreateWindowExW(0, szChildClass, NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
hWnd, (HMENU)0, hInst, 0); hWnd, (HMENU)0, hInst, 0);
break; break;