From ca168f34ed5269b570ffc3bab7fa7abe9d26b042 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Sun, 5 Sep 2021 11:30:34 +0200 Subject: [PATCH] controls: Use isFullscreen and isMobile from main widget The "controls.isMobile" was used incorrectly here as it holds value if controls are in mobile mode, not if running on mobile screen. Use those values from clapper main widget instead. This fixes incorrect chapter popover placement on mobile screens. Also handle fine-tune in CSS as this code path is hit multiple times when starting/stopping slider drag. --- css/styles.css | 8 ++++++++ src/controls.js | 19 +++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/css/styles.css b/css/styles.css index dfbacbd0..34d0220e 100644 --- a/css/styles.css +++ b/css/styles.css @@ -187,6 +187,14 @@ scale trough slider { .positionscale trough highlight { min-height: 6px; } +.fullscreen.tvmode .positionscale { + padding-left: 12px; + padding-right: 12px; +} +.fullscreen.tvmode .positionscale.fine-tune { + padding-left: 12px; + padding-right: 12px; +} .fullscreen.tvmode .positionscale trough slider { color: transparent; background: transparent; diff --git a/src/controls.js b/src/controls.js index 70a35a29..9ff15a06 100644 --- a/src/controls.js +++ b/src/controls.js @@ -27,7 +27,6 @@ class ClapperControls extends Gtk.Box this.currentPosition = 0; this.isPositionDragging = false; this.isMobile = false; - this.isFullscreen = false; this.showHours = false; this.durationFormatted = '00:00'; @@ -120,7 +119,6 @@ class ClapperControls extends Gtk.Box this.subtitleTracksButton.setFullscreenMode(isFullscreen, isMobileMonitor); this.unfullscreenButton.visible = isFullscreen; - this.isFullscreen = isFullscreen; } setLiveMode(isLive, isSeekable) @@ -348,10 +346,12 @@ class ClapperControls extends Gtk.Box const [isShared, destX, destY] = this.positionScale.translate_coordinates( this.positionScale.parent, 0, 0 ); + const clapperWidget = this.get_ancestor(Gtk.Grid); /* Half of slider width, values are defined in CSS */ - const sliderOffset = (this.isFullscreen && !this.isMobile) - ? 10 : 9; + const sliderOffset = ( + clapperWidget.isFullscreenMode && !clapperWidget.isMobileMonitor + ) ? 10 : 9; this.chapterPopover.set_pointing_to(new Gdk.Rectangle({ x: destX + end - sliderOffset, @@ -466,22 +466,13 @@ class ClapperControls extends Gtk.Box { const isPositionDragging = scale.has_css_class('dragging'); - /* When scale enters "fine-tune", slider changes position a little. - * We do not want that to cause seek time change on TV mode */ - if( - this.isFullscreen - && !this.isMobile - && scale.has_css_class('fine-tune') - ) - scale.remove_css_class('fine-tune'); - if(this.isPositionDragging === isPositionDragging) return; const clapperWidget = this.get_ancestor(Gtk.Grid); if(!clapperWidget) return; - if(this.isFullscreen) { + if(clapperWidget.isFullscreenMode) { clapperWidget.revealControls(); if(isPositionDragging)