From c5f16ead014454267163f4a8a65f8178fc7369c9 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Tue, 17 Jan 2023 15:54:28 +0000 Subject: user-list: Allow hidden user visibility to be toggled. Ported from Slick Greeter by Mike Gabriel. https://github.com/linuxmint/slick-greeter/commit/ce8704c02498fef137908e36b315d0876300d2c2 --- src/main-window.vala | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main-window.vala b/src/main-window.vala index 614014d..5dd5a9a 100644 --- a/src/main-window.vala +++ b/src/main-window.vala @@ -363,19 +363,16 @@ public class MainWindow : Gtk.Window if (stack.top () is UserList) { var user_list = stack.top () as UserList; - if (!user_list.show_hidden_users) + var shift_mask = Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK; + var control_mask = Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.MOD1_MASK; + var alt_mask = Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK; + if (((event.keyval == Gdk.Key.Shift_L || event.keyval == Gdk.Key.Shift_R) && (event.state & shift_mask) == shift_mask) || + ((event.keyval == Gdk.Key.Control_L || event.keyval == Gdk.Key.Control_R) && (event.state & control_mask) == control_mask) || + ((event.keyval == Gdk.Key.Alt_L || event.keyval == Gdk.Key.Alt_R) && (event.state & alt_mask) == alt_mask)) { - var shift_mask = Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK; - var control_mask = Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.MOD1_MASK; - var alt_mask = Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK; - if (((event.keyval == Gdk.Key.Shift_L || event.keyval == Gdk.Key.Shift_R) && (event.state & shift_mask) == shift_mask) || - ((event.keyval == Gdk.Key.Control_L || event.keyval == Gdk.Key.Control_R) && (event.state & control_mask) == control_mask) || - ((event.keyval == Gdk.Key.Alt_L || event.keyval == Gdk.Key.Alt_R) && (event.state & alt_mask) == alt_mask)) - { - debug ("Hidden user key combination detected"); - user_list.show_hidden_users = true; - return true; - } + debug ("Hidden user key combination detected"); + user_list.show_hidden_users = ! user_list.show_hidden_users; + return true; } } else if (stack.top () is SessionList) { -- cgit v1.2.3