From cf31df5c2bfa8e5dd03e6d8502d40070a331b37e Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 16 May 2015 11:37:45 -0400 Subject: [PATCH] Fixed build errors to some extent. --- redo/windows/GNUmakeinc.mk | 2 +- redo/windows/tab.c | 17 +++++++++-------- redo/windows/utilwin.c | 6 ++++-- redo/windows/window.c | 11 +++++++---- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/redo/windows/GNUmakeinc.mk b/redo/windows/GNUmakeinc.mk index 6d076ec2..9136323a 100644 --- a/redo/windows/GNUmakeinc.mk +++ b/redo/windows/GNUmakeinc.mk @@ -30,7 +30,7 @@ osCFLAGS = \ osLDFLAGS = \ -static-libgcc \ - -luser32 -lkernel32 -lgdi32 -luxtheme -lmsimg32 -lcomdlg32 -lole32 -loleaut32 -loleacc -luuid + -luser32 -lkernel32 -lgdi32 -lcomctl32 -luxtheme -lmsimg32 -lcomdlg32 -lole32 -loleaut32 -loleacc -luuid osLDWarnUndefinedFlags = -Wl,--no-undefined -Wl,--no-allow-shlib-undefined diff --git a/redo/windows/tab.c b/redo/windows/tab.c index 89389bec..66e932a6 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -56,12 +56,11 @@ static void onDestroy(void *data) // first, hide the widget to avoid flicker ShowWindow(t->hwnd, SW_HIDE); // because the pages don't have by a libui paent, we can simply destroy them - // we don't have to worry about the Windows tab control holding a reference to our bin; there is no reference holding anyway while (t->pages->len != 0) { page = ptrArrayIndex(t->pages, struct tabPage *, 0); // we do have to remove the page from the tab control, though - uiControlSetOSParent(page->control, NULL); - uiControlDestroy(page->control, NULL); + uiControlSetParent(page->control, NULL); + uiControlDestroy(page->control); ptrArrayDelete(t->pages, 0); uiFree(page); } @@ -151,7 +150,7 @@ static void tabEnable(uiControl *c) (*(t->baseEnable))(uiControl(t)); for (i = 0; i < t->pages->len; i++) { page = ptrArrayIndex(t->pages, struct tabPage *, i); - uiControlContainerEnable(uiControl(page->bin)); + uiControlContainerEnable(page->control); } } @@ -164,7 +163,7 @@ static void tabDisable(uiControl *c) (*(t->baseDisable))(uiControl(t)); for (i = 0; i < t->pages->len; i++) { page = ptrArrayIndex(t->pages, struct tabPage *, i); - uiControlContainerDisable(uiControl(page->bin)); + uiControlContainerDisable(page->control); } } @@ -187,7 +186,7 @@ static void tabSysFunc(uiControl *c, uiControlSysFuncParams *p) (*(t->baseSysFunc))(uiControl(t), p); for (i = 0; i < t->pages->len; i++) { page = ptrArrayIndex(t->pages, struct tabPage *, i); - uiControlSysFunc(uiControl(page->bin), p); + uiControlSysFunc(page->control, p); } } @@ -208,7 +207,7 @@ static LRESULT CALLBACK tabSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l p.Func = uiWindowsSysFuncHasTabStops; p.HasTabStops = FALSE; page = ptrArrayIndex(t->pages, struct tabPage *, n); - uiControlSysFunc(uiControl(page->bin), &p); + uiControlSysFunc(page->control, &p); return p.HasTabStops; case WM_NCDESTROY: if (RemoveWindowSubclass(hwnd, tabSubProc, uIdSubclass) == FALSE) @@ -232,6 +231,7 @@ static void tabAppendPage(uiTab *tt, const char *name, uiControl *child) n = SendMessageW(t->hwnd, TCM_GETITEMCOUNT, 0, 0); page->control = child; + uiControlSetParent(page->control, uiControl(t)); if (n != 0) // if this isn't the first page, we have to hide the other controls uiControlHide(page->control); @@ -262,6 +262,7 @@ static void tabInsertPageBefore(uiTab *tt, const char *name, uintmax_t n, uiCont page = uiNew(struct tabPage); page->control = child; + uiControlSetParent(page->control, uiControl(t)); // always hide; the current tab doesn't change uiControlHide(page->control); @@ -345,7 +346,7 @@ uiTab *uiNewTab(void) t->hwnd = (HWND) uiControlHandle(uiControl(t)); t->pages = newPtrArray(); - if ((*fv_SetWindowSubclass)(t->hwnd, tabSubProc, 0, (DWORD_PTR) t) == FALSE) + if (SetWindowSubclass(t->hwnd, tabSubProc, 0, (DWORD_PTR) t) == FALSE) logLastError("error subclassing Tab to give it its own resize handler in uiNewTab()"); uiControl(t)->PreferredSize = tabPreferredSize; diff --git a/redo/windows/utilwin.c b/redo/windows/utilwin.c index 76b90600..4ee0a795 100644 --- a/redo/windows/utilwin.c +++ b/redo/windows/utilwin.c @@ -36,7 +36,7 @@ static LRESULT CALLBACK utilWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, L if (SetTimer(utilWindow, resizeTimerID, resizeTimerInterval, NULL) == 0) logLastError("error resetting resize timer in utilWindowWndProc()"); doResizes(); - return TODO; + return 0; } return DefWindowProcW(hwnd, uMsg, wParam, lParam); } @@ -45,7 +45,7 @@ const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor) { WNDCLASSW wc; - ZeroMemoryW(&wc, sizeof (WNDCLASSW)); + ZeroMemory(&wc, sizeof (WNDCLASSW)); wc.lpszClassName = utilWindowClass; wc.lpfnWndProc = utilWindowWndProc; wc.hInstance = hInstance; @@ -67,6 +67,8 @@ const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor) if (SetTimer(utilWindow, resizeTimerID, resizeTimerInterval, NULL) == 0) return "starting resize timer"; + + return NULL; } void uninitUtilWindow(void) diff --git a/redo/windows/window.c b/redo/windows/window.c index 85cf0002..9a7cbe7f 100644 --- a/redo/windows/window.c +++ b/redo/windows/window.c @@ -158,6 +158,7 @@ static void windowComputeChildSize(uiControl *c, intmax_t *x, intmax_t *y, intma static int windowContainerVisible(uiControl *c) { complain("attempt to get container visibility state of uiWindow %p", c); + return 0; // make compiler happy } static void windowShow(uiControl *c) @@ -169,8 +170,9 @@ static void windowShow(uiControl *c) return; } w->shownOnce = TRUE; - // make sure the bin is the correct size - SendMessage(w->hwnd, msgUpdateChild, 0, 0); + // make sure the child is the correct size + if (w->child != NULL) + uiControlQueueResize(w->child); ShowWindow(w->hwnd, nCmdShow); if (UpdateWindow(w->hwnd) == 0) logLastError("error calling UpdateWindow() after showing uiWindow for the first time in windowShow()"); @@ -226,9 +228,10 @@ static void windowSysFunc(uiControl *c, uiControlSysFuncParams *p) complain("attempt to call system functions on uiWindow %p", c); } -static void windowStartZOrder(uiControl *c, uiControlSysFuncParams *p) +static int windowStartZOrder(uiControl *c, uiControlSysFuncParams *p) { complain("attempt to start Z-ordering on uiWindow %p", c); + return 0; // make compiler happy } static char *windowTitle(uiWindow *ww) @@ -358,7 +361,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar) uiControl(w)->SetParent = windowSetParent; uiControl(w)->PreferredSize = windowPreferredSize; uiControl(w)->Resize = windowResize; - uiControl(w)->QueueResize = windowQueueResize + uiControl(w)->QueueResize = windowQueueResize; uiControl(w)->GetSizing = windowGetSizing; uiControl(w)->ComputeChildSize = windowComputeChildSize; uiControl(w)->ContainerVisible = windowContainerVisible;