A few clean ups and fixes in session selection patch

Related: #1985099
This commit is contained in:
Ray Strode 2021-07-28 10:31:42 -04:00
parent 1b44d3556e
commit 224724693b
2 changed files with 94 additions and 23 deletions

View File

@ -1,4 +1,4 @@
From bcf156120aa89cd9ba22bf862c42611e7984e211 Mon Sep 17 00:00:00 2001 From 42958e082c611d2e2f466247e7d8759dfb5f607d Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com> From: Ray Strode <rstrode@redhat.com>
Date: Fri, 16 Jul 2021 12:34:57 -0400 Date: Fri, 16 Jul 2021 12:34:57 -0400
Subject: [PATCH] local-display-factory: Provide more flexibility for Subject: [PATCH] local-display-factory: Provide more flexibility for
@ -26,10 +26,10 @@ fall back to "wayland".
daemon/gdm-launch-environment.c | 9 ++ daemon/gdm-launch-environment.c | 9 ++
daemon/gdm-local-display-factory.c | 224 ++++++++++++++++++++++++----- daemon/gdm-local-display-factory.c | 224 ++++++++++++++++++++++++-----
daemon/gdm-manager.c | 11 +- daemon/gdm-manager.c | 11 +-
daemon/gdm-session.c | 109 +++++++------- daemon/gdm-session.c | 115 ++++++++-------
data/gdm.schemas.in | 10 ++ data/gdm.schemas.in | 10 ++
libgdm/gdm-sessions.c | 72 +++++++--- libgdm/gdm-sessions.c | 72 +++++++---
8 files changed, 355 insertions(+), 118 deletions(-) 8 files changed, 361 insertions(+), 118 deletions(-)
diff --git a/common/gdm-settings-keys.h b/common/gdm-settings-keys.h diff --git a/common/gdm-settings-keys.h b/common/gdm-settings-keys.h
index f0059b5c..87685d3c 100644 index f0059b5c..87685d3c 100644
@ -98,7 +98,7 @@ index f0059b5c..87685d3c 100644
#endif /* _GDM_SETTINGS_KEYS_H */ #endif /* _GDM_SETTINGS_KEYS_H */
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 3a260923..46d5a773 100644 index 3a260923..34467856 100644
--- a/daemon/gdm-display.c --- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c +++ b/daemon/gdm-display.c
@@ -66,83 +66,86 @@ typedef struct _GdmDisplayPrivate @@ -66,83 +66,86 @@ typedef struct _GdmDisplayPrivate
@ -227,8 +227,8 @@ index 3a260923..46d5a773 100644
+ GdmDisplayPrivate *priv; + GdmDisplayPrivate *priv;
+ g_autofree char *supported_session_types_string = NULL; + g_autofree char *supported_session_types_string = NULL;
+ +
+ if (supported_session_types != NULL) + if (supported_session_types != NULL)
+ supported_session_types_string = g_strjoinv (":", (GStrv) supported_session_types); + supported_session_types_string = g_strjoinv (":", (GStrv) supported_session_types);
+ +
+ priv = gdm_display_get_instance_private (self); + priv = gdm_display_get_instance_private (self);
+ g_debug ("GdmDisplay: supported session types: %s", supported_session_types_string); + g_debug ("GdmDisplay: supported session types: %s", supported_session_types_string);
@ -1436,7 +1436,7 @@ index 9c10adff..7c291013 100644
} }
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index a010cecf..9f5e1e3f 100644 index a010cecf..2b941e5e 100644
--- a/daemon/gdm-session.c --- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c +++ b/daemon/gdm-session.c
@@ -106,84 +106,81 @@ struct _GdmSession @@ -106,84 +106,81 @@ struct _GdmSession
@ -1617,21 +1617,21 @@ index a010cecf..9f5e1e3f 100644
- g_array_prepend_val (search_array, wayland_search_dir); - g_array_prepend_val (search_array, wayland_search_dir);
+ if (g_str_equal (supported_type, "wayland") && + if (g_str_equal (supported_type, "wayland") &&
+ (type == NULL || g_str_equal (type, supported_type))) { + (type == NULL || g_str_equal (type, supported_type))) {
+ g_array_append_val (search_array, wayland_search_dir);
- for (i = 0; system_data_dirs[i]; i++) {
- gchar *dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
- g_array_insert_val (search_array, i, dir);
- }
-#else
- for (i = 0; system_data_dirs[i]; i++) {
- gchar *dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
- g_array_append_val (search_array, dir);
+ for (i = 0; system_data_dirs[i]; i++) { + for (i = 0; system_data_dirs[i]; i++) {
+ gchar *dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL); + gchar *dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
+ g_array_append_val (search_array, dir); + g_array_append_val (search_array, dir);
+ } + }
- for (i = 0; system_data_dirs[i]; i++) {
- gchar *dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
- g_array_insert_val (search_array, i, dir);
+ g_array_append_val (search_array, wayland_search_dir);
} }
-#else
- for (i = 0; system_data_dirs[i]; i++) {
- gchar *dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
- g_array_append_val (search_array, dir);
- }
- -
- g_array_append_val (search_array, wayland_search_dir); - g_array_append_val (search_array, wayland_search_dir);
#endif #endif
@ -1667,7 +1667,74 @@ index a010cecf..9f5e1e3f 100644
GError *error = NULL; GError *error = NULL;
gboolean res; gboolean res;
char **search_dirs; char **search_dirs;
@@ -2230,68 +2235,72 @@ close_conversation (GdmSessionConversation *conversation) @@ -444,60 +449,66 @@ load_key_file_for_file (GdmSession *self,
g_debug ("GdmSession: %s", error->message);
g_error_free (error);
}
g_key_file_free (key_file);
key_file = NULL;
}
g_strfreev (search_dirs);
return key_file;
}
static gboolean
get_session_command_for_file (GdmSession *self,
const char *file,
const char *type,
char **command)
{
GKeyFile *key_file;
GError *error;
char *exec;
gboolean ret;
gboolean res;
exec = NULL;
ret = FALSE;
if (command != NULL) {
*command = NULL;
}
+ if (!supports_session_type (self, type)) {
+ g_debug ("GdmSession: ignoring %s session command request for file '%s'",
+ type, file);
+ goto out;
+ }
+
g_debug ("GdmSession: getting session command for file '%s'", file);
key_file = load_key_file_for_file (self, file, type, NULL);
if (key_file == NULL) {
goto out;
}
error = NULL;
res = g_key_file_get_boolean (key_file,
G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_HIDDEN,
&error);
if (error == NULL && res) {
g_debug ("GdmSession: Session %s is marked as hidden", file);
goto out;
}
exec = g_key_file_get_string (key_file,
G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_TRY_EXEC,
NULL);
if (exec != NULL) {
res = is_prog_in_path (exec);
g_free (exec);
exec = NULL;
if (! res) {
g_debug ("GdmSession: Command not found: %s",
G_KEY_FILE_DESKTOP_KEY_TRY_EXEC);
goto out;
}
@@ -2230,68 +2241,72 @@ close_conversation (GdmSessionConversation *conversation)
if (conversation->worker_manager_interface != NULL) { if (conversation->worker_manager_interface != NULL) {
unexport_worker_manager_interface (self, conversation->worker_manager_interface); unexport_worker_manager_interface (self, conversation->worker_manager_interface);
@ -1745,7 +1812,7 @@ index a010cecf..9f5e1e3f 100644
g_hash_table_insert (self->conversations, g_hash_table_insert (self->conversations,
g_strdup (service_name), conversation); g_strdup (service_name), conversation);
return TRUE; return TRUE;
@@ -3162,69 +3171,69 @@ gdm_session_get_session_id (GdmSession *self) @@ -3162,69 +3177,69 @@ gdm_session_get_session_id (GdmSession *self)
const char * const char *
gdm_session_get_conversation_session_id (GdmSession *self, gdm_session_get_conversation_session_id (GdmSession *self,
@ -1818,7 +1885,7 @@ index a010cecf..9f5e1e3f 100644
} else { } else {
set_session_type (self, NULL); set_session_type (self, NULL);
} }
@@ -3513,140 +3522,138 @@ gdm_session_set_property (GObject *object, @@ -3513,140 +3528,138 @@ gdm_session_set_property (GObject *object,
case PROP_DISPLAY_HOSTNAME: case PROP_DISPLAY_HOSTNAME:
set_display_hostname (self, g_value_get_string (value)); set_display_hostname (self, g_value_get_string (value));
break; break;
@ -1965,7 +2032,7 @@ index a010cecf..9f5e1e3f 100644
if (self->worker_server != NULL) { if (self->worker_server != NULL) {
g_dbus_server_stop (self->worker_server); g_dbus_server_stop (self->worker_server);
@@ -4007,69 +4014,67 @@ gdm_session_class_init (GdmSessionClass *session_class) @@ -4007,69 +4020,67 @@ gdm_session_class_init (GdmSessionClass *session_class)
PROP_DISPLAY_X11_AUTHORITY_FILE, PROP_DISPLAY_X11_AUTHORITY_FILE,
g_param_spec_string ("display-x11-authority-file", g_param_spec_string ("display-x11-authority-file",
"display x11 authority file", "display x11 authority file",
@ -2350,5 +2417,5 @@ index a1322505..f078e04b 100644
* Returns: (transfer full): a %NULL terminated list of session ids * Returns: (transfer full): a %NULL terminated list of session ids
*/ */
-- --
2.31.1 2.32.0

View File

@ -11,7 +11,7 @@
Name: gdm Name: gdm
Epoch: 1 Epoch: 1
Version: 40.1 Version: 40.1
Release: 1%{?dist} Release: 2%{?dist}
Summary: The GNOME Display Manager Summary: The GNOME Display Manager
License: GPLv2+ License: GPLv2+
@ -311,6 +311,10 @@ dconf update || :
%{_libdir}/pkgconfig/gdm-pam-extensions.pc %{_libdir}/pkgconfig/gdm-pam-extensions.pc
%changelog %changelog
* Wed Jul 28 2021 Ray Strode <rstrode@redhat.com> - 40.1-2
- A few clean ups and fixes in session selection patch
Related: #1985099
* Fri Jul 23 2021 Ray Strode <rstrode@redhat.com> - 40.1-1 * Fri Jul 23 2021 Ray Strode <rstrode@redhat.com> - 40.1-1
- Update to 40.1 - Update to 40.1
- Allow vendor nvidia users to choose wayland sessions - Allow vendor nvidia users to choose wayland sessions