From c61666b6b4528e7a691fc3c20f2cf681d188bec7 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 15 Jul 2014 12:09:46 -0400 Subject: [PATCH] Implemented resize event detection on Windows. --- redo/funcnames_windows.go | 1 + redo/window_windows.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/redo/funcnames_windows.go b/redo/funcnames_windows.go index 9724b9a..1309881 100644 --- a/redo/funcnames_windows.go +++ b/redo/funcnames_windows.go @@ -27,3 +27,4 @@ package ui // wfunc user32 UpdateWindow uintptr uintptr // wfunc user32 DestroyWindow uintptr uintptr // wfunc user32 PostQuitMessage uintptr void +// wfunc user32 GetClientRect uintptr *s_RECT uintptr diff --git a/redo/window_windows.go b/redo/window_windows.go index f2e8951..f09ba3b 100644 --- a/redo/window_windows.go +++ b/redo/window_windows.go @@ -165,6 +165,15 @@ func windowWndProc(hwnd uintptr, msg t_UINT, wParam t_WPARAM, lParam t_LPARAM) t return f_DefWindowProcW(hwnd, msg, wParam, lParam) } switch msg { + case c_WM_SIZE: + var r s_RECT + + res, err := f_GetClientRect(w.hwnd, &r) + if res == 0 { + panic(fmt.Errorf("error getting client rect for Window in WM_SIZE: %v", err)) + } + fmt.Printf("new size %d x %d\n", r.right - r.left, r.bottom - r.top) + return 0 case c_WM_CLOSE: close := w.closing.fire() if close {