Fix SetCapture() to use child_window instead of window. As using window was causing spurious WM_MOUSELEAVE events. Also change other mouse events to return IntPtr.Zero when handled

This commit is contained in:
David Jeske 2017-06-11 19:09:50 -07:00
parent d5b43fb33c
commit 3bbd31d66b

View file

@ -755,35 +755,35 @@ namespace OpenTK.Platform.Windows
case WindowMessage.LBUTTONDOWN: case WindowMessage.LBUTTONDOWN:
HandleLButtonDown(handle, message, wParam, lParam); HandleLButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.MBUTTONDOWN: case WindowMessage.MBUTTONDOWN:
HandleMButtonDown(handle, message, wParam, lParam); HandleMButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.RBUTTONDOWN: case WindowMessage.RBUTTONDOWN:
HandleRButtonDown(handle, message, wParam, lParam); HandleRButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.XBUTTONDOWN: case WindowMessage.XBUTTONDOWN:
HandleXButtonDown(handle, message, wParam, lParam); HandleXButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.LBUTTONUP: case WindowMessage.LBUTTONUP:
HandleLButtonUp(handle, message, wParam, lParam); HandleLButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.MBUTTONUP: case WindowMessage.MBUTTONUP:
HandleMButtonUp(handle, message, wParam, lParam); HandleMButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.RBUTTONUP: case WindowMessage.RBUTTONUP:
HandleRButtonUp(handle, message, wParam, lParam); HandleRButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.XBUTTONUP: case WindowMessage.XBUTTONUP:
HandleXButtonUp(handle, message, wParam, lParam); HandleXButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
// Keyboard events: // Keyboard events:
case WindowMessage.KEYDOWN: case WindowMessage.KEYDOWN:
@ -833,7 +833,7 @@ namespace OpenTK.Platform.Windows
{ {
if (mouse_capture_count == 0) if (mouse_capture_count == 0)
{ {
Functions.SetCapture(window.Handle); Functions.SetCapture(child_window.Handle);
} }
mouse_capture_count++; mouse_capture_count++;
} }