From e4335721be990f37c25b99d7c8f209f4c1e4ff7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Mon, 26 Apr 2021 17:51:20 +0200 Subject: [PATCH] Simplify auto-fullscreen logic --- src/player.js | 38 +++++++++++++------------------------- src/widget.js | 5 ----- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/player.js b/src/player.js index 3c285bb4..d0e66945 100644 --- a/src/player.js +++ b/src/player.js @@ -46,8 +46,6 @@ class ClapperPlayer extends GstClapper.Clapper this.customVideoTitle = null; this.windowMapped = false; - this.canAutoFullscreen = false; - this.playOnFullscreen = false; this.quitOnStop = false; this.needsTocUpdate = true; @@ -217,12 +215,22 @@ class ClapperPlayer extends GstClapper.Clapper this.stop(); debug('new playlist'); - this.playlistWidget.removeAll(); - this.canAutoFullscreen = true; - this._addPlaylistItems(playlist); + if(settings.get_boolean('fullscreen-auto')) { + const { root } = this.playlistWidget; + /* Do not enter fullscreen when already in it + * or when in floating mode */ + if( + root + && root.child + && !root.child.isFullscreenMode + && root.child.controlsRevealer.reveal_child + ) + root.fullscreen(); + } + /* If not mapped yet, first track will play after map */ if(this.windowMapped) this._playFirstTrack(); @@ -568,26 +576,6 @@ class ClapperPlayer extends GstClapper.Clapper { debug(`URI loaded: ${uri}`); this.needsTocUpdate = true; - - if(this.canAutoFullscreen) { - this.canAutoFullscreen = false; - - if(settings.get_boolean('fullscreen-auto')) { - const root = player.widget.get_root(); - const clapperWidget = root.get_child(); - /* Do not enter fullscreen when already in it - * or when in floating mode */ - if( - !clapperWidget.isFullscreenMode - && clapperWidget.controlsRevealer.reveal_child - ) { - this.playOnFullscreen = true; - root.fullscreen(); - - return; - } - } - } } _onPlayerWarning(player, error) diff --git a/src/widget.js b/src/widget.js index 73831cd6..0860f886 100644 --- a/src/widget.js +++ b/src/widget.js @@ -160,11 +160,6 @@ class ClapperWidget extends Gtk.Grid if(this.revealerTop.child_revealed) this._checkSetUpdateTimeInterval(); - if(this.player.playOnFullscreen && isFullscreen) { - this.player.playOnFullscreen = false; - this.player.play(); - } - debug(`interface in fullscreen mode: ${isFullscreen}`); }