aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/UI/Helpers
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2023-01-15 01:05:44 +0100
committerGitHub <noreply@github.com>2023-01-15 01:05:44 +0100
commit8071c8c8c044ee56bc7578a4ba3178d2d03733db (patch)
treea4b12e0be1afe859b9a8a9dd0c4441f7a168331a /Ryujinx.Ava/UI/Helpers
parentb402b4e7f6463c42ac5afcfaee45592e75851dc3 (diff)
Ava UI: Fixes "Hide Cursor on Idle" for Windows (#4266)
* Ava: Fixes "Hide Cursor on Idle" for Windows * Add check in MouseDriver and reduce the time of idling * Fix linux error * Change idle time everywhere for consistencies
Diffstat (limited to 'Ryujinx.Ava/UI/Helpers')
-rw-r--r--Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs7
-rw-r--r--Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs16
2 files changed, 21 insertions, 2 deletions
diff --git a/Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs b/Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs
index 8247a89b..67ab80aa 100644
--- a/Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs
+++ b/Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs
@@ -34,6 +34,8 @@ namespace Ryujinx.Ava.UI.Helpers
{
WindowHandle = IntPtr.Zero;
X11Display = IntPtr.Zero;
+ NsView = IntPtr.Zero;
+ MetalLayer = IntPtr.Zero;
}
public EmbeddedWindow()
@@ -42,7 +44,7 @@ namespace Ryujinx.Ava.UI.Helpers
stateObserverable.Subscribe(StateChanged);
- this.Initialized += NativeEmbeddedWindow_Initialized;
+ Initialized += NativeEmbeddedWindow_Initialized;
}
public virtual void OnWindowCreated() { }
@@ -127,7 +129,7 @@ namespace Ryujinx.Ava.UI.Helpers
lpfnWndProc = Marshal.GetFunctionPointerForDelegate(_wndProcDelegate),
style = ClassStyles.CS_OWNDC,
lpszClassName = Marshal.StringToHGlobalUni(_className),
- hCursor = LoadCursor(IntPtr.Zero, (IntPtr)Cursors.IDC_ARROW)
+ hCursor = CreateArrowCursor()
};
var atom = RegisterClassEx(ref wndClassEx);
@@ -198,6 +200,7 @@ namespace Ryujinx.Ava.UI.Helpers
KeyModifiers.None));
break;
}
+
return DefWindowProc(hWnd, msg, wParam, lParam);
}
diff --git a/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs b/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs
index 1e6e3c3b..03d3a49f 100644
--- a/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs
+++ b/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs
@@ -70,6 +70,22 @@ namespace Ryujinx.Ava.UI.Helpers
}
}
+ public static IntPtr CreateEmptyCursor()
+ {
+ return CreateCursor(IntPtr.Zero, 0, 0, 1, 1, new byte[] { 0xFF }, new byte[] { 0x00 });
+ }
+
+ public static IntPtr CreateArrowCursor()
+ {
+ return LoadCursor(IntPtr.Zero, (IntPtr)Cursors.IDC_ARROW);
+ }
+
+ [LibraryImport("user32.dll")]
+ public static partial IntPtr SetCursor(IntPtr handle);
+
+ [LibraryImport("user32.dll")]
+ public static partial IntPtr CreateCursor(IntPtr hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte[] pvANDPlane, byte[] pvXORPlane);
+
[LibraryImport("user32.dll", SetLastError = true, EntryPoint = "RegisterClassExW")]
public static partial ushort RegisterClassEx(ref WNDCLASSEX param);