summaryrefslogtreecommitdiff
path: root/alf/alfcompat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alfcompat.cpp')
-rw-r--r--alf/alfcompat.cpp41
1 files changed, 37 insertions, 4 deletions
diff --git a/alf/alfcompat.cpp b/alf/alfcompat.cpp
index 3895545..8672bb8 100644
--- a/alf/alfcompat.cpp
+++ b/alf/alfcompat.cpp
@@ -260,11 +260,44 @@ ALF_Compat_fallbackIsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPar
static HRESULT WINAPI
ALF_Compat_fallbackDrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
{
- (void)hwnd;
- (void)hdc;
- (void)prc;
+ HWND parent = GetParent(hwnd);
+ if (!parent)
+ return E_NOTIMPL;
+
+ RECT rc;
+ if (prc) {
+ rc = *prc;
+ } else {
+ GetClientRect(hwnd, &rc);
+ }
+ MapWindowRect(hwnd, parent, &rc);
- return E_NOTIMPL;
+ RECT childr;
+ GetClientRect(hwnd, &childr);
+ MapWindowRect(hwnd, parent, &childr);
+
+ POINT o;
+ OffsetViewportOrgEx(hdc, -childr.left, -childr.top, &o);
+
+ HRGN oldClipRgn = CreateRectRgn(0, 0, 0, 0);
+ if (!GetClipRgn(hdc, oldClipRgn)) {
+ DeleteObject(oldClipRgn);
+ oldClipRgn = NULL;
+ }
+
+ IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
+
+ SendMessage(parent, WM_ERASEBKGND, (WPARAM)hdc, 0);
+ SendMessage(parent, WM_PRINTCLIENT, (WPARAM)hdc, (LPARAM)PRF_CLIENT);
+
+ SelectClipRgn(hdc, oldClipRgn);
+ if (oldClipRgn) {
+ DeleteObject(oldClipRgn);
+ }
+
+ SetViewportOrgEx(hdc, o.x, o.y, NULL);
+
+ return S_OK;
}
static HRESULT WINAPI