Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Flow.Launcher.Test/MainWindowTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Reflection;
using NUnit.Framework;

namespace Flow.Launcher.Test;

public class MainWindowTest
{
[Test]
public void ShouldSuppressWindowAutomationMessage_ForWmGetObjectOnly()
{
var method = typeof(MainWindow).GetMethod("ShouldSuppressWindowAutomationMessage", BindingFlags.NonPublic | BindingFlags.Static);

Assert.That(method, Is.Not.Null);
Assert.That((bool)method.Invoke(null, [0x003D]), Is.True);
Assert.That((bool)method.Invoke(null, [0x0112]), Is.False);
}
}
9 changes: 9 additions & 0 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public partial class MainWindow : IDisposable
private readonly Lock _soundLock = new();

// Window WndProc
private const int WmGetObject = 0x003D;
private HwndSource _hwndSource;
private int _initialWidth;
private int _initialHeight;
Expand Down Expand Up @@ -595,8 +596,16 @@ private async void OnContextMenusForSettingsClick(object sender, RoutedEventArgs

#region Window WndProc

private static bool ShouldSuppressWindowAutomationMessage(int msg) => msg == WmGetObject;

private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (ShouldSuppressWindowAutomationMessage(msg))
{
handled = true;
return IntPtr.Zero;
}

switch (msg)
{
case Win32Helper.WM_ENTERSIZEMOVE:
Expand Down
Loading