diff options
-rw-r--r-- | data/org.ArcticaProject.arctica-greeter.gschema.xml | 10 | ||||
-rw-r--r-- | src/arctica-greeter.vala | 26 | ||||
-rw-r--r-- | src/settings.vala | 3 |
3 files changed, 36 insertions, 3 deletions
diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml index 958fab8..ac66c5b 100644 --- a/data/org.ArcticaProject.arctica-greeter.gschema.xml +++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml @@ -159,6 +159,16 @@ <default>false</default> <summary>Whether to enable the onscreen keyboard.</summary> </key> + <key name="magnifier-position" type="s"> + <choices> + <choice value='top-left'/> + <choice value='top-right'/> + <choice value='centre-left'/> + <choice value='centre-right'/> + </choices> + <default>'centre-right'</default> + <summary>Position of the magnifier window.</summary> + </key> <key name="magnifier" type="b"> <default>false</default> <summary>Whether to enable the screen magnifier.</summary> 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) { |