diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index fd9ae28ba..08fa168a0 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -40,8 +40,7 @@ CInput::CInput() m_InputCounter = 1; m_InputGrabbed = 0; - m_LastRelease = 0; - m_ReleaseDelta = -1; + m_MouseDoubleClick = false; m_NumEvents = 0; m_MouseFocus = true; @@ -126,10 +125,9 @@ bool CInput::NativeMousePressed(int index) int CInput::MouseDoubleClick() { - if(m_ReleaseDelta >= 0 && m_ReleaseDelta < (time_freq() / 3)) + if(m_MouseDoubleClick) { - m_LastRelease = 0; - m_ReleaseDelta = -1; + m_MouseDoubleClick = false; return 1; } return 0; @@ -311,12 +309,6 @@ int CInput::Update() case SDL_MOUSEBUTTONUP: Action = IInput::FLAG_RELEASE; - if(Event.button.button == 1) // ignore_convention - { - m_ReleaseDelta = time_get() - m_LastRelease; - m_LastRelease = time_get(); - } - // fall through case SDL_MOUSEBUTTONDOWN: if(Event.button.button == SDL_BUTTON_LEFT) @@ -337,6 +329,8 @@ int CInput::Update() Scancode = KEY_MOUSE_8; // ignore_convention if(Event.button.button == 9) Scancode = KEY_MOUSE_9; // ignore_convention + if(Event.button.clicks % 2 == 0 && Event.button.button == SDL_BUTTON_LEFT) + m_MouseDoubleClick = true; break; case SDL_MOUSEWHEEL: diff --git a/src/engine/client/input.h b/src/engine/client/input.h index 0c4161cca..88d3fd828 100644 --- a/src/engine/client/input.h +++ b/src/engine/client/input.h @@ -19,10 +19,9 @@ class CInput : public IEngineInput int m_InputGrabbed; char *m_pClipboardText; - int64_t m_LastRelease; - int64_t m_ReleaseDelta; - bool m_MouseFocus; + bool m_MouseDoubleClick; + int m_VideoRestartNeeded; void AddEvent(char *pText, int Key, int Flags);