Added click counter reset on window activate/deactivate for Windows Areas.

This commit is contained in:
Pietro Gagliardi 2014-05-23 17:11:59 -04:00
parent 582e3b4644
commit b359f995f5
2 changed files with 10 additions and 0 deletions

View File

@ -644,7 +644,14 @@ func areaWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lPara
return 0
}
return defwndproc()
case _WM_ACTIVATE:
// don't keep the double-click timer running if the user switched programs in between clicks
s.clickCounter.reset()
// MSDN says this message will be sent alongside WM_MOUSEACTIVATE, but we'll reset there too, just in case
return 0
case _WM_MOUSEACTIVATE:
// don't keep the double-click timer running if the user switched programs in between clicks
s.clickCounter.reset()
// transfer keyboard focus to our Area on an activating click
// (see http://www.catch22.net/tuts/custom-controls)
r1, _, err := _setFocus.Call(uintptr(s.hwnd))

View File

@ -203,6 +203,9 @@ const (
// Window keyboard event messages and related constants.
const (
// filed under keyboard events by MSDN
_WM_ACTIVATE = 0x0006
// from winuser.h
_WM_KEYDOWN = 0x0100
_WM_KEYUP = 0x0101