From dbd3e536b2d3b95b754950b1bb7457f0a373f0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Wed, 24 Feb 2021 10:11:12 +0100 Subject: [PATCH] Limit bottom fullscreen controls panel width Fullscreen bottom controls panel does not look good when progress bar is too long (especially on "ultrawide" displays), so limit its max width to 1720 application-pixels. This should make it still long enough for convenient chapter seeking. --- src/revealers.js | 13 +++++++++++++ src/widget.js | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/revealers.js b/src/revealers.js index bbdc7860..458219ba 100644 --- a/src/revealers.js +++ b/src/revealers.js @@ -228,6 +228,19 @@ class ClapperRevealerBottom extends CustomRevealer this.revealerBox.remove(widget); } + setLayoutMargins(layoutWidth) + { + const maxWidth = 1720; + + if(layoutWidth <= maxWidth) + return; + + const margin = (layoutWidth - maxWidth) / 2; + + this.margin_start = margin; + this.margin_end = margin; + } + _onMotion(controller, x, y) { const clapperWidget = this.root.child; diff --git a/src/widget.js b/src/widget.js index 2571857f..b1d53dfe 100644 --- a/src/widget.js +++ b/src/widget.js @@ -563,6 +563,10 @@ class ClapperWidget extends Gtk.Grid return; this.layoutWidth = width; + + if(this.isFullscreenMode) + this.revealerBottom.setLayoutMargins(width); + this.controls._onPlayerResize(width, height); }