|
|
@ -65,6 +65,11 @@ bool SetMousePosFirstTime = true;
|
|
|
|
// mask for mouse buttons that are known to be down
|
|
|
|
// mask for mouse buttons that are known to be down
|
|
|
|
uint DownMouseButtons = 0;
|
|
|
|
uint DownMouseButtons = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef NL_OS_UNIX
|
|
|
|
|
|
|
|
// on X11, store whether the mouse was captured or not
|
|
|
|
|
|
|
|
bool MouseCapture = false;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
//////////////
|
|
|
|
// FUNCTION //
|
|
|
|
// FUNCTION //
|
|
|
|
//////////////
|
|
|
|
//////////////
|
|
|
@ -244,6 +249,13 @@ void SetMouseFreeLook ()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UpdateMouse ();
|
|
|
|
UpdateMouse ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef NL_OS_UNIX
|
|
|
|
|
|
|
|
// on X11 the mouse needs to get pulled into the middle each update, else
|
|
|
|
|
|
|
|
// the cursor would reach the border of the window / desktop
|
|
|
|
|
|
|
|
// and freelook would hang
|
|
|
|
|
|
|
|
Driver->setMousePos(0.5f, 0.5f);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//*********************************************************************************
|
|
|
|
//*********************************************************************************
|
|
|
@ -360,15 +372,17 @@ void CaptureSystemCursor()
|
|
|
|
HWND drvWnd = (HWND) Driver->getDisplay();
|
|
|
|
HWND drvWnd = (HWND) Driver->getDisplay();
|
|
|
|
if (!drvWnd) return;
|
|
|
|
if (!drvWnd) return;
|
|
|
|
SetCapture(drvWnd);
|
|
|
|
SetCapture(drvWnd);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// on X11, set driver mouse capture on and store it locally as well
|
|
|
|
|
|
|
|
Driver->setCapture(MouseCapture = true);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//*********************************************************************************
|
|
|
|
//*********************************************************************************
|
|
|
|
void ReleaseSystemCursor()
|
|
|
|
void ReleaseSystemCursor()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!IsSystemCursorCaptured()) return;
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
if (IsSystemCursorCaptured())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// if hardware mouse and not in client area, then force to update its aspect by updating its pos
|
|
|
|
// if hardware mouse and not in client area, then force to update its aspect by updating its pos
|
|
|
|
if (!IsSystemCursorInClientArea())
|
|
|
|
if (!IsSystemCursorInClientArea())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -377,7 +391,9 @@ void ReleaseSystemCursor()
|
|
|
|
ShowCursor(TRUE);
|
|
|
|
ShowCursor(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ReleaseCapture();
|
|
|
|
ReleaseCapture();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
|
|
|
|
// on X11, set driver mouse capture off and store it locally as well
|
|
|
|
|
|
|
|
Driver->setCapture(MouseCapture = false);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -388,7 +404,7 @@ bool IsSystemCursorCaptured()
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
return GetCapture() == (HWND) Driver->getDisplay();
|
|
|
|
return GetCapture() == (HWND) Driver->getDisplay();
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
return MouseCapture;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|