Browse Source

Track mouse ups/downs for releasing purposes

Adam Johnson 12 years ago
parent
commit
336f1c40ad
  1. 6
      Sources/Plasma/Apps/plClient/winmain.cpp

6
Sources/Plasma/Apps/plClient/winmain.cpp

@ -371,7 +371,7 @@ void DebugMsgF(const char* format, ...);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static bool gDragging = false; static bool gDragging = false;
static uint32_t keyState=0; static uint8_t mouse_down = 0;
// Messages we registered for manually (no const value) // Messages we registered for manually (no const value)
if (message == s_WmTaskbarList) if (message == s_WmTaskbarList)
@ -401,7 +401,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MBUTTONDBLCLK: case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_RBUTTONDBLCLK: case WM_RBUTTONDBLCLK:
// Ensure we don't leave the client area during this action // Ensure we don't leave the client area during clicks
if (!(mouse_down++))
SetCapture(hWnd); SetCapture(hWnd);
// fall through to old case // fall through to old case
case WM_KEYDOWN: case WM_KEYDOWN:
@ -420,6 +421,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_RBUTTONUP: case WM_RBUTTONUP:
case WM_MBUTTONUP: case WM_MBUTTONUP:
// Stop hogging the cursor // Stop hogging the cursor
if (!(--mouse_down))
ReleaseCapture(); ReleaseCapture();
// fall through to input processing // fall through to input processing
case WM_MOUSEWHEEL: case WM_MOUSEWHEEL:

Loading…
Cancel
Save