Implemented resize event detection on Windows.

This commit is contained in:
Pietro Gagliardi 2014-07-15 12:09:46 -04:00
parent b3cba4bfb1
commit c61666b6b4
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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 {