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;
Comment on lines +603 to +606

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not swallow every WM_GETOBJECT request

When Narrator, a screen reader, or another UI Automation/MSAA client queries the launcher, it relies on WM_GETOBJECT to obtain WPF's accessibility provider. Returning zero with handled = true prevents HwndSource from servicing every such request, making the query box and results—including the explicitly configured AutomationProperties.Name in MainWindow.xaml—unavailable to assistive technology. The stall mitigation must preserve normal accessibility-provider requests rather than unconditionally consuming this message.

Useful? React with 👍 / 👎.

}

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