diff options
author | Ray Strode <rstrode@redhat.com> | 2023-04-20 17:14:19 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2023-04-20 17:19:01 -0400 |
commit | c6e3d8d15c984fc3771022034f0e1ac8c167b70c (patch) | |
tree | 73f375e89e7f40d48b222f56634ed7bd86873cec | |
parent | 975edb85a1ccd290d9793089a606be9dce6dab6b (diff) | |
download | gdm-fix-session-hiding.tar.gz |
libgdm: Fix session loading precedencefix-session-hiding
One feature that GDM is supposed to support is a precedence order
for loading xsession files.
If someone has a file in /etc/X11/sessions it's supposed to override
a file in /usr/share/xsessions.
This works okay from a backend point of view. /etc/X11/sessions can
change the command getting run, for instance, but it doesn't work
from a front end point of view. Menu items can't get hidden in
the session cog.
This is due to a bug in libgdm where it inadvertently gives
/usr/share/xsessions higher precedence than /etc/X11/sessions.
This commit fixes that by processing the lists in reverse order,
and making sure to remove already added entries if overriding
entries are hidden.
-rw-r--r-- | libgdm/gdm-sessions.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c index d8b4d5cd..c3aeafdd 100644 --- a/libgdm/gdm-sessions.c +++ b/libgdm/gdm-sessions.c @@ -143,6 +143,7 @@ load_session_file (const char *id, if (!key_file_is_relevant (key_file)) { g_debug ("\"%s\" is hidden or contains non-executable TryExec program\n", path); + g_hash_table_remove (gdm_available_sessions_map, id); goto out; } @@ -322,7 +323,7 @@ collect_sessions (void) } if (!supported_session_types || g_strv_contains ((const char * const *) supported_session_types, "x11")) { - for (i = 0; i < xorg_search_array->len; i++) { + for (i = xorg_search_array->len - 1; i >= 0; i--) { collect_sessions_from_directory (g_ptr_array_index (xorg_search_array, i)); } } @@ -330,7 +331,7 @@ collect_sessions (void) #ifdef ENABLE_WAYLAND_SUPPORT #ifdef ENABLE_USER_DISPLAY_SERVER if (!supported_session_types || g_strv_contains ((const char * const *) supported_session_types, "wayland")) { - for (i = 0; i < wayland_search_array->len; i++) { + for (i = wayland_search_array->len - 1; i >= 0; i--) { collect_sessions_from_directory (g_ptr_array_index (wayland_search_array, i)); } } |