mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Refactor window border style creation and copying
Replaces GetNewWindowBorderStyle with direct instantiation of a new Style for Border and uses CopyStyle to transfer properties. Removes the old helper method and moves style copying logic inline for improved clarity and maintainability.
This commit is contained in:
parent
4767b444ec
commit
e3d71f94ef
1 changed files with 4 additions and 17 deletions
|
|
@ -530,7 +530,8 @@ namespace Flow.Launcher.Core.Resource
|
|||
if (windowBorderStyle == null) return;
|
||||
|
||||
// Get a new unsealed style based on the old one, and copy Resources and Triggers
|
||||
var newWindowBorderStyle = GetNewWindowBorderStyle(windowBorderStyle);
|
||||
var newWindowBorderStyle = new Style(typeof(Border));
|
||||
CopyStyle(windowBorderStyle, newWindowBorderStyle);
|
||||
|
||||
// Identify existing Margin to calculate new Margin, and copy other setters
|
||||
Setter existingMarginSetter = null;
|
||||
|
|
@ -599,7 +600,8 @@ namespace Flow.Launcher.Core.Resource
|
|||
if (windowBorderStyle == null) return;
|
||||
|
||||
// Get a new unsealed style based on the old one, and copy Resources and Triggers
|
||||
var newWindowBorderStyle = GetNewWindowBorderStyle(windowBorderStyle);
|
||||
var newWindowBorderStyle = new Style(typeof(Border));
|
||||
CopyStyle(windowBorderStyle, newWindowBorderStyle);
|
||||
|
||||
// Copy Setters, excluding the Effect setter and updating the Margin setter
|
||||
foreach (var setterBase in windowBorderStyle.Setters)
|
||||
|
|
@ -630,21 +632,6 @@ namespace Flow.Launcher.Core.Resource
|
|||
_oldResource["WindowBorderStyle"] = newWindowBorderStyle;
|
||||
}
|
||||
|
||||
private static Style GetNewWindowBorderStyle(Style windowBorderStyle)
|
||||
{
|
||||
// Create a new unsealed style based on the old one
|
||||
var newWindowBorderStyle = new Style(windowBorderStyle.TargetType, windowBorderStyle.BasedOn);
|
||||
|
||||
// Copy Resources and Triggers
|
||||
foreach (var key in windowBorderStyle.Resources.Keys)
|
||||
newWindowBorderStyle.Resources.Add(key, windowBorderStyle.Resources[key]);
|
||||
|
||||
foreach (var trigger in windowBorderStyle.Triggers)
|
||||
newWindowBorderStyle.Triggers.Add(trigger);
|
||||
|
||||
return newWindowBorderStyle;
|
||||
}
|
||||
|
||||
public void SetResizeBorderThickness(WindowChrome windowChrome, bool fixedWindowSize)
|
||||
{
|
||||
if (fixedWindowSize)
|
||||
|
|
|
|||
Loading…
Reference in a new issue