From ab86a3469bca9246ba5a6039d0cce8c6afae1fc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Tue, 15 Feb 2022 15:25:43 +0100
Subject: [PATCH] prefs: Scale preview border
We currently pick up the settings value directly, which is the
border that is used on the actual (i.e. monitor-sized) background.
That's way too big when applied as-is on the preview, so assume a
common monitor size and compute an appropriate scale from that.
---
prefs.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/prefs.js b/prefs.js
index c8d5903..ba78322 100644
--- a/prefs.js
+++ b/prefs.js
@@ -13,6 +13,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
const BACKGROUND_SCHEMA = 'org.gnome.desktop.background';
+const MONITOR_WIDTH = 1920;
const PREVIEW_WIDTH = 400;
let BackgroundLogoPrefsWidget = GObject.registerClass(
@@ -197,7 +198,9 @@ class BackgroundLogoPrefsWidget extends Gtk.Grid {
}
_getLogoPosition(width, height) {
- let scaledBorder = this._settings.get_uint('logo-border');
+ const previewScale = PREVIEW_WIDTH / MONITOR_WIDTH;
+ const scaledBorder =
+ previewScale * this._settings.get_uint('logo-border');
let x, y;
const position = this._settings.get_string('logo-position');
if (position.endsWith('left'))
--
2.33.1