From 47837edb011e6c2dafb2c05f1279dd19255f2bb3 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 17 Apr 2026 15:03:50 +0200 Subject: [PATCH] fix: apply display matching on fullscreen enter --- lib/screens/video_player_screen.dart | 15 +++++++++++---- lib/services/display_mode_service.dart | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/screens/video_player_screen.dart b/lib/screens/video_player_screen.dart index 7dd8ea9c..132b761b 100644 --- a/lib/screens/video_player_screen.dart +++ b/lib/screens/video_player_screen.dart @@ -929,11 +929,18 @@ class VideoPlayerScreenState extends State with WidgetsBindin } } - /// Called when fullscreen state changes — restore display mode if exiting fullscreen. + /// Called when fullscreen state changes — apply or restore Windows display + /// matching. On Windows the player opens windowed by default, so the initial + /// attempt during `playbackRestart` is skipped by DisplayModeService's + /// fullscreen gate. Catching the enter-fullscreen transition here lets the + /// switch happen at the natural moment the user starts watching. void _onFullscreenChanged() { - if (!FullscreenStateManager().isFullscreen && - _displayModeService != null && - _displayModeService!.anyChangeApplied) { + if (_displayModeService == null) return; + if (FullscreenStateManager().isFullscreen) { + if (_hasFirstFrame.value && !_displayModeService!.anyChangeApplied) { + _applyWindowsDisplayMatching(); + } + } else if (_displayModeService!.anyChangeApplied) { _restoreWindowsDisplayMode(); } } diff --git a/lib/services/display_mode_service.dart b/lib/services/display_mode_service.dart index 8d1ef03d..00cfba85 100644 --- a/lib/services/display_mode_service.dart +++ b/lib/services/display_mode_service.dart @@ -29,7 +29,10 @@ class DisplayModeService { required double? sigPeak, }) async { if (!Platform.isWindows) return Duration.zero; - if (!_fullscreen.isFullscreen) return Duration.zero; + if (!_fullscreen.isFullscreen) { + appLogger.d('Display matching skipped: not in fullscreen'); + return Duration.zero; + } bool anyChange = false;