From 5ffd6d93a5f1120f7b2295b377d7a938394a7702 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 6 Feb 2023 10:47:24 +0100 Subject: .patches-to-be-ported-from-slick-greeter/: ToDo: check whether to port this Slick Greeter patches to Arctica Greeter. --- ...to-span-background-across-multiple-monito.patch | 329 +++++++++++++++++++++ .../0027-Rename-simplify-background-mode.patch | 93 ++++++ ...Allow-wayland-sessions-to-pass-validation.patch | 43 +++ 3 files changed, 465 insertions(+) create mode 100644 .patches-to-be-ported-from-slick-greeter/0025-Add-option-to-span-background-across-multiple-monito.patch create mode 100644 .patches-to-be-ported-from-slick-greeter/0027-Rename-simplify-background-mode.patch create mode 100644 .patches-to-be-ported-from-slick-greeter/0062-Allow-wayland-sessions-to-pass-validation.patch (limited to '.patches-to-be-ported-from-slick-greeter') diff --git a/.patches-to-be-ported-from-slick-greeter/0025-Add-option-to-span-background-across-multiple-monito.patch b/.patches-to-be-ported-from-slick-greeter/0025-Add-option-to-span-background-across-multiple-monito.patch new file mode 100644 index 0000000..5453a96 --- /dev/null +++ b/.patches-to-be-ported-from-slick-greeter/0025-Add-option-to-span-background-across-multiple-monito.patch @@ -0,0 +1,329 @@ +From 293fa0d6a596ba9f1e9dd78a3da171fea3110b84 Mon Sep 17 00:00:00 2001 +From: Geoff Paul +Date: Sat, 7 Mar 2020 14:07:01 -0600 +Subject: [PATCH 25/81] Add option to span background across multiple monitors + +Signed-off-by: Mike Gabriel +--- + data/x.dm.slick-greeter.gschema.xml | 8 +++ + src/background.vala | 87 ++++++++++++++++++++++------- + src/greeter-list.vala | 1 - + src/main-window.vala | 22 +------- + src/settings.vala | 2 + + 5 files changed, 81 insertions(+), 39 deletions(-) + +diff --git a/data/x.dm.slick-greeter.gschema.xml b/data/x.dm.slick-greeter.gschema.xml +index 90ebec8..7ceba14 100644 +--- a/data/x.dm.slick-greeter.gschema.xml ++++ b/data/x.dm.slick-greeter.gschema.xml +@@ -9,6 +9,14 @@ + '#000000' + Background color (e.g. #772953), set before wallpaper is seen + ++ ++ ++ ++ ++ ++ 'zoom' ++ Determines how the background image is rendered ++ + + true + Whether to draw user backgrounds +diff --git a/src/background.vala b/src/background.vala +index f0789bf..e258d84 100644 +--- a/src/background.vala ++++ b/src/background.vala +@@ -29,7 +29,6 @@ class BackgroundLoader : Object + public Gdk.RGBA average_color; + + private Cairo.Surface target_surface; +- private bool draw_grid; + private Thread thread; + private Gdk.Pixbuf[] images; + private bool finished; +@@ -37,7 +36,7 @@ class BackgroundLoader : Object + + public signal void loaded (); + +- public BackgroundLoader (Cairo.Surface target_surface, string filename, int[] widths, int[] heights, bool draw_grid) ++ public BackgroundLoader (Cairo.Surface target_surface, string filename, int[] widths, int[] heights) + { + this.target_surface = target_surface; + this.filename = filename; +@@ -45,7 +44,6 @@ class BackgroundLoader : Object + this.heights = heights; + patterns = new Cairo.Pattern[widths.length]; + images = new Gdk.Pixbuf[widths.length]; +- this.draw_grid = draw_grid; + } + + public bool load () +@@ -388,11 +386,14 @@ public class Monitor + + public class Background : Gtk.Fixed + { ++ [Flags] + public enum DrawFlags + { + NONE, + GRID, ++ SPAN, + } ++ private DrawFlags flags = DrawFlags.NONE; + + /* Fallback color - shown upon first startup, until an async background loader finishes, + * or until a user background or default background is loaded. +@@ -464,7 +465,28 @@ public class Background : Gtk.Fixed + } + } + +- public bool draw_grid { get; set; default = true; } ++ /* Width - total pixel width of the entire background canvas. This total width ++ * should account for the relative geometry of all attached monitors. ++ */ ++ ++ private int _width = 0; ++ public int width { ++ get { ++ return _width; ++ } ++ } ++ ++ /* Height - total pixel height of the entire background canvas. This total height ++ * should account for the relative geometry of all attached monitors. ++ */ ++ ++ private int _height = 0; ++ public int height { ++ get { ++ return _height; ++ } ++ } ++ + public double alpha { get; private set; default = 1.0; } + public Gdk.RGBA average_color { get { return current.average_color; } } + +@@ -493,8 +515,13 @@ public class Background : Gtk.Fixed + timer = null; + + resize_mode = Gtk.ResizeMode.QUEUE; +- draw_grid = UGSettings.get_boolean (UGSettings.KEY_DRAW_GRID); + loaders = new HashTable (str_hash, str_equal); ++ if (UGSettings.get_boolean (UGSettings.KEY_DRAW_GRID)) ++ flags |= DrawFlags.GRID; ++ ++ var mode = UGSettings.get_string (UGSettings.KEY_BACKGROUND_MODE); ++ if (mode == "spanned") ++ flags |= DrawFlags.SPAN; + + show (); + } +@@ -545,7 +572,15 @@ public class Background : Gtk.Fixed + { + this.monitors = new List (); + foreach (var m in monitors) ++ { ++ if (_width < m.x + m.width) ++ _width = m.x + m.width; ++ ++ if (_height < m.y + m.height) ++ _height = m.y + m.height; ++ + this.monitors.append (m); ++ } + queue_draw (); + } + +@@ -577,9 +612,6 @@ public class Background : Gtk.Fixed + + public override bool draw (Cairo.Context c) + { +- var flags = DrawFlags.NONE; +- if (draw_grid) +- flags |= DrawFlags.GRID; + draw_full (c, flags); + return base.draw (c); + } +@@ -625,7 +657,7 @@ public class Background : Gtk.Fixed + + c.restore (); + +- if ((flags & DrawFlags.GRID) != 0) ++ if (DrawFlags.GRID in flags) + overlay_grid (c); + } + +@@ -633,14 +665,22 @@ public class Background : Gtk.Fixed + { + foreach (var monitor in monitors) + { +- var pattern = background.get_pattern (monitor.width, monitor.height); ++ Cairo.Pattern? pattern; ++ var matrix = Cairo.Matrix.identity (); ++ if (DrawFlags.SPAN in flags) ++ { ++ pattern = background.get_pattern (_width, _height); ++ } ++ else ++ { ++ pattern = background.get_pattern (monitor.width, monitor.height); ++ matrix.translate (-monitor.x, -monitor.y); ++ } ++ + if (pattern == null) + continue; + + c.save (); +- pattern = background.get_pattern (monitor.width, monitor.height); +- var matrix = Cairo.Matrix.identity (); +- matrix.translate (-monitor.x, -monitor.y); + pattern.set_matrix (matrix); + c.set_source (pattern); + c.rectangle (monitor.x, monitor.y, monitor.width, monitor.height); +@@ -728,19 +768,28 @@ public class Background : Gtk.Fixed + var widths = new int[monitors.length ()]; + var heights = new int[monitors.length ()]; + var n_sizes = 0; +- foreach (var monitor in monitors) ++ if (DrawFlags.SPAN in flags) ++ { ++ widths[n_sizes] = _width; ++ heights[n_sizes] = _height; ++ n_sizes++; ++ } ++ else + { +- if (monitor_is_unique_size (monitor)) ++ foreach (var monitor in monitors) + { +- widths[n_sizes] = monitor.width; +- heights[n_sizes] = monitor.height; +- n_sizes++; ++ if (monitor_is_unique_size (monitor)) ++ { ++ widths[n_sizes] = monitor.width; ++ heights[n_sizes] = monitor.height; ++ n_sizes++; ++ } + } + } + widths.resize (n_sizes); + heights.resize (n_sizes); + +- b = new BackgroundLoader (target_surface, filename, widths, heights, draw_grid); ++ b = new BackgroundLoader (target_surface, filename, widths, heights); + b.logo = version_logo_surface; + b.loaded.connect (() => { reload (); }); + b.load (); +diff --git a/src/greeter-list.vala b/src/greeter-list.vala +index 6d8f1f6..958720e 100644 +--- a/src/greeter-list.vala ++++ b/src/greeter-list.vala +@@ -928,7 +928,6 @@ public abstract class GreeterList : FadableBox + } + + /* Set the background */ +- background.draw_grid = false; + background.queue_draw (); + } + +diff --git a/src/main-window.vala b/src/main-window.vala +index ddd3c00..3c4fb2b 100644 +--- a/src/main-window.vala ++++ b/src/main-window.vala +@@ -32,8 +32,6 @@ public class MainWindow : Gtk.Window + private Gtk.Box hbox; + private Gtk.Button back_button; + private ShutdownDialog? shutdown_dialog = null; +- private int window_size_x; +- private int window_size_y; + private bool do_resize; + + public ListStack stack; +@@ -131,8 +129,6 @@ public class MainWindow : Gtk.Window + + add_user_list (); + +- window_size_x = 0; +- window_size_y = 0; + primary_monitor = null; + do_resize = false; + +@@ -147,7 +143,7 @@ public class MainWindow : Gtk.Window + monitors.append (new Monitor (800, 120, 640, 480)); + background.set_monitors (monitors); + move_to_monitor (monitors.nth_data (0)); +- resize (800 + 640, 600); ++ resize (background.width, background.height); + } + else + { +@@ -212,7 +208,7 @@ public class MainWindow : Gtk.Window + /* Setup the size and position of the window */ + public void setup_window () + { +- resize (window_size_x, window_size_y); ++ resize (background.width, background.height); + move (0, 0); + move_to_monitor (primary_monitor); + } +@@ -223,8 +219,6 @@ public class MainWindow : Gtk.Window + Gdk.Monitor primary = display.get_primary_monitor(); + Gdk.Rectangle geometry; + +- window_size_x = 0; +- window_size_y = 0; + monitors = new List (); + primary_monitor = null; + +@@ -234,16 +228,6 @@ public class MainWindow : Gtk.Window + geometry = monitor.get_geometry (); + debug ("Monitor %d is %dx%d pixels at %d,%d", i, geometry.width, geometry.height, geometry.x, geometry.y); + +- if (window_size_x < geometry.x + geometry.width) +- { +- window_size_x = geometry.x + geometry.width; +- } +- +- if (window_size_y < geometry.y + geometry.height) +- { +- window_size_y = geometry.y + geometry.height; +- } +- + if (monitor_is_unique_position (display, i)) + { + var greeter_monitor = new Monitor (geometry.x, geometry.y, geometry.width, geometry.height); +@@ -258,7 +242,7 @@ public class MainWindow : Gtk.Window + } + } + +- debug ("MainWindow is %dx%d pixels", window_size_x, window_size_y); ++ debug ("MainWindow is %dx%d pixels", background.width, background.height); + + background.set_monitors (monitors); + +diff --git a/src/settings.vala b/src/settings.vala +index 7d43449..3822939 100644 +--- a/src/settings.vala ++++ b/src/settings.vala +@@ -22,6 +22,7 @@ public class UGSettings + { + public const string KEY_BACKGROUND = "background"; + public const string KEY_BACKGROUND_COLOR = "background-color"; ++ public const string KEY_BACKGROUND_MODE = "background-mode"; + public const string KEY_DRAW_USER_BACKGROUNDS = "draw-user-backgrounds"; + public const string KEY_DRAW_GRID = "draw-grid"; + public const string KEY_SHOW_HOSTNAME = "show-hostname"; +@@ -119,6 +120,7 @@ public class UGSettings + var string_keys = new List (); + string_keys.append (KEY_BACKGROUND); + string_keys.append (KEY_BACKGROUND_COLOR); ++ string_keys.append (KEY_BACKGROUND_MODE); + string_keys.append (KEY_LOGO); + string_keys.append (KEY_OTHER_MONITORS_LOGO); + string_keys.append (KEY_THEME_NAME); +-- +2.30.2 + diff --git a/.patches-to-be-ported-from-slick-greeter/0027-Rename-simplify-background-mode.patch b/.patches-to-be-ported-from-slick-greeter/0027-Rename-simplify-background-mode.patch new file mode 100644 index 0000000..943c0b8 --- /dev/null +++ b/.patches-to-be-ported-from-slick-greeter/0027-Rename-simplify-background-mode.patch @@ -0,0 +1,93 @@ +From 046bbee24412982cdf7c77224036d6e657193662 Mon Sep 17 00:00:00 2001 +From: Clement Lefebvre +Date: Tue, 12 May 2020 11:04:08 +0100 +Subject: [PATCH 27/81] Rename/simplify background mode + +We only care whether the background is stretched across multiple monitors +or not, let's be explicit and make it clear. + +Signed-off-by: Mike Gabriel +--- + README.md | 1 + + data/x.dm.slick-greeter.gschema.xml | 10 +++------- + src/background.vala | 3 +-- + src/settings.vala | 4 ++-- + 4 files changed, 7 insertions(+), 11 deletions(-) + +diff --git a/README.md b/README.md +index a286568..844dacd 100644 +--- a/README.md ++++ b/README.md +@@ -59,4 +59,5 @@ Configuration file format for /etc/lightdm/slick-greeter.conf + # group-filter=List of groups that users must be part of to be shown (empty list shows all users) + # enable-hidpi=Whether to enable HiDPI support (on/off/auto) + # only-on-monitor=Sets the monitor on which to show the login window, -1 means "follow the mouse" ++ # stretch-background-across-monitors=Whether to stretch the background across multiple monitors (false by default) + [Greeter] +diff --git a/data/x.dm.slick-greeter.gschema.xml b/data/x.dm.slick-greeter.gschema.xml +index 7ceba14..07065bc 100644 +--- a/data/x.dm.slick-greeter.gschema.xml ++++ b/data/x.dm.slick-greeter.gschema.xml +@@ -9,13 +9,9 @@ + '#000000' + Background color (e.g. #772953), set before wallpaper is seen + +- +- +- +- +- +- 'zoom' +- Determines how the background image is rendered ++ ++ false ++ Whether to stretch the background across multiple monitors (or to replicate it on each monitor). + + + true +diff --git a/src/background.vala b/src/background.vala +index e258d84..f076b71 100644 +--- a/src/background.vala ++++ b/src/background.vala +@@ -519,8 +519,7 @@ public class Background : Gtk.Fixed + if (UGSettings.get_boolean (UGSettings.KEY_DRAW_GRID)) + flags |= DrawFlags.GRID; + +- var mode = UGSettings.get_string (UGSettings.KEY_BACKGROUND_MODE); +- if (mode == "spanned") ++ if (UGSettings.get_boolean (UGSettings.KEY_BACKGROUND_STRETCH)) + flags |= DrawFlags.SPAN; + + show (); +diff --git a/src/settings.vala b/src/settings.vala +index 3822939..36aa88e 100644 +--- a/src/settings.vala ++++ b/src/settings.vala +@@ -22,7 +22,7 @@ public class UGSettings + { + public const string KEY_BACKGROUND = "background"; + public const string KEY_BACKGROUND_COLOR = "background-color"; +- public const string KEY_BACKGROUND_MODE = "background-mode"; ++ public const string KEY_BACKGROUND_STRETCH = "stretch-background-across-monitors"; + public const string KEY_DRAW_USER_BACKGROUNDS = "draw-user-backgrounds"; + public const string KEY_DRAW_GRID = "draw-grid"; + public const string KEY_SHOW_HOSTNAME = "show-hostname"; +@@ -120,7 +120,6 @@ public class UGSettings + var string_keys = new List (); + string_keys.append (KEY_BACKGROUND); + string_keys.append (KEY_BACKGROUND_COLOR); +- string_keys.append (KEY_BACKGROUND_MODE); + string_keys.append (KEY_LOGO); + string_keys.append (KEY_OTHER_MONITORS_LOGO); + string_keys.append (KEY_THEME_NAME); +@@ -134,6 +133,7 @@ public class UGSettings + + var bool_keys = new List (); + bool_keys.append (KEY_DRAW_USER_BACKGROUNDS); ++ bool_keys.append (KEY_BACKGROUND_STRETCH); + bool_keys.append (KEY_DRAW_GRID); + bool_keys.append (KEY_SHOW_HOSTNAME); + bool_keys.append (KEY_SHOW_POWER); +-- +2.30.2 + diff --git a/.patches-to-be-ported-from-slick-greeter/0062-Allow-wayland-sessions-to-pass-validation.patch b/.patches-to-be-ported-from-slick-greeter/0062-Allow-wayland-sessions-to-pass-validation.patch new file mode 100644 index 0000000..e3c4889 --- /dev/null +++ b/.patches-to-be-ported-from-slick-greeter/0062-Allow-wayland-sessions-to-pass-validation.patch @@ -0,0 +1,43 @@ +From e6a649d20b926e9b82ea21af384c997636a90c9e Mon Sep 17 00:00:00 2001 +From: Ivan Podogov +Date: Wed, 28 Dec 2022 12:35:51 +0000 +Subject: [PATCH 62/81] Allow wayland sessions to pass validation + +This makes slick-greeter properly remember the last wayland session instead of defaulting to an xsession. + +Signed-off-by: Mike Gabriel +--- + src/slick-greeter.vala | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/slick-greeter.vala b/src/slick-greeter.vala +index d1b9815..44661b5 100644 +--- a/src/slick-greeter.vala ++++ b/src/slick-greeter.vala +@@ -204,6 +204,13 @@ public class SlickGreeter + } + } + ++ foreach (string session in sessions) { ++ var path = Path.build_filename ("/usr/share/wayland-sessions/", session.concat(".desktop"), null); ++ if (FileUtils.test (path, FileTest.EXISTS)) { ++ return session; ++ } ++ } ++ + warning ("Could not find a default session."); + return null; + } +@@ -214,7 +221,8 @@ public class SlickGreeter + otherwise, return the default session. */ + if (session != null) { + var path = Path.build_filename ("/usr/share/xsessions/", session.concat(".desktop"), null); +- if (!FileUtils.test (path, FileTest.EXISTS) ) { ++ var waypath = Path.build_filename ("/usr/share/wayland-sessions/", session.concat(".desktop"), null); ++ if (!FileUtils.test (path, FileTest.EXISTS) & !FileUtils.test (waypath, FileTest.EXISTS)) { + debug ("Invalid session: '%s'", session); + session = null; + } +-- +2.30.2 + -- cgit v1.2.3