diff options
| author | Robert Tari <robert@tari.in> | 2025-04-11 22:21:48 +0200 |
|---|---|---|
| committer | Robert Tari <robert@tari.in> | 2025-04-11 22:21:48 +0200 |
| commit | 4d103464841c06b53447bd95db7d7785a156af13 (patch) | |
| tree | 920acb84d041bdabd9470479e81af95027f1bb80 | |
| parent | 33ec57fe1d832db50c69a18b1119790d3f890027 (diff) | |
| download | arctica-greeter-4d103464841c06b53447bd95db7d7785a156af13.tar.gz arctica-greeter-4d103464841c06b53447bd95db7d7785a156af13.tar.bz2 arctica-greeter-4d103464841c06b53447bd95db7d7785a156af13.zip | |
Add logo positioning tweaks
| -rw-r--r-- | data/org.ArcticaProject.arctica-greeter.gschema.xml | 18 | ||||
| -rw-r--r-- | src/background.vala | 29 | ||||
| -rw-r--r-- | src/settings.vala | 3 |
3 files changed, 48 insertions, 2 deletions
diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml index c6da686..38be872 100644 --- a/data/org.ArcticaProject.arctica-greeter.gschema.xml +++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml @@ -317,5 +317,23 @@ <default>1.0</default> <summary>The background opacity of the error message in the prompt box.</summary> </key> + <key name="logo-position" type="s"> + <choices> + <choice value='top-left'/> + <choice value='top-right'/> + <choice value='bottom-left'/> + <choice value='bottom-right'/> + </choices> + <default>'bottom-left'</default> + <summary>The position of the logo.</summary> + </key> + <key name="logo-offset-horizontal" type="i"> + <default>2</default> + <summary>The horizontal offset of the logo from the edge of the screen in grid units.</summary> + </key> + <key name="logo-offset-vertical" type="i"> + <default>1</default> + <summary>The vertical offset of the logo from the edge of the screen in grid units.</summary> + </key> </schema> </schemalist> diff --git a/src/background.vala b/src/background.vala index e6d52fa..bf1ca6f 100644 --- a/src/background.vala +++ b/src/background.vala @@ -2,6 +2,7 @@ * * Copyright (C) 2011,2012 Canonical Ltd * Copyright (C) 2015-2017 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> + * Copyright (C) 2025 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 @@ -18,6 +19,7 @@ * Authors: Robert Ancell <robert.ancell@canonical.com> * Michael Terry <michael.terry@canonical.com> * Mike Gabriel <mike.gabriel@das-netzwerkteam.de> + * Robert Tari <robert@tari.in> */ class BackgroundLoader : Object @@ -207,8 +209,31 @@ class BackgroundLoader : Object if (logo != null) { bc.save (); - var x = (int) (grid_x_offset + 2 * greeter.grid_size); - var y = (int) (image.height - 1 * greeter.grid_size - logo_height + grid_y_offset); + string sPosition = AGSettings.get_string (AGSettings.KEY_LOGO_POSITION); + int x = AGSettings.get_integer (AGSettings.KEY_LOGO_OFFSET_HORIZONTAL); + int y = AGSettings.get_integer (AGSettings.KEY_LOGO_OFFSET_VERTICAL); + + if (sPosition == "top-left") + { + x = (int) (grid_x_offset + (x * greeter.grid_size)); + y = (int) (grid_y_offset + ((y + 1) * greeter.grid_size)); + } + else if (sPosition == "top-right") + { + x = (int) (image.width - (x * greeter.grid_size) - logo_width + grid_x_offset); + y = (int) (grid_y_offset + ((y + 1) * greeter.grid_size)); + } + else if (sPosition == "bottom-left") + { + x = (int) (grid_x_offset + (x * greeter.grid_size)); + y = (int) (image.height - (y * greeter.grid_size) - logo_height + grid_y_offset); + } + else if (sPosition == "bottom-right") + { + x = (int) (image.width - (x * greeter.grid_size) - logo_width + grid_x_offset); + y = (int) (image.height - (y * greeter.grid_size) - logo_height + grid_y_offset); + } + bc.translate (x, y); bc.set_source_surface (logo, 0, 0); bc.paint_with_alpha (AGSettings.get_double (AGSettings.KEY_LOGO_ALPHA)); diff --git a/src/settings.vala b/src/settings.vala index 3eb7662..b7d5f46 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -95,6 +95,9 @@ public class AGSettings : Object public const string KEY_PROMPTBOX_COLOR_NORMAL = "prompt-box-color-normal"; public const string KEY_PROMPTBOX_COLOR_ERROR = "prompt-box-color-error"; public const string KEY_PROMPTBOX_ERROR_BG_OPACITY = "prompt-box-error-bg-opacity"; + public const string KEY_LOGO_POSITION = "logo-position"; + public const string KEY_LOGO_OFFSET_HORIZONTAL = "logo-offset-horizontal"; + public const string KEY_LOGO_OFFSET_VERTICAL = "logo-offset-vertical"; public static bool get_boolean (string key) { |
