mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-19 11:49:09 +00:00
Merged in cwalther/cwe/window-cursor (pull request #25)
Free the cursor, update Updates to pull request #21 by Hoikas that fix the issue that quick mouse moves while walking/looking by mouse could get the cursor out of the window and break the continuous turning. From H-uru PR #221 "Window fixes".
This commit is contained in:
@ -433,34 +433,42 @@ 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 keyState=0;
|
static UInt8 mouse_down = 0;
|
||||||
|
|
||||||
// Handle messages
|
// Handle messages
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_KEYDOWN :
|
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
case WM_LBUTTONDBLCLK : // The left mouse button was double-clicked.
|
case WM_LBUTTONDBLCLK:
|
||||||
case WM_MBUTTONDBLCLK : // The middle mouse button was double-clicked.
|
case WM_MBUTTONDBLCLK:
|
||||||
case WM_MBUTTONDOWN : // The middle mouse button was pressed.
|
case WM_MBUTTONDOWN:
|
||||||
case WM_RBUTTONDBLCLK : // The right mouse button was double-clicked.
|
case WM_RBUTTONDBLCLK:
|
||||||
|
// Ensure we don't leave the client area during clicks
|
||||||
|
if (!(mouse_down++))
|
||||||
|
SetCapture(hWnd);
|
||||||
|
// fall through to old case
|
||||||
|
case WM_KEYDOWN:
|
||||||
// If they did anything but move the mouse, quit any intro movie playing.
|
// If they did anything but move the mouse, quit any intro movie playing.
|
||||||
{
|
|
||||||
if (gClient)
|
if (gClient)
|
||||||
|
{
|
||||||
gClient->SetQuitIntro(true);
|
gClient->SetQuitIntro(true);
|
||||||
}
|
|
||||||
// Fall through to other events
|
// normal input processing
|
||||||
case WM_KEYUP :
|
if (gClient->WindowActive() && gClient->GetInputManager())
|
||||||
case WM_LBUTTONUP :
|
|
||||||
case WM_RBUTTONUP :
|
|
||||||
case WM_MBUTTONUP : // The middle mouse button was released.
|
|
||||||
case 0x020A: // fuc&ing windows b.s...
|
|
||||||
{
|
|
||||||
if (gClient && gClient->WindowActive() && gClient->GetInputManager())
|
|
||||||
{
|
|
||||||
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd);
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
case WM_MBUTTONUP:
|
||||||
|
// Stop hogging the cursor
|
||||||
|
if (!(--mouse_down))
|
||||||
|
ReleaseCapture();
|
||||||
|
// fall through to input processing
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
case WM_KEYUP:
|
||||||
|
if (gClient && gClient->WindowActive() && gClient->GetInputManager())
|
||||||
|
gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
|
Reference in New Issue
Block a user