Implemented resize event detection on Windows.
This commit is contained in:
parent
b3cba4bfb1
commit
c61666b6b4
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue