summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-08 20:14:10 -0400
committerPietro Gagliardi <[email protected]>2015-04-08 20:14:10 -0400
commit47723aa8d9605a09ee119dfc14fda4148413cc20 (patch)
tree85cf54671c391b5813f66dcf437dcad7761d9884
parent7d349d6a2843c6e0825403448ac28683e688f338 (diff)
More TODO resolution.
-rw-r--r--new/container_windows.c3
-rw-r--r--new/uipriv.h2
-rw-r--r--new/uipriv_windows.h12
-rw-r--r--new/util_windows.c3
4 files changed, 11 insertions, 9 deletions
diff --git a/new/container_windows.c b/new/container_windows.c
index 20d7d8d..d56830e 100644
--- a/new/container_windows.c
+++ b/new/container_windows.c
@@ -63,6 +63,9 @@ void resize(uiControl *control, HWND parent, RECT r)
TEXTMETRICW tm;
SIZE size;
+ size.cx = 0;
+ size.cy = 0;
+ ZeroMemory(&tm, sizeof (TEXTMETRICW));
dc = GetDC(parent);
if (dc == NULL)
logLastError("error getting DC in resize()");
diff --git a/new/uipriv.h b/new/uipriv.h
index a12fbdc..0521bf6 100644
--- a/new/uipriv.h
+++ b/new/uipriv.h
@@ -18,7 +18,7 @@ struct uiControl {
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
extern void *uiAlloc(size_t, const char *);
diff --git a/new/uipriv_windows.h b/new/uipriv_windows.h
index f12a6b6..bc8890a 100644
--- a/new/uipriv_windows.h
+++ b/new/uipriv_windows.h
@@ -35,13 +35,6 @@ enum {
msgNOTIFY,
};
-// TODO move this to the right place
-struct uiSizing {
- int baseX;
- int baseY;
- LONG internalLeading;
-};
-
// debug_windows.c
extern HRESULT logLastError(const char *);
extern HRESULT logHRESULT(const char *, HRESULT);
@@ -58,6 +51,11 @@ extern WCHAR *toUTF16(const char *);
// container_windows.c
extern BOOL sharedWndProc(HWND, UINT, WPARAM, LPARAM, LRESULT *);
+struct uiSizing {
+ int baseX;
+ int baseY;
+ LONG internalLeading;
+};
extern void resize(uiControl *, HWND, RECT);
// comctl32_windows.c
diff --git a/new/util_windows.c b/new/util_windows.c
index 4f883b9..5034dae 100644
--- a/new/util_windows.c
+++ b/new/util_windows.c
@@ -17,7 +17,6 @@ WCHAR *toUTF16(const char *str)
return wstr;
}
-// TODO this and resize(): initialize size and other values to avoid garbage on failure
intmax_t uiWindowsWindowTextWidth(HWND hwnd)
{
int len;
@@ -26,6 +25,8 @@ intmax_t uiWindowsWindowTextWidth(HWND hwnd)
HFONT prevfont;
SIZE size;
+ size.cx = 0;
+ size.cy = 0;
// TODO check for error
len = GetWindowTextLengthW(hwnd);
if (len == 0) // no text; nothing to do