fix(player): keep app-owned fullscreen when Escape leaves the player (#1791)
Physical Escape inside the player resolved to exitFullscreenIfActive on Windows and Linux whenever HTPC-style player navigation was off, so it dropped the window out of fullscreen regardless of who put it there. For anyone running with "start in fullscreen" (or who had toggled fullscreen from the browse UI), backing out of a movie left the app windowed, with "exit fullscreen on player close" switched off. Track fullscreen ownership instead: FullscreenStateManager now exposes a scope that the player opens in initState and closes in dispose, and setFullscreen — the single funnel every desktop platform reports through (window_manager on Linux, the Win32 runner callback on Windows, NSWindowDelegate on macOS) — records whether the fullscreen currently active was entered inside that scope. Escape only exits fullscreen the player itself entered; otherwise it is plain Back. The scope is depth-counted so the next-episode swap, where the incoming screen's initState runs before the outgoing screen's dispose, carries ownership across rather than resetting it. Nothing changes for a user who fullscreens from inside the player: Escape still exits fullscreen first, then acts as Back. The fullscreen toggle button and its shortcut are untouched, as is exitFullscreenOnPlayerClose. Fixes #1624.
This commit is contained in:
@@ -874,15 +874,47 @@ void main() {
|
||||
|
||||
group('shouldPhysicalEscapeExitFullscreen', () {
|
||||
test('uses fullscreen-first behavior for normal Windows and Linux navigation', () {
|
||||
expect(shouldPhysicalEscapeExitFullscreen(isMacOS: false, videoPlayerNavigationEnabled: false), isTrue);
|
||||
expect(
|
||||
shouldPhysicalEscapeExitFullscreen(
|
||||
isMacOS: false,
|
||||
videoPlayerNavigationEnabled: false,
|
||||
playerEnteredFullscreen: true,
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
|
||||
test('preserves fullscreen when HTPC-style player navigation is enabled', () {
|
||||
expect(shouldPhysicalEscapeExitFullscreen(isMacOS: false, videoPlayerNavigationEnabled: true), isFalse);
|
||||
expect(
|
||||
shouldPhysicalEscapeExitFullscreen(
|
||||
isMacOS: false,
|
||||
videoPlayerNavigationEnabled: true,
|
||||
playerEnteredFullscreen: true,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('preserves native fullscreen inside the macOS player', () {
|
||||
expect(shouldPhysicalEscapeExitFullscreen(isMacOS: true, videoPlayerNavigationEnabled: false), isFalse);
|
||||
expect(
|
||||
shouldPhysicalEscapeExitFullscreen(
|
||||
isMacOS: true,
|
||||
videoPlayerNavigationEnabled: false,
|
||||
playerEnteredFullscreen: true,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('preserves app-owned fullscreen the player did not enter', () {
|
||||
expect(
|
||||
shouldPhysicalEscapeExitFullscreen(
|
||||
isMacOS: false,
|
||||
videoPlayerNavigationEnabled: false,
|
||||
playerEnteredFullscreen: false,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user