Skip to content

Commit d48ff90

Browse files
ShokerStlkXottab-DUTY
authored andcommitted
Fix to cursor being clipped wrong in windowed mode
Xottab_DUTY: uncommented code in Xr_input.cpp
1 parent a9420a8 commit d48ff90

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/xrEngine/Xr_input.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ BOOL CInput::iGetAsyncKeyState(int dik)
351351
BOOL CInput::iGetAsyncBtnState(int btn) { return !!mouseState[btn]; }
352352
void CInput::ClipCursor(bool clip)
353353
{
354-
/*HWND hwnd = Device.m_hWnd;
354+
HWND hwnd = Device.m_hWnd;
355355
if (hwnd)
356356
{
357357
if (clip)
@@ -364,7 +364,7 @@ void CInput::ClipCursor(bool clip)
364364
}
365365
else
366366
::ClipCursor(nullptr);
367-
}*/
367+
}
368368
}
369369

370370
void CInput::MouseUpdate()

src/xrEngine/x_ray.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "xrCDB/ISpatial.h"
1717
#include "xrSASH.h"
1818
#include "xrServerEntities/smart_cast.h"
19+
#include "xr_input.h"
1920

2021
//---------------------------------------------------------------------
2122

@@ -155,6 +156,9 @@ void CApplication::OnEvent(EVENT E, u64 P1, u64 P2)
155156
{
156157
if (E == eQuit)
157158
{
159+
if (pInput != NULL)
160+
pInput->ClipCursor(false);
161+
158162
g_SASH.EndBenchmark();
159163

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

202+
if (pInput != NULL && TRUE == Engine.Event.Peek("KERNEL:quit"))
203+
pInput->ClipCursor(false);
204+
198205
if (g_pGameLevel)
199206
{
200207
Console->Hide();

src/xrGame/GamePersistent.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ void CGamePersistent::OnAppActivate()
763763

764764
bEntryFlag = TRUE;
765765
if (!GEnv.isDedicatedServer)
766-
pInput->ClipCursor(!GetUICursor().IsVisible());
766+
pInput->ClipCursor(GetUICursor().IsVisible());
767767
}
768768

769769
void CGamePersistent::OnAppDeactivate()
@@ -785,6 +785,7 @@ void CGamePersistent::OnAppDeactivate()
785785
Device.Pause(TRUE, FALSE, TRUE, "CGP::OnAppDeactivate MP");
786786
}
787787
bEntryFlag = FALSE;
788+
pInput->ClipCursor(false);
788789
}
789790

790791
bool CGamePersistent::OnRenderPPUI_query()

src/xrGame/UICursor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@ void CUICursor::OnScreenResolutionChanged()
2929
{
3030
xr_delete(m_static);
3131
InitInternal();
32+
pInput->ClipCursor(IsVisible());
3233
}
3334

3435
void CUICursor::Show()
3536
{
3637
bVisible = true;
37-
pInput->ClipCursor(false);
38+
pInput->ClipCursor(true);
3839
}
3940

4041
void CUICursor::Hide()
4142
{
4243
bVisible = false;
43-
pInput->ClipCursor(true);
44+
pInput->ClipCursor(false);
4445
}
4546

4647
void CUICursor::InitInternal()

0 commit comments

Comments
 (0)