-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply my feedback to Klaus' dark mode feature
- Move Experimental URL to DiagnosticIds - Move special dark mode logic from CreateBrushScope to GetSysColorBrush - Remove unnecessary logic in FindNearestColor - Update brushes and pens by poking SystemEvents static directly
- Loading branch information
1 parent
b238485
commit df24969
Showing
14 changed files
with
106 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/System.Windows.Forms.Primitives/src/Windows/Win32/PInvoke.SendMessageCallback.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.InteropServices; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace Windows.Win32; | ||
|
||
internal static partial class PInvoke | ||
{ | ||
internal static unsafe BOOL SendMessageCallback<T>( | ||
T hWnd, | ||
MessageId Msg, | ||
Action callback, | ||
WPARAM wParam = default, | ||
LPARAM lParam = default) | ||
where T : IHandle<HWND> | ||
{ | ||
GCHandle gcHandle = GCHandle.Alloc(callback); | ||
BOOL result = SendMessageCallback(hWnd.Handle, Msg, wParam, lParam, &NativeCallback, (nuint)(nint)gcHandle); | ||
GC.KeepAlive(hWnd.Wrapper); | ||
return result; | ||
} | ||
|
||
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])] | ||
private static void NativeCallback(HWND hwnd, uint Msg, nuint dwData, LRESULT lResult) | ||
{ | ||
GCHandle gcHandle = (GCHandle)(nint)dwData; | ||
Action action = (Action)gcHandle.Target!; | ||
gcHandle.Free(); | ||
action(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.