[pitivi] viewer: Hide overlays when playing
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] viewer: Hide overlays when playing
- Date: Mon, 28 Aug 2017 22:07:26 +0000 (UTC)
commit c9387c040e26534ec88236dc105acd47db33cfa7
Author: Stefan Popa <stefanpopa2209 gmail com>
Date: Thu Jul 27 10:15:47 2017 +0300
viewer: Hide overlays when playing
Make sure only the sink widget remains visible when playing and all
the overlays are hidden. When using keyframes with the transformation
properties, the properties of the overlay are updated with a delay,
which causes the sink widget and the overlay to get out of sync. Hiding
the overlay will hide this problem.
Differential Revision: https://phabricator.freedesktop.org/D1811
pitivi/viewer/overlay_stack.py | 24 +++++++++++++++++++-----
pitivi/viewer/viewer.py | 2 ++
2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/viewer/overlay_stack.py b/pitivi/viewer/overlay_stack.py
index 9e8abde..2da6a7f 100644
--- a/pitivi/viewer/overlay_stack.py
+++ b/pitivi/viewer/overlay_stack.py
@@ -34,6 +34,7 @@ class OverlayStack(Gtk.Overlay, Loggable):
Loggable.__init__(self)
self.__overlays = {}
self.__visible_overlays = []
+ self.__hide_all_overlays = False
self.app = app
self.window_size = numpy.array([1, 1])
self.click_position = None
@@ -122,11 +123,12 @@ class OverlayStack(Gtk.Overlay, Loggable):
overlay = self.__overlay_for_source(source)
self.__visible_overlays.append(overlay)
# check if viewer should be visible
- for source, overlay in self.__overlays.items():
- if source in sources:
- overlay.show()
- else:
- overlay.hide()
+ if not self.__hide_all_overlays:
+ for source, overlay in self.__overlays.items():
+ if source in sources:
+ overlay.show()
+ else:
+ overlay.hide()
def update(self, source):
self.__overlays[source].update_from_source()
@@ -135,6 +137,18 @@ class OverlayStack(Gtk.Overlay, Loggable):
self.selected_overlay = self.__overlay_for_source(source)
self.selected_overlay.queue_draw()
+ def hide_overlays(self):
+ if not self.__hide_all_overlays:
+ for overlay in self.__visible_overlays:
+ overlay.hide()
+ self.__hide_all_overlays = True
+
+ def show_overlays(self):
+ if self.__hide_all_overlays:
+ for overlay in self.__visible_overlays:
+ overlay.show()
+ self.__hide_all_overlays = False
+
def set_cursor(self, name):
cursor = None
display = Gdk.Display.get_default()
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index 4d3968a..645ca44 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -460,6 +460,7 @@ class ViewerContainer(Gtk.Box, Loggable):
self.playpause_button.setPause()
self.app.simple_inhibit(ViewerContainer.INHIBIT_REASON,
Gtk.ApplicationInhibitFlags.IDLE)
+ self.overlay_stack.hide_overlays()
else:
if state == Gst.State.PAUSED:
if old_state != Gst.State.PAUSED:
@@ -470,6 +471,7 @@ class ViewerContainer(Gtk.Box, Loggable):
self.app.write_action(st)
self.playpause_button.setPlay()
+ self.overlay_stack.show_overlays()
self.app.simple_uninhibit(ViewerContainer.INHIBIT_REASON)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]