Fixed build errors to some extent.

This commit is contained in:
Pietro Gagliardi 2015-05-16 11:37:45 -04:00
parent d5a87a0be5
commit cf31df5c2b
4 changed files with 21 additions and 15 deletions

View File

@ -30,7 +30,7 @@ osCFLAGS = \
osLDFLAGS = \ osLDFLAGS = \
-static-libgcc \ -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 osLDWarnUndefinedFlags = -Wl,--no-undefined -Wl,--no-allow-shlib-undefined

View File

@ -56,12 +56,11 @@ static void onDestroy(void *data)
// first, hide the widget to avoid flicker // first, hide the widget to avoid flicker
ShowWindow(t->hwnd, SW_HIDE); ShowWindow(t->hwnd, SW_HIDE);
// because the pages don't have by a libui paent, we can simply destroy them // 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) { while (t->pages->len != 0) {
page = ptrArrayIndex(t->pages, struct tabPage *, 0); page = ptrArrayIndex(t->pages, struct tabPage *, 0);
// we do have to remove the page from the tab control, though // we do have to remove the page from the tab control, though
uiControlSetOSParent(page->control, NULL); uiControlSetParent(page->control, NULL);
uiControlDestroy(page->control, NULL); uiControlDestroy(page->control);
ptrArrayDelete(t->pages, 0); ptrArrayDelete(t->pages, 0);
uiFree(page); uiFree(page);
} }
@ -151,7 +150,7 @@ static void tabEnable(uiControl *c)
(*(t->baseEnable))(uiControl(t)); (*(t->baseEnable))(uiControl(t));
for (i = 0; i < t->pages->len; i++) { for (i = 0; i < t->pages->len; i++) {
page = ptrArrayIndex(t->pages, struct tabPage *, 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)); (*(t->baseDisable))(uiControl(t));
for (i = 0; i < t->pages->len; i++) { for (i = 0; i < t->pages->len; i++) {
page = ptrArrayIndex(t->pages, struct tabPage *, 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); (*(t->baseSysFunc))(uiControl(t), p);
for (i = 0; i < t->pages->len; i++) { for (i = 0; i < t->pages->len; i++) {
page = ptrArrayIndex(t->pages, struct tabPage *, 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.Func = uiWindowsSysFuncHasTabStops;
p.HasTabStops = FALSE; p.HasTabStops = FALSE;
page = ptrArrayIndex(t->pages, struct tabPage *, n); page = ptrArrayIndex(t->pages, struct tabPage *, n);
uiControlSysFunc(uiControl(page->bin), &p); uiControlSysFunc(page->control, &p);
return p.HasTabStops; return p.HasTabStops;
case WM_NCDESTROY: case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, tabSubProc, uIdSubclass) == FALSE) 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); n = SendMessageW(t->hwnd, TCM_GETITEMCOUNT, 0, 0);
page->control = child; 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 if (n != 0) // if this isn't the first page, we have to hide the other controls
uiControlHide(page->control); uiControlHide(page->control);
@ -262,6 +262,7 @@ static void tabInsertPageBefore(uiTab *tt, const char *name, uintmax_t n, uiCont
page = uiNew(struct tabPage); page = uiNew(struct tabPage);
page->control = child; page->control = child;
uiControlSetParent(page->control, uiControl(t));
// always hide; the current tab doesn't change // always hide; the current tab doesn't change
uiControlHide(page->control); uiControlHide(page->control);
@ -345,7 +346,7 @@ uiTab *uiNewTab(void)
t->hwnd = (HWND) uiControlHandle(uiControl(t)); t->hwnd = (HWND) uiControlHandle(uiControl(t));
t->pages = newPtrArray(); 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()"); logLastError("error subclassing Tab to give it its own resize handler in uiNewTab()");
uiControl(t)->PreferredSize = tabPreferredSize; uiControl(t)->PreferredSize = tabPreferredSize;

View File

@ -36,7 +36,7 @@ static LRESULT CALLBACK utilWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, L
if (SetTimer(utilWindow, resizeTimerID, resizeTimerInterval, NULL) == 0) if (SetTimer(utilWindow, resizeTimerID, resizeTimerInterval, NULL) == 0)
logLastError("error resetting resize timer in utilWindowWndProc()"); logLastError("error resetting resize timer in utilWindowWndProc()");
doResizes(); doResizes();
return TODO; return 0;
} }
return DefWindowProcW(hwnd, uMsg, wParam, lParam); return DefWindowProcW(hwnd, uMsg, wParam, lParam);
} }
@ -45,7 +45,7 @@ const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor)
{ {
WNDCLASSW wc; WNDCLASSW wc;
ZeroMemoryW(&wc, sizeof (WNDCLASSW)); ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = utilWindowClass; wc.lpszClassName = utilWindowClass;
wc.lpfnWndProc = utilWindowWndProc; wc.lpfnWndProc = utilWindowWndProc;
wc.hInstance = hInstance; wc.hInstance = hInstance;
@ -67,6 +67,8 @@ const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor)
if (SetTimer(utilWindow, resizeTimerID, resizeTimerInterval, NULL) == 0) if (SetTimer(utilWindow, resizeTimerID, resizeTimerInterval, NULL) == 0)
return "starting resize timer"; return "starting resize timer";
return NULL;
} }
void uninitUtilWindow(void) void uninitUtilWindow(void)

View File

@ -158,6 +158,7 @@ static void windowComputeChildSize(uiControl *c, intmax_t *x, intmax_t *y, intma
static int windowContainerVisible(uiControl *c) static int windowContainerVisible(uiControl *c)
{ {
complain("attempt to get container visibility state of uiWindow %p", c); complain("attempt to get container visibility state of uiWindow %p", c);
return 0; // make compiler happy
} }
static void windowShow(uiControl *c) static void windowShow(uiControl *c)
@ -169,8 +170,9 @@ static void windowShow(uiControl *c)
return; return;
} }
w->shownOnce = TRUE; w->shownOnce = TRUE;
// make sure the bin is the correct size // make sure the child is the correct size
SendMessage(w->hwnd, msgUpdateChild, 0, 0); if (w->child != NULL)
uiControlQueueResize(w->child);
ShowWindow(w->hwnd, nCmdShow); ShowWindow(w->hwnd, nCmdShow);
if (UpdateWindow(w->hwnd) == 0) if (UpdateWindow(w->hwnd) == 0)
logLastError("error calling UpdateWindow() after showing uiWindow for the first time in windowShow()"); 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); 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); complain("attempt to start Z-ordering on uiWindow %p", c);
return 0; // make compiler happy
} }
static char *windowTitle(uiWindow *ww) 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)->SetParent = windowSetParent;
uiControl(w)->PreferredSize = windowPreferredSize; uiControl(w)->PreferredSize = windowPreferredSize;
uiControl(w)->Resize = windowResize; uiControl(w)->Resize = windowResize;
uiControl(w)->QueueResize = windowQueueResize uiControl(w)->QueueResize = windowQueueResize;
uiControl(w)->GetSizing = windowGetSizing; uiControl(w)->GetSizing = windowGetSizing;
uiControl(w)->ComputeChildSize = windowComputeChildSize; uiControl(w)->ComputeChildSize = windowComputeChildSize;
uiControl(w)->ContainerVisible = windowContainerVisible; uiControl(w)->ContainerVisible = windowContainerVisible;