You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Purely a structural refactoring — the same HWND fetch, null-guard, SetWindowDisplayAffinity call, and debug-log on failure are preserved in the helper.
gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/improve-display-affinity-helper-2026-06-19-eda98cfefb8e7083.
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (105 of 105 lines)
From c34664b22b8b0c1fdafe7929ffb35a82eb5565c7 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 19 Jun 2026 01:49:48 +0000
Subject: [PATCH] refactor: extract ApplyDisplayAffinity helper to reduce
duplication
ApplyExcludeFromCapture repeated the same 7-line HWND-fetch + affinity-set
+ error-log block three times (main window, control window, each additional
monitor window). CreateMonitorWindow had a fourth copy in its Loaded lambda.
Extract a private ApplyDisplayAffinity(Window, uint) helper and use it in
all four call sites. No behaviour change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
WindowsEdgeLight/MainWindow.xaml.cs | 60 ++++++++---------------------
1 file changed, 15 insertions(+), 45 deletions(-)
diff --git a/WindowsEdgeLight/MainWindow.xaml.cs b/WindowsEdgeLight/MainWindow.xaml.cs
index c24a3c7..0181b12 100644
--- a/WindowsEdgeLight/MainWindow.xaml.cs+++ b/WindowsEdgeLight/MainWindow.xaml.cs@@ -725,50 +725,25 @@ Version {version}";
ApplyExcludeFromCapture();
}
- private void ApplyExcludeFromCapture()+ private void ApplyDisplayAffinity(Window window, uint affinity)
{
- var hwnd = new WindowInteropHelper(this).Handle;- if (hwnd != IntPtr.Zero)- {- var result = SetWindowDisplayAffinity(hwnd, settings.ExcludeFromCapture ? WDA_EXCLUDEFROMCAPTURE : WDA_NONE);- if (!result)- {- var error = Marshal.GetLastWin32Error();- System.Diagnostics.Debug.WriteLine($"Failed to set display affinity for main window. Error: {error}");- }- }-- // Apply to control window- if (controlWindow != null)- {- var controlHwnd = new WindowInteropHelper(controlWindow).Handle;- if (controlHwnd != IntPtr.Zero)- {- var result = SetWindowDisplayAffinity(controlHwnd, settin
... (truncated)
🤖 This PR was created by Repo Assist, an automated AI assistant.
Problem
ApplyExcludeFromCapturerepeated the same 7-line pattern four times:This appeared for: the main window, the control window, each additional monitor window, and again inside
CreateMonitorWindow'sLoadedlambda.Fix
Extract a private
ApplyDisplayAffinity(Window window, uint affinity)helper and use it everywhere.ApplyExcludeFromCapturenow reads cleanly:No Behaviour Change
Purely a structural refactoring — the same HWND fetch, null-guard,
SetWindowDisplayAffinitycall, and debug-log on failure are preserved in the helper.Test Status
✅
dotnet build /p:EnableWindowsTargeting=true— 0 errors, 0 warningsNote
🔒 Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter:Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
repo-assist/improve-display-affinity-helper-2026-06-19-eda98cfefb8e7083.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (105 of 105 lines)