diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index 36ef2cf6..4efe1809 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfCrashHandler/plCrashCli.h" #include "plNetClient/plNetClientMgr.h" #include "plNetClient/plNetLinkingMgr.h" +#include "plInputCore/plInputDevice.h" #include "plInputCore/plInputManager.h" #include "plUnifiedTime/plUnifiedTime.h" #include "plPipeline.h" @@ -457,6 +458,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } break; + case WM_SETCURSOR: + { + static bool winCursor = true; + bool enterWnd = LOWORD(lParam) == HTCLIENT; + if (enterWnd && winCursor) + { + winCursor = !winCursor; + ShowCursor(winCursor != 0); + plMouseDevice::ShowCursor(); + } + else if (!enterWnd && !winCursor) + { + winCursor = !winCursor; + ShowCursor(winCursor != 0); + plMouseDevice::HideCursor(); + } + return TRUE; + } + break; + case WM_ACTIVATE: { bool active = (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp index fe0f4d5a..05830adc 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp @@ -750,27 +750,3 @@ bool 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 ); - ::ShowCursor( FALSE ); - SetCapture(hWnd); - - } - else - { - ReleaseCapture(); - ::ShowCursor( TRUE ); - } -} diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h index 0a3b2df6..e03943a1 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h @@ -160,7 +160,6 @@ public: ~plMouseDevice(); const char* GetInputName() { return "mouse"; } - void HandleWindowActivate(bool bActive, hsWindowHndl hWnd); bool HasControlFlag(int f) const { return fControlFlags.IsBitSet(f); } void SetControlFlag(int f) diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp index aa0a8d1c..d4593d62 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp @@ -584,8 +584,6 @@ void plDInputMgr::AddDevice(IDirectInputDevice8* device) void plDInputMgr::ConfigureDevice() { ::ShowCursor( TRUE ); - ReleaseCapture(); - DICOLORSET dics; ZeroMemory(&dics, sizeof(DICOLORSET)); @@ -607,8 +605,6 @@ void plDInputMgr::ConfigureDevice() fDI->fSticks[i]->fDevice->SetActionMap( fDI->fActionFormat, NULL, DIDSAM_FORCESAVE ); ::ShowCursor( FALSE ); - SetCapture(fhWnd); - } bool plDInputMgr::MsgReceive(plMessage* msg) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp index d0c14736..00a67839 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp @@ -2247,7 +2247,6 @@ bool plDXPipeline::IResetDevice() { IClearShadowSlaves(); - ReleaseCapture(); Sleep(100); HRESULT coopLev = fD3DDevice->TestCooperativeLevel(); if( coopLev == D3DERR_DEVICELOST ) @@ -2295,8 +2294,6 @@ bool plDXPipeline::IResetDevice() /// all device-specific stuff needs to be recreated plDeviceRecreateMsg* clean = new plDeviceRecreateMsg(); plgDispatch::MsgSend(clean); - - SetCapture(fSettings.fHWnd); } fDevWasLost = true; fDeviceLost = false;