From 5995af00e6fa544da67b2f3c4e49adaf40bd84c2 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 13 Apr 2015 00:44:27 -0400 Subject: [PATCH] Fixed initial content area size on uiWindows. --- new/window_windows.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/new/window_windows.c b/new/window_windows.c index 0bac04b..fb92c0d 100644 --- a/new/window_windows.c +++ b/new/window_windows.c @@ -31,6 +31,8 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA case WM_WINDOWPOSCHANGED: if ((wp->flags & SWP_NOSIZE) != 0) break; + // fall through + case msgUpdateChild: if (GetClientRect(w->hwnd, &r) == 0) logLastError("error getting window client rect for resize in uiWindowWndProc()"); contenthwnd = uiParentHWND(w->content); @@ -160,7 +162,9 @@ void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *data) void uiWindowSetChild(uiWindow *w, uiControl *c) { uiParentSetChild(w->content, c); - uiParentUpdate(w->content); + // don't call uiParentUpdate(); instead, synthesize a resize + // otherwise, we'll have a 0x0 content area at first + SendMessageW(w->hwnd, msgUpdateChild, 0, 0); } int uiWindowMargined(uiWindow *w)