diff --git a/src/SharpEmu.GUI/App.axaml b/src/SharpEmu.GUI/App.axaml index 9adc08f9..49418077 100644 --- a/src/SharpEmu.GUI/App.axaml +++ b/src/SharpEmu.GUI/App.axaml @@ -25,6 +25,7 @@ cascade order so individual launcher views do not redefine global visuals. + diff --git a/src/SharpEmu.GUI/MainWindow.axaml b/src/SharpEmu.GUI/MainWindow.axaml index 67e6b5b9..41721d50 100644 --- a/src/SharpEmu.GUI/MainWindow.axaml +++ b/src/SharpEmu.GUI/MainWindow.axaml @@ -14,9 +14,7 @@ SPDX-License-Identifier: GPL-2.0-or-later WindowState="Maximized" WindowStartupLocation="CenterScreen" Background="{StaticResource BgBrush}" - ExtendClientAreaToDecorationsHint="True" - WindowDecorations="Full" - ExtendClientAreaTitleBarHeightHint="44" + WindowDecorations="None" Icon="avares://SharpEmu.GUI/Assets/SharpEmu.ico" KeyDown="OnKeyDown"> @@ -46,7 +44,11 @@ SPDX-License-Identifier: GPL-2.0-or-later - + @@ -55,6 +57,29 @@ SPDX-License-Identifier: GPL-2.0-or-later + + + + + @@ -662,5 +687,73 @@ SPDX-License-Identifier: GPL-2.0-or-later + + + + + + + + + + + + diff --git a/src/SharpEmu.GUI/MainWindow.axaml.cs b/src/SharpEmu.GUI/MainWindow.axaml.cs index 19503762..202c5f5b 100644 --- a/src/SharpEmu.GUI/MainWindow.axaml.cs +++ b/src/SharpEmu.GUI/MainWindow.axaml.cs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later using Avalonia; +using Avalonia.Automation; using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Input; @@ -164,6 +165,22 @@ public partial class MainWindow : Window }; TitleBar.PointerPressed += OnTitleBarPointerPressed; + TitleBar.DoubleTapped += OnTitleBarDoubleTapped; + MinimizeButton.Click += (_, _) => WindowState = WindowState.Minimized; + MaximizeButton.Click += (_, _) => ToggleMaximized(); + CloseButton.Click += (_, _) => Close(); + Opened += (_, _) => + { + // Some compositors ignore the initial maximized state while a + // frameless native window is still being created. + if (WindowState == WindowState.Normal) + { + WindowState = WindowState.Maximized; + } + + UpdateWindowChromeState(); + }; + UpdateWindowChromeState(); GameList.SelectionChanged += (_, _) => UpdateSelectedGame(); GameList.DoubleTapped += (_, _) => LaunchSelected(); SearchBox.TextChanged += (_, _) => RefreshVisibleGames(); @@ -813,12 +830,81 @@ public partial class MainWindow : Window private void OnTitleBarPointerPressed(object? sender, PointerPressedEventArgs e) { - if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) + if (e.Source is Visual source && + source.FindAncestorOfType