Fix double clicks

This commit is contained in:
Magnus Norddahl 2024-01-02 17:52:54 +01:00 committed by Christoph Oelckers
parent f5c4964902
commit 532bef8243

View file

@ -64,7 +64,7 @@ Win32Window::Win32Window(DisplayWindowHost* windowHost) : WindowHost(windowHost)
WNDCLASSEX classdesc = {}; WNDCLASSEX classdesc = {};
classdesc.cbSize = sizeof(WNDCLASSEX); classdesc.cbSize = sizeof(WNDCLASSEX);
classdesc.hInstance = GetModuleHandle(0); classdesc.hInstance = GetModuleHandle(0);
classdesc.style = CS_VREDRAW | CS_HREDRAW; classdesc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
classdesc.lpszClassName = L"ZWidgetWindow"; classdesc.lpszClassName = L"ZWidgetWindow";
classdesc.lpfnWndProc = &Win32Window::WndProc; classdesc.lpfnWndProc = &Win32Window::WndProc;
RegisterClassEx(&classdesc); RegisterClassEx(&classdesc);
@ -420,6 +420,10 @@ LRESULT Win32Window::OnWindowMessage(UINT msg, WPARAM wparam, LPARAM lparam)
{ {
WindowHost->OnWindowMouseDown(GetLParamPos(lparam), IK_LeftMouse); WindowHost->OnWindowMouseDown(GetLParamPos(lparam), IK_LeftMouse);
} }
else if (msg == WM_LBUTTONDBLCLK)
{
WindowHost->OnWindowMouseDoubleclick(GetLParamPos(lparam), IK_LeftMouse);
}
else if (msg == WM_LBUTTONUP) else if (msg == WM_LBUTTONUP)
{ {
WindowHost->OnWindowMouseUp(GetLParamPos(lparam), IK_LeftMouse); WindowHost->OnWindowMouseUp(GetLParamPos(lparam), IK_LeftMouse);
@ -428,6 +432,10 @@ LRESULT Win32Window::OnWindowMessage(UINT msg, WPARAM wparam, LPARAM lparam)
{ {
WindowHost->OnWindowMouseDown(GetLParamPos(lparam), IK_MiddleMouse); WindowHost->OnWindowMouseDown(GetLParamPos(lparam), IK_MiddleMouse);
} }
else if (msg == WM_MBUTTONDBLCLK)
{
WindowHost->OnWindowMouseDoubleclick(GetLParamPos(lparam), IK_MiddleMouse);
}
else if (msg == WM_MBUTTONUP) else if (msg == WM_MBUTTONUP)
{ {
WindowHost->OnWindowMouseUp(GetLParamPos(lparam), IK_MiddleMouse); WindowHost->OnWindowMouseUp(GetLParamPos(lparam), IK_MiddleMouse);
@ -436,6 +444,10 @@ LRESULT Win32Window::OnWindowMessage(UINT msg, WPARAM wparam, LPARAM lparam)
{ {
WindowHost->OnWindowMouseDown(GetLParamPos(lparam), IK_RightMouse); WindowHost->OnWindowMouseDown(GetLParamPos(lparam), IK_RightMouse);
} }
else if (msg == WM_RBUTTONDBLCLK)
{
WindowHost->OnWindowMouseDoubleclick(GetLParamPos(lparam), IK_RightMouse);
}
else if (msg == WM_RBUTTONUP) else if (msg == WM_RBUTTONUP)
{ {
WindowHost->OnWindowMouseUp(GetLParamPos(lparam), IK_RightMouse); WindowHost->OnWindowMouseUp(GetLParamPos(lparam), IK_RightMouse);