mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 17:56:59 +01:00
ensure mouse cursor is only hidden when mouse is in renderer (#3448)
This commit is contained in:
parent
4c2ab880ef
commit
d86a116e1e
2 changed files with 10 additions and 16 deletions
|
@ -77,7 +77,7 @@ namespace Ryujinx.Ava
|
||||||
private IRenderer _renderer;
|
private IRenderer _renderer;
|
||||||
private readonly Thread _renderingThread;
|
private readonly Thread _renderingThread;
|
||||||
|
|
||||||
private bool _isMouseInClient;
|
private bool _isMouseInRenderer;
|
||||||
private bool _renderingStarted;
|
private bool _renderingStarted;
|
||||||
private bool _dialogShown;
|
private bool _dialogShown;
|
||||||
|
|
||||||
|
@ -142,7 +142,6 @@ namespace Ryujinx.Ava
|
||||||
|
|
||||||
ConfigurationState.Instance.HideCursorOnIdle.Event += HideCursorState_Changed;
|
ConfigurationState.Instance.HideCursorOnIdle.Event += HideCursorState_Changed;
|
||||||
|
|
||||||
_parent.PointerEnter += Parent_PointerEntered;
|
|
||||||
_parent.PointerLeave += Parent_PointerLeft;
|
_parent.PointerLeave += Parent_PointerLeft;
|
||||||
_parent.PointerMoved += Parent_PointerMoved;
|
_parent.PointerMoved += Parent_PointerMoved;
|
||||||
|
|
||||||
|
@ -157,18 +156,15 @@ namespace Ryujinx.Ava
|
||||||
private void Parent_PointerMoved(object sender, PointerEventArgs e)
|
private void Parent_PointerMoved(object sender, PointerEventArgs e)
|
||||||
{
|
{
|
||||||
_lastCursorMoveTime = Stopwatch.GetTimestamp();
|
_lastCursorMoveTime = Stopwatch.GetTimestamp();
|
||||||
|
var p = e.GetCurrentPoint(_parent).Position;
|
||||||
|
var r = _parent.InputHitTest(p);
|
||||||
|
_isMouseInRenderer = r == Renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Parent_PointerLeft(object sender, PointerEventArgs e)
|
private void Parent_PointerLeft(object sender, PointerEventArgs e)
|
||||||
{
|
{
|
||||||
Renderer.Cursor = ConfigurationState.Instance.Hid.EnableMouse ? InvisibleCursor : Cursor.Default;
|
_isMouseInRenderer = false;
|
||||||
|
_parent.Cursor = Cursor.Default;
|
||||||
_isMouseInClient = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Parent_PointerEntered(object sender, PointerEventArgs e)
|
|
||||||
{
|
|
||||||
_isMouseInClient = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetRendererWindowSize(Size size)
|
private void SetRendererWindowSize(Size size)
|
||||||
|
@ -897,15 +893,12 @@ namespace Ryujinx.Ava
|
||||||
private void HandleScreenState()
|
private void HandleScreenState()
|
||||||
{
|
{
|
||||||
if (ConfigurationState.Instance.Hid.EnableMouse)
|
if (ConfigurationState.Instance.Hid.EnableMouse)
|
||||||
{
|
|
||||||
if (_isMouseInClient)
|
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.Post(() =>
|
||||||
{
|
{
|
||||||
_parent.Cursor = InvisibleCursor;
|
_parent.Cursor = _isMouseInRenderer ? InvisibleCursor : Cursor.Default;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_hideCursorOnIdle)
|
if (_hideCursorOnIdle)
|
||||||
|
|
|
@ -376,6 +376,7 @@ namespace Ryujinx.Ava.Ui.Windows
|
||||||
ViewModel.ShowContent = true;
|
ViewModel.ShowContent = true;
|
||||||
ViewModel.ShowLoadProgress = false;
|
ViewModel.ShowLoadProgress = false;
|
||||||
ViewModel.IsLoadingIndeterminate = false;
|
ViewModel.IsLoadingIndeterminate = false;
|
||||||
|
Cursor = Cursor.Default;
|
||||||
|
|
||||||
AppHost = null;
|
AppHost = null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue