diff options
| author | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-04-14 16:02:05 +0200 |
|---|---|---|
| committer | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-04-14 16:02:05 +0200 |
| commit | 0948993ec9e08e170d1d22f2c7176b00bd987103 (patch) | |
| tree | 1f707d95bfbbef467dbce2ecc0b3e9c034c9cd4c /alf/alfpanel.cpp | |
| parent | 29393896e21cab201646352cce017992cf0b2ddb (diff) | |
Make notebook bg gradient work. Anti-flicker work throughout the codebase.
Diffstat (limited to 'alf/alfpanel.cpp')
| -rw-r--r-- | alf/alfpanel.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/alf/alfpanel.cpp b/alf/alfpanel.cpp index 8583d2e..b8ef8b3 100644 --- a/alf/alfpanel.cpp +++ b/alf/alfpanel.cpp @@ -18,6 +18,13 @@ ALF_Panel_ClearPriv(ALFPanelPriv *priv) ALF_Layout_Clear(&priv->layout); } +static void +ALF_Panel_Paint(ALFPanelPriv *priv, HWND hwnd, HDC dc, RECT *r) +{ + (void)priv; + ALF_Compat_DrawThemeParentBackground(hwnd, dc, r); +} + static LRESULT WINAPI ALF__PanelWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -38,15 +45,28 @@ ALF__PanelWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam) } if (msg == WM_ERASEBKGND) { - HDC hdc = (HDC)wparam; + return TRUE; + } + if (msg == WM_PRINTCLIENT) { RECT r = { 0, 0, 0, 0 }; GetClientRect(window, &r); - ALF_Compat_DrawThemeParentBackground(window, hdc, &r); + ALF_Panel_Paint(priv, window, (HDC)wparam, &r); return TRUE; } + if (msg == WM_PAINT) { + PAINTSTRUCT ps; + HDC dc = BeginPaint(window, &ps); + + ALF_Panel_Paint(priv, window, dc, &ps.rcPaint); + + EndPaint(window, &ps); + + return 0; + } + if (ALF_ShouldMessageBubble(window, msg, wparam, lparam)) return SendMessage(GetParent(window), msg, wparam, lparam); @@ -72,12 +92,6 @@ ALF_RegisterPanelClass(void) cls.hInstance = ALF_HINSTANCE; cls.hCursor = LoadCursor(NULL, (LPTSTR)IDC_ARROW); - if (LOBYTE(LOWORD(GetVersion())) >= 4) { - cls.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1); - } else { - // NT 3.x has white dialog backgrounds - cls.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - } cls.lpszClassName = classNameBuf; cls.cbWndExtra = sizeof(void*); cls.lpfnWndProc = ALF__PanelWindowProc; |
