More TODO resolution.

This commit is contained in:
Pietro Gagliardi 2015-04-08 20:14:10 -04:00
parent 7d349d6a28
commit 47723aa8d9
4 changed files with 11 additions and 9 deletions

View File

@ -63,6 +63,9 @@ void resize(uiControl *control, HWND parent, RECT r)
TEXTMETRICW tm; TEXTMETRICW tm;
SIZE size; SIZE size;
size.cx = 0;
size.cy = 0;
ZeroMemory(&tm, sizeof (TEXTMETRICW));
dc = GetDC(parent); dc = GetDC(parent);
if (dc == NULL) if (dc == NULL)
logLastError("error getting DC in resize()"); logLastError("error getting DC in resize()");

View File

@ -18,7 +18,7 @@ struct uiControl {
void (*resize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *); void (*resize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *);
}; };
// TODO write this comment // uncomment the following line to enable memory logging; see leaks.awk
#define uiLogAllocations #define uiLogAllocations
extern void *uiAlloc(size_t, const char *); extern void *uiAlloc(size_t, const char *);

View File

@ -35,13 +35,6 @@ enum {
msgNOTIFY, msgNOTIFY,
}; };
// TODO move this to the right place
struct uiSizing {
int baseX;
int baseY;
LONG internalLeading;
};
// debug_windows.c // debug_windows.c
extern HRESULT logLastError(const char *); extern HRESULT logLastError(const char *);
extern HRESULT logHRESULT(const char *, HRESULT); extern HRESULT logHRESULT(const char *, HRESULT);
@ -58,6 +51,11 @@ extern WCHAR *toUTF16(const char *);
// container_windows.c // container_windows.c
extern BOOL sharedWndProc(HWND, UINT, WPARAM, LPARAM, LRESULT *); extern BOOL sharedWndProc(HWND, UINT, WPARAM, LPARAM, LRESULT *);
struct uiSizing {
int baseX;
int baseY;
LONG internalLeading;
};
extern void resize(uiControl *, HWND, RECT); extern void resize(uiControl *, HWND, RECT);
// comctl32_windows.c // comctl32_windows.c

View File

@ -17,7 +17,6 @@ WCHAR *toUTF16(const char *str)
return wstr; return wstr;
} }
// TODO this and resize(): initialize size and other values to avoid garbage on failure
intmax_t uiWindowsWindowTextWidth(HWND hwnd) intmax_t uiWindowsWindowTextWidth(HWND hwnd)
{ {
int len; int len;
@ -26,6 +25,8 @@ intmax_t uiWindowsWindowTextWidth(HWND hwnd)
HFONT prevfont; HFONT prevfont;
SIZE size; SIZE size;
size.cx = 0;
size.cy = 0;
// TODO check for error // TODO check for error
len = GetWindowTextLengthW(hwnd); len = GetWindowTextLengthW(hwnd);
if (len == 0) // no text; nothing to do if (len == 0) // no text; nothing to do