Simplify auto-fullscreen logic

This commit is contained in:
Rafał Dzięgiel
2021-04-26 17:51:20 +02:00
parent 45d2702e01
commit e4335721be
2 changed files with 13 additions and 30 deletions

View File

@@ -46,8 +46,6 @@ class ClapperPlayer extends GstClapper.Clapper
this.customVideoTitle = null; this.customVideoTitle = null;
this.windowMapped = false; this.windowMapped = false;
this.canAutoFullscreen = false;
this.playOnFullscreen = false;
this.quitOnStop = false; this.quitOnStop = false;
this.needsTocUpdate = true; this.needsTocUpdate = true;
@@ -217,12 +215,22 @@ class ClapperPlayer extends GstClapper.Clapper
this.stop(); this.stop();
debug('new playlist'); debug('new playlist');
this.playlistWidget.removeAll(); this.playlistWidget.removeAll();
this.canAutoFullscreen = true;
this._addPlaylistItems(playlist); 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 not mapped yet, first track will play after map */
if(this.windowMapped) if(this.windowMapped)
this._playFirstTrack(); this._playFirstTrack();
@@ -568,26 +576,6 @@ class ClapperPlayer extends GstClapper.Clapper
{ {
debug(`URI loaded: ${uri}`); debug(`URI loaded: ${uri}`);
this.needsTocUpdate = true; 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) _onPlayerWarning(player, error)

View File

@@ -160,11 +160,6 @@ class ClapperWidget extends Gtk.Grid
if(this.revealerTop.child_revealed) if(this.revealerTop.child_revealed)
this._checkSetUpdateTimeInterval(); this._checkSetUpdateTimeInterval();
if(this.player.playOnFullscreen && isFullscreen) {
this.player.playOnFullscreen = false;
this.player.play();
}
debug(`interface in fullscreen mode: ${isFullscreen}`); debug(`interface in fullscreen mode: ${isFullscreen}`);
} }