From e6302ccd70a7af896dc706c0941a559cff9300ff Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Thu, 13 Mar 2025 19:33:14 +0900 Subject: [PATCH] [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. --- base/applications/regedit/childwnd.c | 19 +++++++++++++------ base/applications/regedit/framewnd.c | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/base/applications/regedit/childwnd.c b/base/applications/regedit/childwnd.c index 1cd0dc787ed..6ba0758bbbf 100644 --- a/base/applications/regedit/childwnd.c +++ b/base/applications/regedit/childwnd.c @@ -11,7 +11,7 @@ #include ChildWnd* g_pChildWnd; -static int last_split; +static int last_split = -1; HBITMAP SizingPattern; HBRUSH SizingBrush; WCHAR Suggestions[256]; @@ -99,16 +99,20 @@ extern void ResizeWnd(int cx, int cy) const int nButtonWidth = 44; const int nButtonHeight = 22; int cyEdge = GetSystemMetrics(SM_CYEDGE); - const UINT uFlags = SWP_NOZORDER | SWP_NOACTIVATE; - SetRect(&rt, 0, 0, cx, cy); + const UINT uFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS; + cy = 0; - if (hStatusBar != NULL) + if (IsWindowVisible(hStatusBar)) { GetWindowRect(hStatusBar, &rs); cy = rs.bottom - rs.top; } + 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); cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH / 2; @@ -148,7 +152,7 @@ static void draw_splitbar(HWND hWnd, int x) { RECT rt; HGDIOBJ OldObj; - HDC hdc = GetDC(hWnd); + HDC hdc = GetDCEx(hWnd, NULL, DCX_CACHE); if(!SizingPattern) { @@ -159,7 +163,10 @@ static void draw_splitbar(HWND hWnd, int x) { 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.right = x + SPLIT_WIDTH/2+1; OldObj = SelectObject(hdc, SizingBrush); diff --git a/base/applications/regedit/framewnd.c b/base/applications/regedit/framewnd.c index e22f383d970..95f5cf9e9ec 100644 --- a/base/applications/regedit/framewnd.c +++ b/base/applications/regedit/framewnd.c @@ -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 EnableMenuItem(GetMenu(hWnd), ID_HELP_HELPTOPICS, MF_BYCOMMAND | MF_GRAYED); 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, hWnd, (HMENU)0, hInst, 0); break;