diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp index 7307e124..626b1e0f 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/plClient.cpp @@ -1546,6 +1546,7 @@ hsBool plClient::StartInit() pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio ); plMouseDevice::Instance()->SetDisplayResolution((float)fPipeline->Width(), (float)fPipeline->Height()); + plInputManager::SetRecenterMouse(false); // create the listener for the audio system: plListener* pLMod = TRACKED_NEW plListener; @@ -2207,7 +2208,6 @@ void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool else { SetWindowPos( fWindowHndl, HWND_TOP, 0, 0, Width, Height, flags ); - ::ClipCursor(nil); } WindowActivate(true); diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp index 605cc066..3178974b 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp @@ -58,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../plNetClient/plNetClientMgr.h" #include "../plNetClient/plNetLinkingMgr.h" #include "../plInputCore/plInputManager.h" +#include "../plInputCore/plInputDevice.h" #include "../plUnifiedTime/plUnifiedTime.h" #include "plPipeline.h" #include "../plResMgr/plResManager.h" @@ -453,7 +454,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_LBUTTONUP : case WM_RBUTTONUP : case WM_MBUTTONUP : // The middle mouse button was released. - case WM_MOUSEMOVE : case 0x020A: // fuc&ing windows b.s... { if (gClient && gClient->WindowActive() && gClient->GetInputManager()) @@ -463,6 +463,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } break; + case WM_MOUSEMOVE: + { + if (gClient && gClient->GetInputManager()) + gClient->GetInputManager()->HandleWin32ControlEvent(message, wParam, lParam, hWnd); + } + break; + #if 0 case WM_KILLFOCUS: SetForegroundWindow(hWnd); @@ -498,6 +505,31 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } break; + case WM_SETCURSOR: + { + static bool winCursor = true; + if (LOWORD(lParam) == HTCLIENT) + { + if (winCursor) + { + winCursor = false; + ShowCursor(FALSE); + plMouseDevice::ShowCursor(); + } + } + else + { + if (!winCursor) + { + winCursor = true; + ShowCursor(TRUE); + plMouseDevice::HideCursor(); + } + } + return TRUE; + } + break; + case WM_ACTIVATE: { bool active = (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE); @@ -509,28 +541,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) (LOWORD(wParam) == WA_CLICKACTIVE) ? "true" : "false"); if (gClient && !minimized && !gClient->GetDone()) - { - if (LOWORD(wParam) == WA_CLICKACTIVE) - { - // See if they've clicked on the frame, in which case they just want to - // move, not activate, us. - POINT pt; - GetCursorPos(&pt); - ScreenToClient(hWnd, &pt); - - RECT rect; - GetClientRect(hWnd, &rect); - - if( (pt.x < rect.left) - ||(pt.x >= rect.right) - ||(pt.y < rect.top) - ||(pt.y >= rect.bottom) ) - { - active = false; - } - } gClient->WindowActivate(active); - } else { gPendingActivate = true; diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp index 594198f9..f495c617 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp @@ -930,28 +930,3 @@ hsBool plMouseDevice::MsgReceive(plMessage* msg) return false; } - - -void plMouseDevice::HandleWindowActivate(bool bActive, HWND hWnd) -{ - if ( bActive ) - { - RECT rect; - ::GetClientRect(hWnd,&rect); - -// rect.right /= plInputManager::GetInstance()->GetMouseScale(); -// rect.bottom /= plInputManager::GetInstance()->GetMouseScale(); - - ::MapWindowPoints( hWnd, NULL, (POINT *)&rect, 2 ); - ::ClipCursor(&rect); - ::ShowCursor( FALSE ); - SetCapture(hWnd); - - } - else - { - ReleaseCapture(); - ::ClipCursor(nil); - ::ShowCursor( TRUE ); - } -} diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h index 5fedb826..27e64a5e 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h @@ -172,7 +172,6 @@ public: ~plMouseDevice(); const char* GetInputName() { return "mouse"; } - void HandleWindowActivate(bool bActive, HWND hWnd); hsBool HasControlFlag(int f) const { return fControlFlags.IsBitSet(f); } void SetControlFlag(int f) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp index a7c1bff5..a6ce26d2 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp @@ -563,10 +563,7 @@ void plDInputMgr::AddDevice(IDirectInputDevice8* device) void plDInputMgr::ConfigureDevice() { - ::ClipCursor(nil); ::ShowCursor( TRUE ); - ReleaseCapture(); - DICOLORSET dics; ZeroMemory(&dics, sizeof(DICOLORSET)); @@ -587,13 +584,7 @@ void plDInputMgr::ConfigureDevice() for (int i = 0; i < fDI->fSticks.Count(); i++) fDI->fSticks[i]->fDevice->SetActionMap( fDI->fActionFormat, NULL, DIDSAM_FORCESAVE ); - RECT rect; - ::GetClientRect(fhWnd,&rect); - ::ClientToScreen(fhWnd,(LPPOINT)&rect); - ::ClipCursor(&rect); ::ShowCursor( FALSE ); - SetCapture(fhWnd); - } hsBool plDInputMgr::MsgReceive(plMessage* msg) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp index d36fe064..d7ed9043 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp @@ -2233,7 +2233,6 @@ hsBool plDXPipeline::IResetDevice() { IClearShadowSlaves(); - ReleaseCapture(); Sleep(100); HRESULT coopLev = fD3DDevice->TestCooperativeLevel(); if( coopLev == D3DERR_DEVICELOST ) @@ -2281,8 +2280,6 @@ hsBool plDXPipeline::IResetDevice() /// all device-specific stuff needs to be recreated plDeviceRecreateMsg* clean = TRACKED_NEW plDeviceRecreateMsg(); plgDispatch::MsgSend(clean); - - SetCapture(fSettings.fHWnd); } fDevWasLost = true; fDeviceLost = false;