From 2e4ede72cfeab117f52e572adcb9071a89ce58f2 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 28 Aug 2014 13:30:29 -0400 Subject: [PATCH] Fixed Group child control transparency on Windows. --- redo/common_windows.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/redo/common_windows.c b/redo/common_windows.c index 6b6f08f..d89cb21 100644 --- a/redo/common_windows.c +++ b/redo/common_windows.c @@ -110,15 +110,20 @@ void paintControlBackground(HWND hwnd, HDC dc) RECT r; POINT p; int saved; + WCHAR classname[128] = L""; // more than enough to avoid collisions - // TODO traverse deeper if a groupbox // TODO implement WM_PRINTCLIENT in window_windows.c - parent = GetParent(hwnd); - if (parent == NULL) - xpanic("error getting parent container of control in paintControlBackground()", GetLastError()); - parent = GetParent(parent); - if (parent == NULL) - xpanic("error getting parent control of control in paintControlBackground()", GetLastError()); + parent = hwnd; + do { + parent = GetParent(parent); + if (parent == NULL) + xpanic("error getting parent container of control in paintControlBackground()", GetLastError()); + parent = GetParent(parent); + if (parent == NULL) + xpanic("error getting parent control of control in paintControlBackground()", GetLastError()); + if (GetClassNameW(parent, classname, 128) == 0) + xpanic("error getting name of focused window class in paintControlBackground()", GetLastError()); + } while (_wcsicmp(classname, L"button") == 0); // skip groupboxes if (GetWindowRect(hwnd, &r) == 0) xpanic("error getting control's window rect in paintControlBackground()", GetLastError()); // the above is a window rect; convert to client rect