Skip to content

Commit

Permalink
shiny/driver/internal/win32: translate WM_CLOSE into lifecycle.StageDead
Browse files Browse the repository at this point in the history
Fixes golang/go#14187

Change-Id: I1fcf1063c6fcca096fbf1a53d4e16038bcc726fa
Reviewed-on: https://go-review.googlesource.com/20185
Reviewed-by: Nigel Tao <nigeltao@golang.org>
  • Loading branch information
alexbrainman committed Mar 5, 2016
1 parent dd592c1 commit 671c795
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions shiny/driver/internal/win32/syscall_windows.go
Expand Up @@ -64,6 +64,7 @@ const (
_WM_SETFOCUS = 7
_WM_KILLFOCUS = 8
_WM_PAINT = 15
_WM_CLOSE = 16
_WM_WINDOWPOSCHANGED = 71
_WM_KEYDOWN = 256
_WM_KEYUP = 257
Expand Down
6 changes: 6 additions & 0 deletions shiny/driver/internal/win32/win32.go
Expand Up @@ -159,6 +159,11 @@ func sendSize(hwnd syscall.Handle) {
})
}

func sendClose(hwnd syscall.Handle, uMsg uint32, wParam, lParam uintptr) (lResult uintptr) {
LifecycleEvent(hwnd, lifecycle.StageDead)
return 0
}

func sendMouseEvent(hwnd syscall.Handle, uMsg uint32, wParam, lParam uintptr) (lResult uintptr) {
e := mouse.Event{
X: float32(_GET_X_LPARAM(lParam)),
Expand Down Expand Up @@ -295,6 +300,7 @@ var windowMsgs = map[uint32]func(hwnd syscall.Handle, uMsg uint32, wParam, lPara
_WM_PAINT: sendPaint,
msgShow: sendShow,
_WM_WINDOWPOSCHANGED: sendSizeEvent,
_WM_CLOSE: sendClose,

_WM_LBUTTONDOWN: sendMouseEvent,
_WM_LBUTTONUP: sendMouseEvent,
Expand Down

0 comments on commit 671c795

Please sign in to comment.