diff options
| -rw-r--r-- | alf/alfcompat.cpp | 18 | ||||
| -rw-r--r-- | alf/alfcompat.h | 1 | ||||
| -rw-r--r-- | alf/alfnotebook.cpp | 37 |
3 files changed, 48 insertions, 8 deletions
diff --git a/alf/alfcompat.cpp b/alf/alfcompat.cpp index e3d8b15..5416d9b 100644 --- a/alf/alfcompat.cpp +++ b/alf/alfcompat.cpp @@ -411,6 +411,21 @@ ALF_Compat_fallbackGetThemeTransitionDuration(HTHEME hTheme, return E_NOTIMPL; } +static HRESULT WINAPI +ALF_Compat_fallbackGetThemePartSize(HTHEME hTheme, + HDC hdc, + int iPartId, + int iStateId, + RECT *prc, + THEMESIZE eSize, + SIZE *psz) +{ + (void)hTheme; (void)hdc; (void)iPartId; (void)iStateId; (void)prc; (void)eSize; (void)psz; + + return E_NOTIMPL; +} + + #define LOAD_FUNC(dll, name) do { \ if (_alf_dll_##dll) \ *((FARPROC*)&ALF_Compat_##name) = GetProcAddress(_alf_dll_##dll, #name); \ @@ -483,6 +498,7 @@ void ALF_LoadCompatFunctions(void) LOAD_FUNC(uxtheme, EndBufferedAnimation); LOAD_FUNC(uxtheme, BufferedPaintRenderAnimation); LOAD_FUNC(uxtheme, GetThemeTransitionDuration); + LOAD_FUNC(uxtheme, GetThemePartSize); } void ALF_UnloadCompatFunctions(void) @@ -510,6 +526,7 @@ void ALF_UnloadCompatFunctions(void) UNLOAD_FUNC(EndBufferedAnimation); UNLOAD_FUNC(BufferedPaintRenderAnimation); UNLOAD_FUNC(GetThemeTransitionDuration); + UNLOAD_FUNC(GetThemePartSize); FreeLibrary(_alf_dll_uxtheme); FreeLibrary(_alf_dll_user32); @@ -537,6 +554,7 @@ HRESULT (WINAPI *ALF_Compat_GetThemeBackgroundContentRect)(HTHEME,HDC,int,int,co HRESULT (WINAPI *ALF_Compat_GetThemeTextExtent)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,const RECT *, RECT *) = NULL; HRESULT (WINAPI *ALF_Compat_DrawThemeText)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD,const RECT *) = NULL; BOOL (WINAPI *ALF_Compat_TrackMouseEvent)(LPTRACKMOUSEEVENT tme) = NULL; +HRESULT (WINAPI *ALF_Compat_GetThemePartSize)(HTHEME,HDC,int,int,RECT *,THEMESIZE,SIZE *) = NULL; HRESULT (WINAPI *ALF_Compat_BufferedPaintInit)(void) = NULL; HRESULT (WINAPI *ALF_Compat_BufferedPaintUnInit)(void) = NULL; ALF_Compat_HANIMATIONBUFFER (WINAPI *ALF_Compat_BeginBufferedAnimation)(HWND,HDC,const RECT *,DWORD,ALF_Compat_BP_PAINTPARAMS *,ALF_Compat_BP_ANIMATIONPARAMS *,HDC *,HDC *) = NULL; diff --git a/alf/alfcompat.h b/alf/alfcompat.h index 0c542b0..fba31c3 100644 --- a/alf/alfcompat.h +++ b/alf/alfcompat.h @@ -138,6 +138,7 @@ extern HRESULT (WINAPI *ALF_Compat_DrawThemeBackground)(HTHEME, HDC, int, int, c extern HRESULT (WINAPI *ALF_Compat_GetThemeBackgroundContentRect)(HTHEME,HDC,int,int,const RECT *,RECT *); extern HRESULT (WINAPI *ALF_Compat_GetThemeTextExtent)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,const RECT *, RECT *); extern HRESULT (WINAPI *ALF_Compat_DrawThemeText)(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD,const RECT *); +extern HRESULT (WINAPI *ALF_Compat_GetThemePartSize)(HTHEME,HDC,int,int,RECT *,THEMESIZE,SIZE *); extern BOOL (WINAPI *ALF_Compat_TrackMouseEvent)(LPTRACKMOUSEEVENT tme); extern HRESULT (WINAPI *ALF_Compat_BufferedPaintInit)(void); extern HRESULT (WINAPI *ALF_Compat_BufferedPaintUnInit)(void); diff --git a/alf/alfnotebook.cpp b/alf/alfnotebook.cpp index ddc37b3..898c601 100644 --- a/alf/alfnotebook.cpp +++ b/alf/alfnotebook.cpp @@ -179,7 +179,20 @@ ALF_Notebook_InternalPaint(HWND hwnd, ALFNotebookPriv *priv, HDC dc, RECT *f) TabCtrl_AdjustRect(priv->hwndTabCtrl, FALSE, &r); MapWindowRect(priv->hwndTabCtrl, hwnd, &r); - ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r, NULL); + SIZE s; + if (SUCCEEDED(ALF_Compat_GetThemePartSize(priv->hTheme, GetDC(NULL), TABP_BODY, 0, NULL, TS_TRUE, &s))) { + // windows dialog tab panes tile the background horizontally + for (int x = r.left; x < r.right; x += s.cx) { + RECT r2 = { x, r.top, x + s.cx, r.bottom }; + if (r2.right > r.right) + r2.right = r.right; + + ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r2, NULL); + } + } else { + // old version - let uxtheme stretch it + ALF_Compat_DrawThemeBackground(priv->hTheme, dc, TABP_BODY, 0, &r, NULL); + } ExcludeClipRect(dc, r.left, r.top, r.right, r.bottom); } @@ -267,20 +280,28 @@ ALF__NotebookWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (!(pos->flags & SWP_NOSIZE)) { RECT r; GetClientRect(hwnd, &r); - MoveWindow(priv->hwndTabCtrl, 0, 0, r.right - r.left, r.bottom - r.top, FALSE); - InvalidateRect(priv->hwndTabCtrl, NULL, TRUE); + int n = ALF_Notebook_InternalTabCount(hwnd, priv->hwndTabCtrl); + + HDWP hdwp = BeginDeferWindowPos(n+1); + + // SWP_COPYBITS: NT 3.51 sadness, will not invalidate bottom edge properly on resize + // even though it redraws everything else with great flicker + // the flicker problem is present in every other version of windows, too + hdwp = DeferWindowPos(hdwp, priv->hwndTabCtrl, NULL, + 0, 0, r.right-r.left, r.bottom-r.top, + SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS); - GetClientRect(priv->hwndTabCtrl, &r); TabCtrl_AdjustRect(priv->hwndTabCtrl, FALSE, &r); - MapWindowRect(priv->hwndTabCtrl, hwnd, &r); - int n = ALF_Notebook_InternalTabCount(hwnd, priv->hwndTabCtrl); for (int i = 0; i < n; ++i) { HWND p = ALF_Notebook_InternalTabPanel(hwnd, priv->hwndTabCtrl, i); - MoveWindow(p, r.left, r.top, r.right - r.left, r.bottom - r.top, FALSE); - InvalidateRect(p, NULL, TRUE); + hdwp = DeferWindowPos(hdwp, p, NULL, + r.left, r.top, r.right - r.left, r.bottom - r.top, + SWP_NOACTIVATE|SWP_NOZORDER); } + + EndDeferWindowPos(hdwp); } } else if (uMsg == ALF_NB_ADDTAB) { return (LRESULT)ALF_Notebook_InternalAddTab(hwnd, priv, (TCHAR *)lParam); |
