diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2025-03-22 22:05:59 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2025-03-24 17:57:37 +0100 |
commit | e8d37d2fe2d3b6827c495f86ce4ac7951486f970 (patch) | |
tree | 985da7d1a25bd29af96156df692055ffe68edcf0 | |
parent | 6586045b99e43ed046f051d23b0b7f8b131f38c1 (diff) | |
download | arctica-greeter-e8d37d2fe2d3b6827c495f86ce4ac7951486f970.tar.gz arctica-greeter-e8d37d2fe2d3b6827c495f86ce4ac7951486f970.tar.bz2 arctica-greeter-e8d37d2fe2d3b6827c495f86ce4ac7951486f970.zip |
Introduce UI/widget scaling per scaling factor.
This gsettings 'widget-scaling-factor' can be used together with the 'xft-dpi' setting to fractionally scale the UI to better readability.
-rw-r--r-- | data/org.ArcticaProject.arctica-greeter.gschema.xml | 4 | ||||
-rw-r--r-- | src/arctica-greeter.vala | 18 | ||||
-rw-r--r-- | src/background.vala | 14 | ||||
-rw-r--r-- | src/dash-box.vala | 15 | ||||
-rw-r--r-- | src/greeter-list.vala | 43 | ||||
-rw-r--r-- | src/list-stack.vala | 4 | ||||
-rw-r--r-- | src/main-window.vala | 32 | ||||
-rw-r--r-- | src/menubar.vala | 7 | ||||
-rw-r--r-- | src/prompt-box.vala | 44 | ||||
-rw-r--r-- | src/session-list.vala | 5 | ||||
-rw-r--r-- | src/settings.vala | 1 |
11 files changed, 128 insertions, 59 deletions
diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml index ac66c5b..68a2522 100644 --- a/data/org.ArcticaProject.arctica-greeter.gschema.xml +++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml @@ -218,6 +218,10 @@ <default>'auto'</default> <summary>Whether to enable HiDPI support</summary> </key> + <key name="widget-scaling" type="d"> + <default>1.0</default> + <summary>Scaling factor for UI elements (menubar, icons, promptboxes). Everything except from fonts.</summary> + </key> <key name="font-scaling" type="d"> <default>1.0</default> <summary>Scaling factor for fonts that can be used to adjust the greeter's font sizes.</summary> diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index 30be99a..ea1fce4 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -21,7 +21,6 @@ * Robert Tari <robert@tari.in> */ -public const int grid_size = 40; [SingleInstance] public class ArcticaGreeter : Object @@ -37,7 +36,9 @@ public class ArcticaGreeter : Object public bool test_highcontrast { get; construct; default = false; } // Menubar is smaller, but with shadow, we reserve more space - public const int MENUBAR_HEIGHT = 40; + public int menubar_height { get; set; default = 32 + 8; } + public int grid_size { get; set; default = 40; } + public double scaling_factor_widgets { get; set; default = 1; } private string state_file; private KeyFile state; @@ -1500,6 +1501,13 @@ public class ArcticaGreeter : Object debug ("Creating Arctica Greeter"); var greeter = new ArcticaGreeter (do_test_mode, do_test_highcontrast); + + /* Widget/UI scaling settings */ + greeter.scaling_factor_widgets = AGSettings.get_double (AGSettings.KEY_WIDGET_SCALING); + debug ("Scaling factor for widgets / UI elements is: %f", greeter.scaling_factor_widgets); + greeter.menubar_height = (int)Math.round(greeter.menubar_height * greeter.scaling_factor_widgets); + greeter.grid_size = (int)Math.round(greeter.grid_size * greeter.scaling_factor_widgets); + greeter.go(); if (!do_test_mode) @@ -1998,6 +2006,8 @@ public class DBusServer : Object if ((this.pGreeter.pMagnifierWindow != null) && (pMagnifierSocket != null) && bActive) { + var greeter = new ArcticaGreeter(); + /* resize and position the magnifier window */ debug ("Resizing and positioning Magnifier window."); var pDisplay = this.pGreeter.main_window.get_display (); @@ -2011,13 +2021,13 @@ public class DBusServer : Object { 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); + this.pGreeter.pMagnifierWindow.move (cRect.x + greeter.menubar_height, cRect.y + greeter.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); + this.pGreeter.pMagnifierWindow.move (cRect.x + cRect.width - greeter.menubar_height - magnifier_width, cRect.y + greeter.menubar_height * 2); } else if (sPosition == "centre-left") { diff --git a/src/background.vala b/src/background.vala index 65a3365..e6d52fa 100644 --- a/src/background.vala +++ b/src/background.vala @@ -194,6 +194,7 @@ class BackgroundLoader : Object { var grid_x_offset = get_grid_offset (image.width); var grid_y_offset = get_grid_offset (image.height); + var greeter = new ArcticaGreeter(); /* Create background */ var surface = new Cairo.Surface.similar (target_surface, Cairo.Content.COLOR, image.width, image.height); @@ -206,8 +207,8 @@ class BackgroundLoader : Object if (logo != null) { bc.save (); - var x = (int) (grid_x_offset + 1.1 * grid_size); - var y = (int) (image.height - 1.1 * grid_size - logo_height + grid_y_offset); + var x = (int) (grid_x_offset + 2 * greeter.grid_size); + var y = (int) (image.height - 1 * 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)); @@ -835,14 +836,15 @@ public class Background : Gtk.Fixed var height = get_allocated_height (); var grid_x_offset = get_grid_offset (width); var grid_y_offset = get_grid_offset (height); + var greeter = new ArcticaGreeter(); /* Overlay grid */ - var overlay_surface = new Cairo.Surface.similar (target_surface, Cairo.Content.COLOR_ALPHA, grid_size, grid_size); + var overlay_surface = new Cairo.Surface.similar (target_surface, Cairo.Content.COLOR_ALPHA, greeter.grid_size, greeter.grid_size); var oc = new Cairo.Context (overlay_surface); oc.rectangle (0, 0, 1, 1); - oc.rectangle (grid_size - 1, 0, 1, 1); - oc.rectangle (0, grid_size - 1, 1, 1); - oc.rectangle (grid_size - 1, grid_size - 1, 1, 1); + oc.rectangle (greeter.grid_size - 1, 0, 1, 1); + oc.rectangle (0, greeter.grid_size - 1, 1, 1); + oc.rectangle (greeter.grid_size - 1, greeter.grid_size - 1, 1, 1); oc.set_source_rgba (1.0, 1.0, 1.0, 0.25); oc.fill (); var overlay = new Cairo.Pattern.for_surface (overlay_surface); diff --git a/src/dash-box.vala b/src/dash-box.vala index 4d907db..0772e3f 100644 --- a/src/dash-box.vala +++ b/src/dash-box.vala @@ -165,8 +165,10 @@ public class DashBox : Gtk.Box } else { - min = grid_size * GreeterList.DEFAULT_BOX_HEIGHT - GreeterList.BORDER * 2; - nat = grid_size * GreeterList.DEFAULT_BOX_HEIGHT - GreeterList.BORDER * 2; + var greeter = new ArcticaGreeter(); + + min = greeter.grid_size * GreeterList.DEFAULT_BOX_HEIGHT - (int)(GreeterList.BORDER * greeter.scaling_factor_widgets * 2); + nat = greeter.grid_size * GreeterList.DEFAULT_BOX_HEIGHT - (int)(GreeterList.BORDER * greeter.scaling_factor_widgets * 2); } } else @@ -184,8 +186,9 @@ public class DashBox : Gtk.Box public override void get_preferred_width (out int min, out int nat) { - min = grid_size * GreeterList.BOX_WIDTH - GreeterList.BORDER * 2; - nat = grid_size * GreeterList.BOX_WIDTH - GreeterList.BORDER * 2; + var greeter = new ArcticaGreeter(); + min = greeter.grid_size * GreeterList.BOX_WIDTH - (int)(GreeterList.BORDER * greeter.scaling_factor_widgets * 2); + nat = greeter.grid_size * GreeterList.BOX_WIDTH - (int)(GreeterList.BORDER * greeter.scaling_factor_widgets * 2); } public override bool draw (Cairo.Context c) @@ -200,8 +203,10 @@ public class DashBox : Gtk.Box c.restore (); } + var greeter = new ArcticaGreeter(); + /* Draw darker background with a rounded border */ - var box_r = 0.3 * grid_size; + var box_r = 0.3 * greeter.grid_size; int box_y = 0; int box_w; int box_h; diff --git a/src/greeter-list.vala b/src/greeter-list.vala index d4a5db1..b67ba16 100644 --- a/src/greeter-list.vala +++ b/src/greeter-list.vala @@ -29,7 +29,8 @@ public int _scale_factor = 1; private int get_grid_offset (int size) { - return (int) (size % grid_size) / 2; + var greeter = new ArcticaGreeter(); + return (int) (size % greeter.grid_size) / 2; } [DBus (name="com.lomiri.LomiriGreeter.List")] @@ -119,12 +120,13 @@ public abstract class GreeterList : FadableBox { get { + var greeter = new ArcticaGreeter(); /* First, get grid row number as if menubar weren't there */ - var row = (ArcticaGreeter.MENUBAR_HEIGHT + get_allocated_height ()) / grid_size; + var row = (greeter.menubar_height + get_allocated_height ()) / greeter.grid_size; row = row - DEFAULT_BOX_HEIGHT; /* and no default dash box */ row = row / 2; /* and in the middle */ /* Now calculate y pixel spot keeping in mind menubar's allocation */ - return row * grid_size - ArcticaGreeter.MENUBAR_HEIGHT; + return row * greeter.grid_size - greeter.menubar_height; } } @@ -227,8 +229,9 @@ public abstract class GreeterList : FadableBox public override void get_preferred_width (out int min, out int nat) { - min = BOX_WIDTH * grid_size; - nat = BOX_WIDTH * grid_size; + var greeter = new ArcticaGreeter(); + min = BOX_WIDTH * greeter.grid_size; + nat = BOX_WIDTH * greeter.grid_size; } public override void get_preferred_height (out int min, out int nat) @@ -403,8 +406,10 @@ public abstract class GreeterList : FadableBox protected void add_entry (PromptBox entry) { + var greeter = new ArcticaGreeter(); + entry.expand = true; - entry.set_size_request (grid_size * BOX_WIDTH - BORDER * 2, -1); + entry.set_size_request (greeter.grid_size * BOX_WIDTH - (int)(BORDER * greeter.scaling_factor_widgets * 2), -1); add_with_class (entry); insert_entry (entry); @@ -515,33 +520,39 @@ public abstract class GreeterList : FadableBox protected int get_greeter_box_height_grids () { + var greeter = new ArcticaGreeter(); + int height = get_greeter_box_height (); - return height / grid_size + 1; /* +1 because we'll be slightly under due to BORDER */ + return height / greeter.grid_size + 1; /* +1 because we'll be slightly under due to BORDER */ } protected int get_greeter_box_x () { - return box_x + BORDER; + var greeter = new ArcticaGreeter(); + return box_x + (int)(BORDER * greeter.scaling_factor_widgets); } protected int get_greeter_box_y () { - return box_y + BORDER; + var greeter = new ArcticaGreeter(); + return box_y + (int)(BORDER * greeter.scaling_factor_widgets); } protected virtual int get_position_y (double position) { + var greeter = new ArcticaGreeter(); + // Most position heights are just the grid height. Except for the // greeter box itself. - int box_height = get_greeter_box_height_grids () * grid_size; + int box_height = get_greeter_box_height_grids () * greeter.grid_size; double offset; if (position < 0) - offset = position * grid_size; + offset = position * greeter.grid_size; else if (position < 1) offset = position * box_height; else - offset = (position - 1) * grid_size + box_height; + offset = (position - 1) * greeter.grid_size + box_height; return box_y + (int)Math.round(offset); } @@ -561,8 +572,10 @@ public abstract class GreeterList : FadableBox Gtk.Allocation allocation; get_allocation (out allocation); + var greeter = new ArcticaGreeter(); + var child_allocation = Gtk.Allocation (); - child_allocation.width = grid_size * BOX_WIDTH - BORDER * 2; + child_allocation.width = greeter.grid_size * BOX_WIDTH - (int)(BORDER * greeter.scaling_factor_widgets * 2); entry.get_preferred_height_for_width (child_allocation.width, null, out child_allocation.height); child_allocation.x = allocation.x + get_greeter_box_x (); child_allocation.y = allocation.y + get_position_y (position); @@ -758,12 +771,14 @@ public abstract class GreeterList : FadableBox fixed.propagate_draw (greeter_box, c); /* Always full alpha */ c.restore (); + var greeter = new ArcticaGreeter(); + if (greeter_box.base_alpha != 0.0) { c.save (); c.push_group (); - c.rectangle (get_greeter_box_x (), get_greeter_box_y () - n_above * grid_size, grid_size * BOX_WIDTH - BORDER * 2, grid_size * (n_above + n_below + get_greeter_box_height_grids ())); + c.rectangle (get_greeter_box_x (), get_greeter_box_y () - n_above * greeter.grid_size, greeter.grid_size * BOX_WIDTH - (int)(BORDER * greeter.scaling_factor_widgets * 2), greeter.grid_size * (n_above + n_below + get_greeter_box_height_grids ())); c.clip (); foreach (var child in fixed.get_children ()) diff --git a/src/list-stack.vala b/src/list-stack.vala index 87e040b..d87b37a 100644 --- a/src/list-stack.vala +++ b/src/list-stack.vala @@ -35,7 +35,9 @@ public class ListStack : Gtk.Fixed construct { - width = grid_size * GreeterList.BOX_WIDTH; + var greeter = new ArcticaGreeter(); + + width = greeter.grid_size * GreeterList.BOX_WIDTH; } public GreeterList? top () diff --git a/src/main-window.vala b/src/main-window.vala index 492c8fd..1d33ec1 100644 --- a/src/main-window.vala +++ b/src/main-window.vala @@ -95,7 +95,8 @@ public class MainWindow : Gtk.Window background-repeat: repeat;".printf(shadow_path); } - menubox.set_size_request (-1, ArcticaGreeter.MENUBAR_HEIGHT); + var greeter = new ArcticaGreeter(); + menubox.set_size_request (-1, greeter.menubar_height); menubox.show (); login_box.add (menubox); ArcticaGreeter.add_style_class (menubox); @@ -132,7 +133,7 @@ public class MainWindow : Gtk.Window if (content_align == "center") { // offset for back button - align.margin_right = grid_size; + align.margin_right = greeter.grid_size; } align.show (); @@ -144,8 +145,8 @@ public class MainWindow : Gtk.Window align.add (hbox); align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f); - align.set_size_request (grid_size, -1); - align.margin_bottom = ArcticaGreeter.MENUBAR_HEIGHT; /* offset for menubar at top */ + align.set_size_request (greeter.grid_size, -1); + align.margin_bottom = greeter.menubar_height; /* offset for menubar at top */ align.show (); hbox.add (align); @@ -154,7 +155,8 @@ public class MainWindow : Gtk.Window Gtk.button_set_focus_on_click (back_button, false); var image = new Gtk.Image.from_file (Path.build_filename (Config.PKGDATADIR, "arrow_left.png", null)); image.show (); - back_button.set_size_request (grid_size - GreeterList.BORDER * 2, grid_size - GreeterList.BORDER * 2); + back_button.set_size_request (greeter.grid_size - (int)(GreeterList.BORDER * greeter.scaling_factor_widgets * 2), + greeter.grid_size - (int)(GreeterList.BORDER * greeter.scaling_factor_widgets * 2)); try { @@ -192,7 +194,6 @@ public class MainWindow : Gtk.Window only_on_monitor = AGSettings.get_string(AGSettings.KEY_ONLY_ON_MONITOR); monitor_setting_ok = only_on_monitor == "auto"; - var greeter = new ArcticaGreeter (); if (greeter.test_mode) { /* Simulate an 800x600 monitor to the left of a 640x480 monitor */ @@ -226,17 +227,29 @@ public class MainWindow : Gtk.Window back_button.hide (); stack.pop (); + + redraw_main_window(); } + protected void redraw_main_window () + { + Gtk.Allocation allocation; + this.get_allocation (out allocation); + queue_draw_area (allocation.x, allocation.y, allocation.width, allocation.height); + } + + public override void size_allocate (Gtk.Allocation allocation) { base.size_allocate (allocation); + var greeter = new ArcticaGreeter(); + if (content_box != null) { var content_align = AGSettings.get_string(AGSettings.KEY_CONTENT_ALIGN); - content_box.margin_left = get_grid_offset (get_allocated_width ()) + (content_align == "left" ? grid_size : 0); - content_box.margin_right = get_grid_offset (get_allocated_width ()) + (content_align == "right" ? grid_size : 0); + content_box.margin_left = get_grid_offset (get_allocated_width ()) + (content_align == "left" ? greeter.grid_size : 0); + content_box.margin_right = get_grid_offset (get_allocated_width ()) + (content_align == "right" ? greeter.grid_size : 0); content_box.margin_top = get_grid_offset (get_allocated_height ()); content_box.margin_bottom = get_grid_offset (get_allocated_height ()); } @@ -252,8 +265,9 @@ public class MainWindow : Gtk.Window public void set_struts () { + var greeter = new ArcticaGreeter(); /* Substract the 5px shadow from the menubar height, so that indicators' menus render well */ - _set_struts (MenubarPositions.TOP, ArcticaGreeter.MENUBAR_HEIGHT); + _set_struts (MenubarPositions.TOP, greeter.menubar_height); } private void _set_struts (uint position, long menubar_size) diff --git a/src/menubar.vala b/src/menubar.vala index e39c1f3..5d193dd 100644 --- a/src/menubar.vala +++ b/src/menubar.vala @@ -94,8 +94,6 @@ public class MenuBar : Gtk.MenuBar public Gtk.Window? keyboard_window { get; private set; default = null; } public Gtk.AccelGroup? accel_group { get; construct; } - private const int HEIGHT = 32; - public MenuBar (Background bg, Gtk.AccelGroup ag) { Object (background: bg, accel_group: ag); @@ -305,8 +303,9 @@ public class MenuBar : Gtk.MenuBar public override void get_preferred_height (out int min, out int nat) { - min = HEIGHT; - nat = HEIGHT; + var greeter = new ArcticaGreeter (); + min = (int)Math.round(greeter.menubar_height - 8); + nat = (int)Math.round(greeter.menubar_height - 8); } private Indicator.Object? load_indicator_file (string indicator_name) diff --git a/src/prompt-box.vala b/src/prompt-box.vala index 97c95ba..071c34a 100644 --- a/src/prompt-box.vala +++ b/src/prompt-box.vala @@ -96,6 +96,8 @@ public class PromptBox : FadableBox construct { + var greeter = new ArcticaGreeter(); + set_start_row (); reset_last_row (); expand = true; @@ -107,7 +109,7 @@ public class PromptBox : FadableBox box_grid = new Gtk.Grid (); box_grid.column_spacing = 4; box_grid.row_spacing = 3; - box_grid.margin_top = GreeterList.BORDER; + box_grid.margin_top = (int)(GreeterList.BORDER * greeter.scaling_factor_widgets); box_grid.margin_bottom = 6; box_grid.expand = true; @@ -123,7 +125,7 @@ public class PromptBox : FadableBox active_indicator = new ActiveIndicator (); active_indicator.valign = Gtk.Align.START; - active_indicator.margin_top = (grid_size - ActiveIndicator.HEIGHT) / 2; + active_indicator.margin_top = (greeter.grid_size - ActiveIndicator.HEIGHT) / 2; active_indicator.show (); box_grid.attach (active_indicator, COL_ACTIVE, last_row, 1, 1); @@ -148,7 +150,7 @@ public class PromptBox : FadableBox small_active_indicator = new ActiveIndicator (); small_active_indicator.valign = Gtk.Align.START; - small_active_indicator.margin_top = (grid_size - ActiveIndicator.HEIGHT) / 2; + small_active_indicator.margin_top = (greeter.grid_size - ActiveIndicator.HEIGHT) / 2; small_active_indicator.show (); small_box_grid.attach (small_active_indicator, 0, 0, 1, 1); @@ -231,12 +233,14 @@ public class PromptBox : FadableBox debug ("Internal error setting color on name label: %s", e.message); } + var greeter = new ArcticaGreeter(); + name_label.valign = Gtk.Align.START; name_label.vexpand = true; name_label.yalign = 0.5f; name_label.xalign = 0.0f; name_label.margin_start = 2; - name_label.set_size_request (-1, grid_size); + name_label.set_size_request (-1, greeter.grid_size); name_label.show (); name_grid.attach (name_label, COL_NAME_LABEL, ROW_NAME, 1, 1); @@ -245,7 +249,7 @@ public class PromptBox : FadableBox var align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f); align.valign = Gtk.Align.START; - align.set_size_request (-1, grid_size); + align.set_size_request (-1, greeter.grid_size); align.add (message_image); align.show (); name_grid.attach (align, COL_NAME_MESSAGE, ROW_NAME, 1, 1); @@ -327,11 +331,13 @@ public class PromptBox : FadableBox debug ("Internal error loading font style (%s, %dpt): %s", font_family, font_size, e.message); } + var greeter = new ArcticaGreeter(); + small_name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); small_name_label.yalign = 0.5f; small_name_label.xalign = 0.0f; small_name_label.margin_start = 2; - small_name_label.set_size_request (-1, grid_size); + small_name_label.set_size_request (-1, greeter.grid_size); small_name_label.show (); small_name_grid.attach (small_name_label, 1, 0, 1, 1); @@ -339,7 +345,7 @@ public class PromptBox : FadableBox small_message_image.set_from_icon_name("mail-unread", Gtk.IconSize.BUTTON); var align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f); - align.set_size_request (-1, grid_size); + align.set_size_request (-1, greeter.grid_size); align.add (small_message_image); align.show (); small_name_grid.attach (align, 2, 0, 1, 1); @@ -361,22 +367,28 @@ public class PromptBox : FadableBox #if HAVE_GTK_3_20_0 private int round_to_grid (int size) { - var num_grids = size / grid_size; - var remainder = size % grid_size; + var greeter = new ArcticaGreeter(); + + var num_grids = size / greeter.grid_size; + var remainder = size % greeter.grid_size; if (remainder > 0) num_grids += 1; num_grids = int.max (num_grids, 3); - return num_grids * grid_size; + return num_grids * greeter.grid_size; } public override void get_preferred_height (out int min, out int nat) { base.get_preferred_height (out min, out nat); - min = round_to_grid (min + GreeterList.BORDER * 2) - GreeterList.BORDER * 2; - nat = round_to_grid (nat + GreeterList.BORDER * 2) - GreeterList.BORDER * 2; + + var greeter = new ArcticaGreeter(); + + int double_border_scaled = (int)(GreeterList.BORDER * greeter.scaling_factor_widgets * 2); + min = round_to_grid (min + double_border_scaled) - double_border_scaled; + nat = round_to_grid (nat + double_border_scaled) - double_border_scaled; if (position <= -1 || position >= 1) - min = nat = grid_size; + min = nat = greeter.grid_size; } #endif @@ -849,13 +861,15 @@ private class ActiveIndicator : Gtk.Image public override void get_preferred_width (out int min, out int nat) { - min = WIDTH; + var greeter = new ArcticaGreeter(); + min = (int)Math.round(WIDTH * greeter.scaling_factor_widgets); nat = min; } public override void get_preferred_height (out int min, out int nat) { - min = HEIGHT; + var greeter = new ArcticaGreeter(); + min = (int)Math.round(HEIGHT * greeter.scaling_factor_widgets); nat = min; } diff --git a/src/session-list.vala b/src/session-list.vala index 5149cc5..c4e865f 100644 --- a/src/session-list.vala +++ b/src/session-list.vala @@ -298,8 +298,11 @@ public class SessionList : GreeterList { try { + var greeter = new ArcticaGreeter(); + pixbuf = new Gdk.Pixbuf.from_file_at_size (Path.build_filename (Config.PKGDATADIR, name, null), - BADGE_SIZE * _scale_factor, BADGE_SIZE * _scale_factor); + (int)(BADGE_SIZE * _scale_factor * greeter.scaling_factor_widgets), + (int)(BADGE_SIZE * _scale_factor * greeter.scaling_factor_widgets)); badges.insert (name, pixbuf); } catch (Error e) diff --git a/src/settings.vala b/src/settings.vala index ea1db9d..1f046d4 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -77,6 +77,7 @@ public class AGSettings : Object public const string KEY_FLATBUTTON_BORDERCOLOR = "flatbutton-bordercolor"; public const string KEY_ENABLE_HIDPI = "enable-hidpi"; public const string KEY_FONT_SCALING = "font-scaling"; + public const string KEY_WIDGET_SCALING = "widget-scaling"; public const string KEY_MENUBAR_ALPHA = "menubar-alpha"; public const string KEY_HIDE_DEFAULT_XSESSION = "hide-default-xsession"; public const string KEY_HIDE_X11_SESSIONS = "hide-x11-sessions"; |