mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
* Improve mouse grabbing.
This fixes a bug where the mouse would be restricted to the window after the level is loaded even if the window isn't focused.
This commit is contained in:
@@ -244,8 +244,13 @@ void AppPlatform_windows::setMouseGrabbed(bool b)
|
||||
|
||||
m_bGrabbedMouse = b;
|
||||
|
||||
if (!b)
|
||||
if (m_bActuallyGrabbedMouse == (b && m_bIsFocused))
|
||||
return;
|
||||
|
||||
if (!b || !m_bIsFocused)
|
||||
{
|
||||
m_bActuallyGrabbedMouse = false;
|
||||
|
||||
//show the cursor
|
||||
ShowCursor(TRUE);
|
||||
|
||||
@@ -256,6 +261,8 @@ void AppPlatform_windows::setMouseGrabbed(bool b)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bActuallyGrabbedMouse = true;
|
||||
|
||||
//hide the cursor
|
||||
ShowCursor(FALSE);
|
||||
|
||||
@@ -290,6 +297,12 @@ void AppPlatform_windows::clearDiff()
|
||||
m_MouseDiffX = m_MouseDiffY = 0;
|
||||
}
|
||||
|
||||
void AppPlatform_windows::updateFocused(bool focused)
|
||||
{
|
||||
m_bIsFocused = focused;
|
||||
setMouseGrabbed(m_bGrabbedMouse);
|
||||
}
|
||||
|
||||
bool AppPlatform_windows::shiftPressed()
|
||||
{
|
||||
return m_bShiftPressed;
|
||||
|
||||
Reference in New Issue
Block a user