Allow vendor nvidia driver users the ability to pick wayland sessions without editing udev

This commit is contained in:
Ray Strode 2021-07-22 16:30:32 -04:00
parent 9e50e3efdf
commit 1b45c3bcef
4 changed files with 2524 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,131 @@
From b8adb4f610ab285d1c0b9e7bd4d0e2dc64f3e821 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 20 Jul 2021 13:36:45 -0400
Subject: [PATCH 2/3] libgdm: Sort session list
Right now the session list comes out in hash table order.
This commit changes the code to sort by description.
---
libgdm/gdm-sessions.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c
index 97ed5ef3..f078e04b 100644
--- a/libgdm/gdm-sessions.c
+++ b/libgdm/gdm-sessions.c
@@ -311,92 +311,111 @@ collect_sessions (void)
g_ptr_array_add (wayland_search_array, g_strdup (wayland_search_dirs[i]));
}
#endif
if (gdm_available_sessions_map == NULL) {
gdm_available_sessions_map = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify)gdm_session_file_free);
}
if (!supported_session_types || g_strv_contains ((const char * const *) supported_session_types, "x11")) {
for (i = 0; i < xorg_search_array->len; i++) {
collect_sessions_from_directory (g_ptr_array_index (xorg_search_array, i));
}
}
#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++) {
collect_sessions_from_directory (g_ptr_array_index (wayland_search_array, i));
}
}
#endif
#endif
g_hash_table_foreach_remove (gdm_available_sessions_map,
remove_duplicate_sessions,
names_seen_before);
}
+static gint
+compare_session_ids (gconstpointer a,
+ gconstpointer b)
+{
+ GdmSessionFile *session_a, *session_b;
+ session_a = (GdmSessionFile *) g_hash_table_lookup (gdm_available_sessions_map, a);
+ session_b = (GdmSessionFile *) g_hash_table_lookup (gdm_available_sessions_map, b);
+
+ if (session_a == NULL)
+ return -1;
+
+ if (session_b == NULL)
+ return 1;
+
+ return g_strcmp0 (session_a->translated_name, session_b->translated_name);
+}
+
/**
* gdm_get_session_ids:
*
* Reads /usr/share/xsessions and other relevant places for possible sessions
* to log into and returns the complete list.
*
* Returns: (transfer full): a %NULL terminated list of session ids
*/
char **
gdm_get_session_ids (void)
{
GHashTableIter iter;
gpointer key, value;
GPtrArray *array;
if (!gdm_sessions_map_is_initialized) {
collect_sessions ();
gdm_sessions_map_is_initialized = TRUE;
}
array = g_ptr_array_new ();
g_hash_table_iter_init (&iter, gdm_available_sessions_map);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GdmSessionFile *session;
session = (GdmSessionFile *) value;
g_ptr_array_add (array, g_strdup (session->id));
}
g_ptr_array_add (array, NULL);
+ g_ptr_array_sort (array, compare_session_ids);
+
return (char **) g_ptr_array_free (array, FALSE);
}
/**
* gdm_get_session_name_and_description:
* @id: an id from gdm_get_session_ids()
* @description: (out): optional returned session description
*
* Takes an xsession id and returns the name and comment about it.
*
* Returns: The session name if found, or %NULL otherwise
*/
char *
gdm_get_session_name_and_description (const char *id,
char **description)
{
GdmSessionFile *session;
char *name;
if (!gdm_sessions_map_is_initialized) {
collect_sessions ();
gdm_sessions_map_is_initialized = TRUE;
}
session = (GdmSessionFile *) g_hash_table_lookup (gdm_available_sessions_map,
id);
if (session == NULL) {
return NULL;
--
2.32.0

View File

@ -0,0 +1,118 @@
From f067fb9bc471f176b6f6693fd9da5307c35bac3c Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 22 Jul 2021 14:46:50 -0400
Subject: [PATCH 3/3] local-display-factory: Fix overrun in session type list
generation
Some confusion in the session type list generation from GNOME/gdm!146,
means we could actually overrun the list.
This commit fixes that.
---
daemon/gdm-local-display-factory.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 0bb3851f..f2da3b6e 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -202,87 +202,89 @@ get_preferred_display_server (GdmLocalDisplayFactory *factory)
gdm_settings_direct_get_string (GDM_KEY_PREFERRED_DISPLAY_SERVER, &preferred_display_server);
if (g_strcmp0 (preferred_display_server, "wayland") == 0) {
if (wayland_enabled)
return g_strdup (preferred_display_server);
else
return g_strdup ("xorg");
}
if (g_strcmp0 (preferred_display_server, "xorg") == 0) {
if (xorg_enabled)
return g_strdup (preferred_display_server);
else
return g_strdup ("wayland");
}
if (g_strcmp0 (preferred_display_server, "legacy-xorg") == 0) {
if (xorg_enabled)
return g_strdup (preferred_display_server);
}
return g_strdup ("none");
}
static const char *
gdm_local_display_factory_get_session_type (GdmLocalDisplayFactory *factory,
gboolean should_fall_back)
{
const char *session_types[3] = { NULL };
- gsize i, session_type_index = 0, number_of_session_types = 0;
+ gsize i, session_type_index = 0;
g_autofree gchar *preferred_display_server = NULL;
preferred_display_server = get_preferred_display_server (factory);
if (g_strcmp0 (preferred_display_server, "wayland") != 0 &&
g_strcmp0 (preferred_display_server, "xorg") != 0)
return NULL;
for (i = 0; i < G_N_ELEMENTS (session_types) - 1; i++) {
#ifdef ENABLE_WAYLAND_SUPPORT
- if (number_of_session_types > 0 ||
+ if (i > 0 ||
g_strcmp0 (preferred_display_server, "wayland") == 0) {
gboolean wayland_enabled = FALSE;
if (gdm_settings_direct_get_boolean (GDM_KEY_WAYLAND_ENABLE, &wayland_enabled)) {
- if (wayland_enabled && g_file_test ("/usr/bin/Xwayland", G_FILE_TEST_IS_EXECUTABLE) )
- session_types[number_of_session_types++] = "wayland";
+ if (wayland_enabled && g_file_test ("/usr/bin/Xwayland", G_FILE_TEST_IS_EXECUTABLE)) {
+ session_types[i] = "wayland";
+ }
}
}
#endif
- if (number_of_session_types > 0 ||
+ if (i > 0 ||
g_strcmp0 (preferred_display_server, "xorg") == 0) {
gboolean xorg_enabled = FALSE;
if (gdm_settings_direct_get_boolean (GDM_KEY_XORG_ENABLE, &xorg_enabled)) {
- if (xorg_enabled && g_file_test ("/usr/bin/Xorg", G_FILE_TEST_IS_EXECUTABLE) )
- session_types[number_of_session_types++] = "x11";
+ if (xorg_enabled && g_file_test ("/usr/bin/Xorg", G_FILE_TEST_IS_EXECUTABLE)) {
+ session_types[i] = "x11";
+ }
}
}
}
if (should_fall_back)
session_type_index++;
return session_types[session_type_index];
}
static void
on_display_disposed (GdmLocalDisplayFactory *factory,
GdmDisplay *display)
{
g_debug ("GdmLocalDisplayFactory: Display %p disposed", display);
}
static void
store_display (GdmLocalDisplayFactory *factory,
GdmDisplay *display)
{
GdmDisplayStore *store;
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
gdm_display_store_add (store, display);
}
/*
Example:
dbus-send --system --dest=org.gnome.DisplayManager \
--
2.32.0

View File

@ -11,7 +11,7 @@
Name: gdm Name: gdm
Epoch: 1 Epoch: 1
Version: 40.0 Version: 40.0
Release: 3%{?dist} Release: 4%{?dist}
Summary: The GNOME Display Manager Summary: The GNOME Display Manager
License: GPLv2+ License: GPLv2+
@ -22,6 +22,11 @@ Source1: org.gnome.login-screen.gschema.override
# moved here from pulseaudio-gdm-hooks-11.1-16 # moved here from pulseaudio-gdm-hooks-11.1-16
Source5: default.pa-for-gdm Source5: default.pa-for-gdm
# Already upstream, waiting on a release
Patch10001: 0001-daemon-Provide-more-flexibility-for-configuring-disp.patch
Patch10002: 0002-libgdm-Sort-session-list.patch
Patch10003: 0003-local-display-factory-Fix-overrun-in-session-type-li.patch
# Downstream patches # Downstream patches
Patch80001: 0001-Honor-initial-setup-being-disabled-by-distro-install.patch Patch80001: 0001-Honor-initial-setup-being-disabled-by-distro-install.patch
Patch90001: 0001-data-add-system-dconf-databases-to-gdm-profile.patch Patch90001: 0001-data-add-system-dconf-databases-to-gdm-profile.patch
@ -302,6 +307,10 @@ fi
%{_libdir}/pkgconfig/gdm-pam-extensions.pc %{_libdir}/pkgconfig/gdm-pam-extensions.pc
%changelog %changelog
* Thu Jul 22 2021 Ray Strode <rstrode@redhat.com> - 1:40.0-4
- Allow vendor nvidia driver users the ability to pick wayland sessions
without editing udev
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:40.0-3 * Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:40.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild