From 7226a59cea2992648735d071dd89be54872eef6c Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Tue, 10 Nov 2020 23:16:45 +0100 Subject: [PATCH] Set (un)inhibit screen earlier --- clapper_src/misc.js | 9 +++++---- clapper_src/player.js | 16 +++++++++------- clapper_src/widget.js | 8 +------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/clapper_src/misc.js b/clapper_src/misc.js index d693689b..cfa1e8ff 100644 --- a/clapper_src/misc.js +++ b/clapper_src/misc.js @@ -35,14 +35,14 @@ function getClapperVersion() function inhibitForState(state, window) { let isInhibited = false; - let flags = Gtk.ApplicationInhibitFlags.SUSPEND - | Gtk.ApplicationInhibitFlags.IDLE; if(state === GstPlayer.PlayerState.PLAYING) { if(inhibitCookie) return; let app = window.get_application(); + let flags = Gtk.ApplicationInhibitFlags.SUSPEND + | Gtk.ApplicationInhibitFlags.IDLE; inhibitCookie = app.inhibit( window, @@ -58,8 +58,9 @@ function inhibitForState(state, window) //if(!inhibitCookie) return; - /* Uninhibit seems to be broken as of GTK 3.99.2 - this.uninhibit(inhibitCookie); + /* Uninhibit seems to be broken as of GTK 3.99.4 + let app = window.get_application(); + app.uninhibit(inhibitCookie); inhibitCookie = null; */ } diff --git a/clapper_src/player.js b/clapper_src/player.js index 1d41d7e2..09426a08 100644 --- a/clapper_src/player.js +++ b/clapper_src/player.js @@ -309,14 +309,16 @@ class ClapperPlayer extends PlayerBase { this.state = state; - if(this.quitOnStop) { - if(state === GstPlayer.PlayerState.STOPPED) { - let root = player.widget.get_root(); - if(root) - root.run_dispose(); - } + if(state !== GstPlayer.PlayerState.BUFFERING) { + let root = player.widget.get_root(); + Misc.inhibitForState(state, root); - return; + if(this.quitOnStop) { + if(state === GstPlayer.PlayerState.STOPPED) + root.run_dispose(); + + return; + } } let clapperWidget = player.widget.get_ancestor(Gtk.Grid); diff --git a/clapper_src/widget.js b/clapper_src/widget.js index 210655ee..1ab49a19 100644 --- a/clapper_src/widget.js +++ b/clapper_src/widget.js @@ -414,14 +414,8 @@ var Widget = GObject.registerClass({ break; } - let isNotStopped = (state !== GstPlayer.PlayerState.STOPPED) + let isNotStopped = (state !== GstPlayer.PlayerState.STOPPED); this.revealerTop.endTime.set_visible(isNotStopped); - - if(state === GstPlayer.PlayerState.BUFFERING) - return; - - let window = this.get_root(); - Misc.inhibitForState(state, window); } _onPlayerDurationChanged(player)