diff options
author | Robert Tari <robert@tari.in> | 2024-06-19 12:46:30 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2024-06-19 16:47:41 +0200 |
commit | d9736d7141f5173ab7f07d2d1813b58400575c13 (patch) | |
tree | c31b3d0df057b90200ebaeca1c941454ca59afb4 /src | |
parent | c48673e2d46c61eea9e6b5be4eb3ef3e8c4d3ad7 (diff) | |
download | arctica-greeter-d9736d7141f5173ab7f07d2d1813b58400575c13.tar.gz arctica-greeter-d9736d7141f5173ab7f07d2d1813b58400575c13.tar.bz2 arctica-greeter-d9736d7141f5173ab7f07d2d1813b58400575c13.zip |
Make position of the greeter magnifier configurable
fixes https://github.com/AyatanaIndicators/ayatana-indicator-a11y/issues/26
Diffstat (limited to 'src')
-rw-r--r-- | src/arctica-greeter.vala | 26 | ||||
-rw-r--r-- | src/settings.vala | 3 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index bd88d44..7958ea4 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -1989,14 +1989,36 @@ public class DBusServer : Object if ((this.pGreeter.pMagnifierWindow != null) && (pMagnifierSocket != null) && bActive) { - /* resize and position the magnifier window to be in the right part of the screen */ + /* resize and position the magnifier window */ debug ("Resizing and positioning Magnifier window."); var pDisplay = this.pGreeter.main_window.get_display (); var pMonitor = pDisplay.get_monitor_at_window (this.pGreeter.main_window.get_window ()); Gdk.Rectangle cRect = pMonitor.get_geometry (); int magnifier_width = 2 * cRect.width / 5; int magnifier_height = 2 * cRect.height / 5; - this.pGreeter.pMagnifierWindow.move (cRect.x + cRect.width - cRect.width / 10 - magnifier_width, cRect.y + cRect.height / 5 + cRect.height / 10); + string sPosition = AGSettings.get_string (AGSettings.KEY_MAGNIFIER_POSITION); + + if (sPosition == "top-left") + { + magnifier_width = (int) (magnifier_width * 0.75); + magnifier_height = (int) (magnifier_height * 0.75); + this.pGreeter.pMagnifierWindow.move (cRect.x + ArcticaGreeter.MENUBAR_HEIGHT, cRect.y + ArcticaGreeter.MENUBAR_HEIGHT * 2); + } + else if (sPosition == "top-right") + { + magnifier_width = (int) (magnifier_width * 0.75); + magnifier_height = (int) (magnifier_height * 0.75); + this.pGreeter.pMagnifierWindow.move (cRect.x + cRect.width - ArcticaGreeter.MENUBAR_HEIGHT - magnifier_width, cRect.y + ArcticaGreeter.MENUBAR_HEIGHT * 2); + } + else if (sPosition == "centre-left") + { + this.pGreeter.pMagnifierWindow.move (cRect.x + cRect.width / 10, cRect.y + cRect.height / 5 + cRect.height / 10); + } + else if (sPosition == "centre-right") + { + this.pGreeter.pMagnifierWindow.move (cRect.x + cRect.width - cRect.width / 10 - magnifier_width, cRect.y + cRect.height / 5 + cRect.height / 10); + } + this.pGreeter.pMagnifierWindow.resize (magnifier_width, magnifier_height); } diff --git a/src/settings.vala b/src/settings.vala index bb95c9f..ea1db9d 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -3,7 +3,7 @@ * Copyright (C) 2011,2012 Canonical Ltd * Copyright (C) 2015,2017 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> * Copyright (C) 2022 Mihai Moldovan <ionic@ionic.de> - * Copyright (C) 2023 Robert Tari + * Copyright (C) 2023-2024 Robert Tari * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as @@ -88,6 +88,7 @@ public class AGSettings : Object public const string KEY_GEOCLUE_AGENT = "geoclue-agent"; public const string KEY_MAGNIFIER = "magnifier"; public const string KEY_CONTENT_ALIGN = "content-align"; + public const string KEY_MAGNIFIER_POSITION = "magnifier-position"; public static bool get_boolean (string key) { |