summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2002-08-07 08:15:03 +0000
committerGeorge Lebl <jirka@src.gnome.org>2002-08-07 08:15:03 +0000
commit8ec8e6d41420109c64bfd7582fdbc7f6e6f0469b (patch)
tree1eee44e23e666265795b0b32382c8c96acaa6ab1
parent6599b511635b55d348d72337db244a680c4577ab (diff)
downloadgdm-8ec8e6d41420109c64bfd7582fdbc7f6e6f0469b.tar.gz
when starting up a server as a different uid, add the font paths that the
Wed Aug 07 01:23:55 2002 George Lebl <jirka@5z.com> * daemon/server.c: when starting up a server as a different uid, add the font paths that the gnome-settings-daemon sets for that user. This fixes #89308.
-rw-r--r--ChangeLog6
-rw-r--r--daemon/server.c77
2 files changed, 83 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 640d4053..6ae8cb4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Aug 07 01:23:55 2002 George Lebl <jirka@5z.com>
+
+ * daemon/server.c: when starting up a server as a different uid, add
+ the font paths that the gnome-settings-daemon sets for that user.
+ This fixes #89308.
+
Tue Aug 06 13:35:15 2002 George Lebl <jirka@5z.com>
* configure.in: prepare for 2.4.0.6
diff --git a/daemon/server.c b/daemon/server.c
index b31567ca..1253b10a 100644
--- a/daemon/server.c
+++ b/daemon/server.c
@@ -54,6 +54,8 @@ static void gdm_server_spawn (GdmDisplay *d);
static void gdm_server_usr1_handler (gint);
static void gdm_server_alarm_handler (gint);
static void gdm_server_child_handler (gint);
+/* Install gnome2 font dir, (for the cursor, etc...) */
+static void gdm_setup_gnome2_font_dir (uid_t uid, Display *disp);
/* Configuration options */
extern gchar *GdmDisplayInit;
@@ -494,6 +496,10 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
close (server_signal_pipe[0]);
close (server_signal_pipe[1]);
+ if (d->server_uid != 0 &&
+ d->dsp != NULL)
+ gdm_setup_gnome2_font_dir (d->server_uid, d->dsp);
+
if (SERVER_IS_FLEXI (d))
gdm_slave_send_num (GDM_SOP_FLEXI_OK, 0 /* bogus */);
#ifdef __linux__
@@ -1120,5 +1126,76 @@ gdm_server_whack_clients (GdmDisplay *disp)
XSetErrorHandler (old_xerror_handler);
}
+/* Install gnome2 font dir, (for the cursor, etc...) */
+static void
+gdm_setup_gnome2_font_dir (uid_t uid, Display *disp)
+{
+ struct passwd *pwent;
+ gchar *font_dir_name;
+ gchar *dir_name;
+ gchar **font_path;
+ gchar **new_font_path;
+ gint n_fonts;
+ gint new_n_fonts;
+ gint i;
+
+ pwent = getpwuid (uid);
+ if (pwent == NULL)
+ return;
+ if (pwent->pw_dir == NULL)
+ return;
+
+ font_dir_name = g_build_path (G_DIR_SEPARATOR_S, pwent->pw_dir,
+ ".gnome2/share/fonts", NULL);
+ if ( ! g_file_test (font_dir_name, G_FILE_TEST_IS_DIR)) {
+ g_free (font_dir_name);
+ font_dir_name = NULL;
+ return;
+ }
+
+ dir_name = g_build_path (G_DIR_SEPARATOR_S, pwent->pw_dir,
+ ".gnome2/share/cursor-fonts", NULL);
+ if ( ! g_file_test (dir_name, G_FILE_TEST_IS_DIR)) {
+ g_free (dir_name);
+ dir_name = NULL;
+ return;
+ }
+
+ /* Set the font path */
+ font_path = XGetFontPath (disp, &n_fonts);
+ new_n_fonts = n_fonts;
+ if (n_fonts == 0 ||
+ strcmp (font_path[0], dir_name) != 0)
+ new_n_fonts++;
+ if (n_fonts == 0 ||
+ strcmp (font_path[n_fonts-1], font_dir_name) != 0)
+ new_n_fonts++;
+
+ new_font_path = g_new0 (gchar*, new_n_fonts);
+ if (n_fonts == 0 || strcmp (font_path[0], dir_name)) {
+ new_font_path[0] = dir_name;
+ for (i = 0; i < n_fonts; i++)
+ new_font_path [i+1] = font_path [i];
+ } else {
+ for (i = 0; i < n_fonts; i++)
+ new_font_path [i] = font_path [i];
+ }
+
+ if (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name)) {
+ new_font_path[new_n_fonts-1] = font_dir_name;
+ }
+
+ gdk_error_trap_push ();
+ XSetFontPath (disp, new_font_path, new_n_fonts);
+ XSync (disp, False);
+ gdk_error_trap_pop ();
+
+ XFreeFontPath (font_path);
+
+ g_free (new_font_path);
+ g_free (font_dir_name);
+ g_free (dir_name);
+}
+
/* EOF */