mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 13:14:59 +00:00
fix: schedule DWM frame extension to next render frame on Windows 10 (#1087)
The DwmExtendFrameIntoClientArea call needs to be posted to the next render frame to ensure the window handle is fully initialized and avoid potential race conditions.
This commit is contained in:
parent
f07832c385
commit
7331167be2
1 changed files with 11 additions and 5 deletions
|
@ -8,6 +8,7 @@ using System.Text;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
|
||||||
namespace SourceGit.Native
|
namespace SourceGit.Native
|
||||||
{
|
{
|
||||||
|
@ -213,6 +214,10 @@ namespace SourceGit.Native
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixWindowFrameOnWin10(Window w)
|
private void FixWindowFrameOnWin10(Window w)
|
||||||
|
{
|
||||||
|
// Schedule the DWM frame extension to run in the next render frame
|
||||||
|
// to ensure proper timing with the window initialization sequence
|
||||||
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
var platformHandle = w.TryGetPlatformHandle();
|
var platformHandle = w.TryGetPlatformHandle();
|
||||||
if (platformHandle == null)
|
if (platformHandle == null)
|
||||||
|
@ -220,6 +225,7 @@ namespace SourceGit.Native
|
||||||
|
|
||||||
var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
|
var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
|
||||||
DwmExtendFrameIntoClientArea(platformHandle.Handle, ref margins);
|
DwmExtendFrameIntoClientArea(platformHandle.Handle, ref margins);
|
||||||
|
}, DispatcherPriority.Render);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region EXTERNAL_EDITOR_FINDER
|
#region EXTERNAL_EDITOR_FINDER
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue