Skip to content

Commit

Permalink
Merge pull request #247 from YJammak/main
Browse files Browse the repository at this point in the history
Double click the SukiWindow titleBar to switch to maximize
  • Loading branch information
kikipoulet authored Jul 9, 2024
2 parents 2b8bc01 + 713ca49 commit 5372a5b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions SukiUI/Controls/SukiWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,7 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
// Create handlers for buttons
if (e.NameScope.Get<Button>("PART_MaximizeButton") is { } maximize)
{
maximize.Click += (_, _) =>
{
if (!CanResize) return;
WindowState = WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
};
maximize.Click += OnMaximizeButtonClicked;
bool pointerOnMaxButton = false;
var setter = typeof(Button).GetProperty("IsPointerOver");

Expand Down Expand Up @@ -262,13 +256,23 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
close.Click += (_, _) => Close();

if (e.NameScope.Get<GlassCard>("PART_TitleBarBackground") is { } titleBar)
{
titleBar.PointerPressed += OnTitleBarPointerPressed;
titleBar.DoubleTapped += OnMaximizeButtonClicked;
}
}
catch
{
}
}

private void OnMaximizeButtonClicked(object? sender, RoutedEventArgs args)
{
if (!CanResize) return;
WindowState = WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}

private void OnWindowStateChanged(WindowState state)
{
Expand Down

0 comments on commit 5372a5b

Please sign in to comment.