Fix smoke 1차 follow-up gaps: player resolver, type target, filter, utf8 (#12)
This commit is contained in:
@@ -82,6 +82,30 @@ public static class Program
|
||||
Console.Error.WriteLine($"[recorder] attach failed: {ex.Message}");
|
||||
}
|
||||
|
||||
// Issue #12 Gap C — once attached, drop events that originate from
|
||||
// any window not owned by the SUT process.
|
||||
if (app is not null)
|
||||
{
|
||||
int sutPid = app.ProcessId;
|
||||
hook.Filter = new SutProcessWindowFilter(
|
||||
sutPid,
|
||||
processFromPoint: (x, y) =>
|
||||
{
|
||||
var hwnd = NativeMethods.WindowFromPoint(new NativeMethods.POINT { x = x, y = y });
|
||||
if (hwnd == IntPtr.Zero) return 0;
|
||||
NativeMethods.GetWindowThreadProcessId(hwnd, out var pid);
|
||||
return (int)pid;
|
||||
},
|
||||
processFromForeground: () =>
|
||||
{
|
||||
var hwnd = NativeMethods.GetForegroundWindow();
|
||||
if (hwnd == IntPtr.Zero) return 0;
|
||||
NativeMethods.GetWindowThreadProcessId(hwnd, out var pid);
|
||||
return (int)pid;
|
||||
});
|
||||
Console.WriteLine($"[recorder] window filter active for pid={sutPid}");
|
||||
}
|
||||
|
||||
var scenario = new Scenario
|
||||
{
|
||||
Name = System.IO.Path.GetFileNameWithoutExtension(args.OutputPath),
|
||||
|
||||
Reference in New Issue
Block a user