Skip to content

Commit

Permalink
Fix to cursor being clipped wrong in windowed mode
Browse files Browse the repository at this point in the history
Xottab_DUTY: uncommented code in Xr_input.cpp
  • Loading branch information
ShokerStlk authored and Xottab-DUTY committed Jan 15, 2018
1 parent a9420a8 commit d48ff90
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/xrEngine/Xr_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ BOOL CInput::iGetAsyncKeyState(int dik)
BOOL CInput::iGetAsyncBtnState(int btn) { return !!mouseState[btn]; }
void CInput::ClipCursor(bool clip)
{
/*HWND hwnd = Device.m_hWnd;
HWND hwnd = Device.m_hWnd;
if (hwnd)
{
if (clip)
Expand All @@ -364,7 +364,7 @@ void CInput::ClipCursor(bool clip)
}
else
::ClipCursor(nullptr);
}*/
}
}

void CInput::MouseUpdate()
Expand Down
7 changes: 7 additions & 0 deletions src/xrEngine/x_ray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "xrCDB/ISpatial.h"
#include "xrSASH.h"
#include "xrServerEntities/smart_cast.h"
#include "xr_input.h"

//---------------------------------------------------------------------

Expand Down Expand Up @@ -155,6 +156,9 @@ void CApplication::OnEvent(EVENT E, u64 P1, u64 P2)
{
if (E == eQuit)
{
if (pInput != NULL)
pInput->ClipCursor(false);

g_SASH.EndBenchmark();

PostQuitMessage(0);
Expand Down Expand Up @@ -195,6 +199,9 @@ void CApplication::OnEvent(EVENT E, u64 P1, u64 P2)
ls_tip_number[0] = '\0';
ls_tip[0] = '\0';

if (pInput != NULL && TRUE == Engine.Event.Peek("KERNEL:quit"))
pInput->ClipCursor(false);

if (g_pGameLevel)
{
Console->Hide();
Expand Down
3 changes: 2 additions & 1 deletion src/xrGame/GamePersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void CGamePersistent::OnAppActivate()

bEntryFlag = TRUE;
if (!GEnv.isDedicatedServer)
pInput->ClipCursor(!GetUICursor().IsVisible());
pInput->ClipCursor(GetUICursor().IsVisible());
}

void CGamePersistent::OnAppDeactivate()
Expand All @@ -785,6 +785,7 @@ void CGamePersistent::OnAppDeactivate()
Device.Pause(TRUE, FALSE, TRUE, "CGP::OnAppDeactivate MP");
}
bEntryFlag = FALSE;
pInput->ClipCursor(false);
}

bool CGamePersistent::OnRenderPPUI_query()
Expand Down
5 changes: 3 additions & 2 deletions src/xrGame/UICursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ void CUICursor::OnScreenResolutionChanged()
{
xr_delete(m_static);
InitInternal();
pInput->ClipCursor(IsVisible());
}

void CUICursor::Show()
{
bVisible = true;
pInput->ClipCursor(false);
pInput->ClipCursor(true);
}

void CUICursor::Hide()
{
bVisible = false;
pInput->ClipCursor(true);
pInput->ClipCursor(false);
}

void CUICursor::InitInternal()
Expand Down

0 comments on commit d48ff90

Please sign in to comment.