Implement true fullscreen mode (hide taskbar and window chrome)

Co-authored-by: emako <24737061+emako@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-13 04:05:17 +00:00
parent 98d50c219d
commit d29ebc8384
2 changed files with 51 additions and 1 deletions

View File

@@ -64,7 +64,52 @@ public partial class ViewerWindow
internal void ToggleFullscreen()
{
WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
if (_isFullscreen)
{
// Exit fullscreen
_isFullscreen = false;
// Restore window properties
WindowState = _preFullscreenWindowState;
WindowStyle = _preFullscreenWindowStyle;
ResizeMode = _preFullscreenResizeMode;
// Restore position and size
Left = _preFullscreenBounds.Left;
Top = _preFullscreenBounds.Top;
Width = _preFullscreenBounds.Width;
Height = _preFullscreenBounds.Height;
}
else
{
// Enter fullscreen
_isFullscreen = true;
// Save current window properties
_preFullscreenWindowState = WindowState;
_preFullscreenWindowStyle = WindowStyle;
_preFullscreenResizeMode = ResizeMode;
_preFullscreenBounds = new Rect(Left, Top, Width, Height);
// Set to normal state first to get proper bounds
WindowState = WindowState.Normal;
// Hide window chrome for true fullscreen
WindowStyle = WindowStyle.None;
ResizeMode = ResizeMode.NoResize;
// Get the screen bounds where the window is currently located
var screen = System.Windows.Forms.Screen.FromHandle(new System.Windows.Interop.WindowInteropHelper(this).Handle);
// Set window to cover the entire screen
Left = screen.Bounds.Left;
Top = screen.Bounds.Top;
Width = screen.Bounds.Width;
Height = screen.Bounds.Height;
// Ensure the window is on top
WindowState = WindowState.Maximized;
}
}
private void PositionWindow(Size size)

View File

@@ -37,6 +37,11 @@ public partial class ViewerWindow : INotifyPropertyChanged
private bool _canOldPluginResize;
private bool _pinned;
private bool _isFullscreen;
private WindowState _preFullscreenWindowState;
private WindowStyle _preFullscreenWindowStyle;
private ResizeMode _preFullscreenResizeMode;
private Rect _preFullscreenBounds;
public bool Pinned
{