summaryrefslogtreecommitdiff
path: root/redo/window_windows.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-28 15:38:47 -0400
committerPietro Gagliardi <[email protected]>2014-08-28 15:38:47 -0400
commit555b6ebcbd16a933f23f03db0d8118e6d984d5d2 (patch)
treeb1997658cc94ad56fee2399a2e7bd13535e6e953 /redo/window_windows.c
parent4d8911fe7ebc232acd11d39eb9a87758d7a188f1 (diff)
Implemented WM_PRINTCLIENT on Window and cleaned up the WM_CTLCOLOR*** message handler; both are on the Windows backend.
Diffstat (limited to 'redo/window_windows.c')
-rw-r--r--redo/window_windows.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/redo/window_windows.c b/redo/window_windows.c
index 7790bfe..2d047b0 100644
--- a/redo/window_windows.c
+++ b/redo/window_windows.c
@@ -5,6 +5,8 @@
#define windowclass L"gouiwindow"
+#define windowBackground ((HBRUSH) (COLOR_BTNFACE + 1))
+
static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
void *data;
@@ -17,6 +19,15 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult))
return lResult;
switch (uMsg) {
+ case WM_PRINTCLIENT:
+ // the return value of this message is not documented
+ // just to be safe, do this first, returning its value later
+ lResult = DefWindowProcW(hwnd, uMsg, wParam, lParam);
+ if (GetClientRect(hwnd, &r) == 0)
+ xpanic("error getting client rect for Window in WM_PRINTCLIENT", GetLastError());
+ if (FillRect((HDC) wParam, &r, windowBackground) == 0)
+ xpanic("error filling WM_PRINTCLIENT DC with window background color", GetLastError());
+ return lResult;
case WM_SIZE:
if (GetClientRect(hwnd, &r) == 0)
xpanic("error getting client rect for Window in WM_SIZE", GetLastError());
@@ -41,7 +52,7 @@ DWORD makeWindowWindowClass(char **errmsg)
wc.hInstance = hInstance;
wc.hIcon = hDefaultIcon;
wc.hCursor = hArrowCursor;
- wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+ wc.hbrBackground = windowBackground;
wc.lpszClassName = windowclass;
if (RegisterClassW(&wc) == 0) {
*errmsg = "error registering Window window class";