From 775e976455e1b4a5f5c642094eea2053bbf2bd9f Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 15 Nov 2021 22:04:04 +0100 Subject: [PATCH] Minor code tweaks --- .../Backend/Win32ApplicationRunner.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs index 75cd8583..680c9b3e 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs @@ -61,7 +61,7 @@ internal unsafe static class Win32ApplicationRunner { cbSize = (uint)sizeof(WNDCLASSEXW), style = CS.CS_HREDRAW | CS.CS_VREDRAW, - lpfnWndProc = (delegate* unmanaged)(delegate* unmanaged)&WindowProc, + lpfnWndProc = &WindowProc, hInstance = hInstance, hCursor = Windows.LoadCursorW(HINSTANCE.NULL, IDC.IDC_ARROW), lpszClassName = (ushort*)name @@ -173,7 +173,7 @@ internal unsafe static class Win32ApplicationRunner /// Additional message information (the contents depend on the value of ). /// The result of the message processing for the input message. [UnmanagedCallersOnly] - private static nint WindowProc(IntPtr hwnd, uint uMsg, nuint wParam, nint lParam) + private static LRESULT WindowProc(HWND hwnd, uint uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { @@ -194,12 +194,12 @@ internal unsafe static class Win32ApplicationRunner // Change the paused state when ESC is pressed case WM.WM_KEYDOWN: { - if ((ConsoleKey)wParam == ConsoleKey.Escape) + if (wParam == (byte)ConsoleKey.Escape) { if (isPaused) { - Windows.SetCapture((HWND)hwnd); + Windows.SetCapture(hwnd); } else { @@ -232,7 +232,7 @@ internal unsafe static class Win32ApplicationRunner // Size update case WM.WM_SIZE: { - if (!isResizing && wParam != Windows.SIZE_MINIMIZED) + if (!isResizing && wParam != (byte)Windows.SIZE_MINIMIZED) { application.OnResize(); } @@ -253,7 +253,7 @@ internal unsafe static class Win32ApplicationRunner RECT rect; _ = Windows.GetCursorPos(&point); - _ = Windows.GetWindowRect((HWND)hwnd, &rect); + _ = Windows.GetWindowRect(hwnd, &rect); bool isAtTop = Math.Abs(point.y - rect.top) < 12; bool isAtRight = Math.Abs(point.x - rect.right) < 12; @@ -300,7 +300,7 @@ internal unsafe static class Win32ApplicationRunner margins.cyTopHeight = -1; margins.cyBottomHeight = -1; - _ = Windows.DwmExtendFrameIntoClientArea((HWND)hwnd, &margins); + _ = Windows.DwmExtendFrameIntoClientArea(hwnd, &margins); return 0; } @@ -313,6 +313,6 @@ internal unsafe static class Win32ApplicationRunner } } - return Windows.DefWindowProcW((HWND)hwnd, uMsg, wParam, lParam); + return Windows.DefWindowProcW(hwnd, uMsg, wParam, lParam); } }