From 2d49baa2f12300e553e964c0f25d602d2290ab51 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 5 May 2015 00:16:25 -0400 Subject: [PATCH] Seemingly fixed redraw issues with uiContainer on Windows control background painting. Now to paint uiContainer's background itself. --- windows/container.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/windows/container.c b/windows/container.c index 9b5ff1dd..c984368f 100644 --- a/windows/container.c +++ b/windows/container.c @@ -16,7 +16,6 @@ struct container { static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc) { HWND parent; - RECT window; RECT r; int class; HDC cdc; @@ -34,19 +33,9 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc) break; } - if (GetWindowRect(hwnd, &window) == 0) + if (GetWindowRect(parent, &r) == 0) logLastError("error getting control's window rect in paintControlBackground()"); - // the above is a window rect in screen coordinates; convert to parent coordinates - r = window; - SetLastError(0); - if (MapWindowRect(NULL, parent, &r) == 0) { - le = GetLastError(); - SetLastError(le); // just to be safe - if (le != 0) - logLastError("error getting client origin of control in paintControlBackground()"); - } - // TODO check errors cdc = CreateCompatibleDC(dc); bitmap = CreateCompatibleBitmap(dc, r.right - r.left, r.bottom - r.top); @@ -59,6 +48,17 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc) DeleteDC(cdc); brush = CreatePatternBrush(bitmap); DeleteObject(bitmap); + + if (GetWindowRect(hwnd, &r) == 0) + logLastError("error getting control's window rect in paintControlBackground()"); + // the above is a window rect in screen coordinates; convert to parent coordinates + SetLastError(0); + if (MapWindowRect(NULL, parent, &r) == 0) { + le = GetLastError(); + SetLastError(le); // just to be safe + if (le != 0) + logLastError("error getting client origin of control in paintControlBackground()"); + } SetBrushOrgEx(dc, -r.left, -r.top, NULL); return brush;