Commit 11c28082 authored by Brian Cameron's avatar Brian Cameron Committed by Brian Cameron

Patch by Padraig O'Briain <Padraig.OBriain@sun.com>, modified by myself so

2005-12-21  Brian Cameron  <brian.cameron@sun.com>

        Patch by Padraig O'Briain <Padraig.OBriain@sun.com>, modified by myself
        so it also works with gdmlogin and not just gdmgreeter.  Also I
        integrated his gdmprefetch.c utility into the configure/Makefile system
        with the --with-prefetch option.

        * configure.ac:  Now support --with-prefetch
        * daemon/gdm.h, daemon/gdmconfig.c, config/gdm.conf.in:  Support
          new PostDisplayProgram key.
        * gui/gdmcommon.[ch], gui/gdmlogin.c, gui/greeter/greeter.c:  Now
          support new PostDisplayProgram key.
        * docs/C/gdm.xml: Add docs for new key.
        * utils/Makefile.am, utils/gdmprefetch.c: Add new
          gdmprefetch utility.
        * config/Makefile.am: Now install gdm.conf file with 444
          permissions and always write over the installed gdm.conf
          after first moving aside the user's gdm.conf file if
          necessary.
parent 2cfd51d2
2005-12-21 Brian Cameron <brian.cameron@sun.com>
Patch by Padraig O'Briain <Padraig.OBriain@sun.com>, modified by myself
so it also works with gdmlogin and not just gdmgreeter. Also I
integrated his gdmprefetch.c utility into the configure/Makefile system
with the --with-prefetch option.
* configure.ac: Now support --with-prefetch
* daemon/gdm.h, daemon/gdmconfig.c, config/gdm.conf.in: Support
new PostDisplayProgram key.
* gui/gdmcommon.[ch], gui/gdmlogin.c, gui/greeter/greeter.c: Now
support new PostDisplayProgram key.
* docs/C/gdm.xml: Add docs for new key.
* utils/Makefile.am, utils/gdmprefetch.c: Add new
gdmprefetch utility.
* config/Makefile.am: Now install gdm.conf file with 444
permissions and always write over the installed gdm.conf
after first moving aside the user's gdm.conf file if
necessary.
2005-12-21 Brian Cameron <brian.cameron@sun.com>
After two months, the redesign of GDM's internal configuration is
......
......@@ -80,13 +80,12 @@ install-data-hook: gdm.conf Xsession gnome.desktop default.desktop CDE.desktop I
else \
cp -f $(DESTDIR)$(gdmconfdir)/gdm.conf $(DESTDIR)$(gdmconfdir)/gdm.conf.org; \
fi; \
$(INSTALL_DATA) gdm.conf $(DESTDIR)$(gdmconfdir)/gdm.conf; \
fi
if test '!' -f $(DESTDIR)$(gdmconfdir)/gdm.conf; then \
$(INSTALL_DATA) gdm.conf $(DESTDIR)$(gdmconfdir)/gdm.conf; \
fi
$(INSTALL_DATA) gdm.conf $(DESTDIR)$(gdmconfdir)/gdm.conf
chmod 444 $(DESTDIR)$(gdmconfdir)/gdm.conf
if test '!' -f $(DESTDIR)$(gdmconfdir)/gdm.conf-custom; then \
$(INSTALL_DATA) gdm.conf-custom $(DESTDIR)$(gdmconfdir)/gdm.conf-custom; \
chmod 644 $(DESTDIR)$(gdmconfdir)/gdm.conf-custom; \
fi
$(INSTALL_DATA) gdm.conf $(DESTDIR)$(gdmconfdir)/factory-gdm.conf
......
......@@ -438,6 +438,10 @@ GraphicalThemedColor=#76848F
# user fails to log in.
#SoundOnLoginFailure=false
#SoundOnLoginFailureFile=
# Specifies a program to be called by the greeter/login program when the
# initial screen is displayed. The initial purpose is to provide a hook
# where libraries can be preloaded to speed performance for the user.
#PostDisplayProgram=
# The chooser is what's displayed when a user wants an indirect XDMCP session,
# or selects Run XDMCP chooser from the system menu
......
......@@ -858,6 +858,15 @@ fi
AC_SUBST(GDM_CONFIGDIR)
AC_DEFINE_UNQUOTED(GDM_CONFIGDIR,"$GDM_CONFIGDIR")
AC_ARG_WITH(prefetch,
[ --with-prefetch=[yes/no] Install GDM library prefetch utility [default=no]],,
with_prefetch=no)
if test x$with_prefetch != xno ; then
GDMPREFETCH="gdmprefetch"
fi
AC_SUBST(GDMPREFETCH)
AC_ARG_WITH(xevie,
[ --with-xevie=[yes/no] Add XEvIE Xserver extension support [default=no]],,
with_xevie=no)
......@@ -1175,7 +1184,7 @@ dnl <= Authentication scheme =>
echo "Authentication scheme : $VRFY"
dnl <= Utils built =>
echo "Extra utilities built : "`echo $GDMOPEN $GDMASKPASS`
echo "Extra utilities built : "`echo $GDMOPEN $GDMASKPASS $GDMPREFETCH`
echo ""
dnl <= End of configuration summary =>
......
......@@ -360,6 +360,8 @@ enum {
#define GDM_KEY_INFO_MSG_FILE "greeter/InfoMsgFile="
#define GDM_KEY_INFO_MSG_FONT "greeter/InfoMsgFont="
#define GDM_KEY_POST_DISPLAY_PROGRAM "greeter/PostDisplayProgram="
#define GDM_KEY_SOUND_ON_LOGIN "greeter/SoundOnLogin=true"
#define GDM_KEY_SOUND_ON_LOGIN_SUCCESS "greeter/SoundOnLoginSuccess=false"
#define GDM_KEY_SOUND_ON_LOGIN_FAILURE "greeter/SoundOnLoginFailure=false"
......
......@@ -216,6 +216,7 @@ static gchar *GdmHosts;
static gchar *GdmGraphicalThemeColor;
static gchar *GdmGraphicalThemeDir;
static gchar *GdmGraphicalThemes;
static gchar *GdmPostDisplayProgram;
static gint GdmPositionX;
static gint GdmPositionY;
......@@ -494,6 +495,8 @@ gdm_config_init (void)
gdm_config_add_hash (GDM_KEY_DEFAULT_HOST_IMG, &GdmHost, &string_type);
gdm_config_add_hash (GDM_KEY_HOST_IMAGE_DIR, &GdmHostImageDir, &string_type);
gdm_config_add_hash (GDM_KEY_HOSTS, &GdmHosts, &string_type);
gdm_config_add_hash (GDM_KEY_POST_DISPLAY_PROGRAM,
&GdmPostDisplayProgram, &string_type);
/* int values */
gdm_config_add_hash (GDM_KEY_XINERAMA_SCREEN, &GdmXineramaScreen, &int_type);
......
......@@ -1525,6 +1525,19 @@ XKeepsCrashing
</listitem>
</varlistentry>
<varlistentry>
<term>PostDisplayProgram</term>
<listitem>
<synopsis>PostDisplayProgram=command</synopsis>
<para>
Program to be run by the GDM greeter/login program
when the initial screen is displayed. The initial
purpose is to provide a hook where libraries can be
preloaded to speed performance for the user.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PostLoginScriptDir</term>
<listitem>
......@@ -3454,7 +3467,7 @@ XKeepsCrashing
be used to specify that a separate login screen be managed for each
screen. Each key in the <filename>[servers]</filename> section
corresponds to the display number to be managed. Normally there is
only one key, which is the key <filename>0<filename>, which
only one key, which is the key <filename>0</filename>, which
corresponds to the display <filename>:0</filename>.
</para>
......
This diff is collapsed.
This diff is collapsed.
......@@ -376,3 +376,51 @@ gdm_get_welcomemsg (void)
return welcomemsg;
}
static gchar *
post_display_prog_get_path (void)
{
gchar *postdisplayprog;
postdisplayprog = gdm_config_get_string (GDM_KEY_POST_DISPLAY_PROGRAM);
if (! ve_string_empty (postdisplayprog)) {
return postdisplayprog;
} else
return NULL;
}
static gboolean
post_display_run (gpointer data)
{
GPid pid = -1;
GError *error = NULL;
char *command = NULL;
gchar **post_display_prog_argv = NULL;
command = post_display_prog_get_path ();
if (! command)
return FALSE;
post_display_prog_argv = ve_split (command);
g_spawn_async (".",
post_display_prog_argv,
NULL,
(GSpawnFlags) (G_SPAWN_SEARCH_PATH),
NULL,
NULL,
&pid,
&error);
return FALSE;
}
void
gdm_post_display_launch (void)
{
if (! post_display_prog_get_path ())
return;
g_idle_add (post_display_run, NULL);
}
......@@ -57,5 +57,6 @@ gchar* gdm_common_get_config_file (void);
gboolean gdm_common_select_time_format (void);
void setup_background_color (gchar *bg_color);
gchar* gdm_get_welcomemsg (void);
void gdm_post_display_launch (void);
#endif /* GDM_COMMON_H */
......@@ -3689,6 +3689,7 @@ main (int argc, char *argv[])
/* Only setup the cursor now since it will be a WATCH from before */
gdm_common_setup_cursor (GDK_LEFT_PTR);
gdm_post_display_launch ();
gtk_main ();
gdm_kill_thingies ();
......
......@@ -1321,6 +1321,7 @@ main (int argc, char *argv[])
gdm_config_get_string (GDM_KEY_INFO_MSG_FONT));
gdm_common_setup_cursor (GDK_LEFT_PTR);
gdm_post_display_launch ();
gtk_main ();
return 0;
......
......@@ -14,7 +14,8 @@ INCLUDES = \
libexec_PROGRAMS = \
@GDMASKPASS@ \
@GDMOPEN@ \
gdmtranslate
@GDMPREFETCH@ \
gdmtranslate
# This is not useful anymore
# bin_PROGRAMS = \
......@@ -24,7 +25,7 @@ if DMX_SUPPORT
bin_PROGRAMS = gdm-dmx-reconnect-proxy
endif
EXTRA_PROGRAMS = gdmaskpass gdmopen
EXTRA_PROGRAMS = gdmaskpass gdmopen gdmprefetch
gdmaskpass_SOURCES = \
gdmaskpass.c
......@@ -35,6 +36,9 @@ gdmtranslate_SOURCES = \
gdmopen_SOURCES = \
gdmopen.c
gdmprefetch_SOURCES = \
gdmprefetch.c
#gdmmktemp_SOURCES = \
# gdmmktemp.c
......
/* GDM - The GNOME Display Manager
* Copyright (C) 2005 Sun Microsystems, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* program to either force pages into memory or force them
* out (-o option)
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <strings.h>
int out = 0;
int
doout(char *s)
{
int fd;
void *map;
struct stat buf;
if (((fd = open(s, O_RDONLY)) < 0) ||
(fstat(fd, &buf) < 0) ||
((map = mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) ==
MAP_FAILED)) {
(void)close(fd);
return (-1);
}
(void)close(fd);
(void)msync(map, buf.st_size, MS_INVALIDATE);
(void)munmap(map, buf.st_size);
return (0);
}
#define SIZE 1024*128
int
doin(char *s)
{
int fd;
char buffer[SIZE];
if ((fd = open(s, O_RDONLY)) < 0) {
fprintf(stderr, "fopen: %s %s\n", strerror(errno), s);
return (-1);
}
while (read(fd, buffer, SIZE) != 0)
;
(void)close(fd);
return (0);
}
int
main(int argc, char *argv[])
{
FILE *fp = 0;
int c, errflg = 0;
extern int optind, optopt;
extern char *optarg;
int i;
while ((c = getopt(argc, argv, "o:")) != -1) {
switch(c) {
case 'o':
out = 1;
break;
default:
errflg++;
break;
}
}
if (errflg) {
fprintf(stderr, "usage: %s [-o] filename [filename]\n",
argv[0]);
exit(1);
}
for (; optind < argc; optind++) {
if ((argv[optind][0] == '@') && ((fp = fopen(argv[optind], "r")) == 0)) {
char path[1024];
if ((fp = fopen(&(argv[optind][1]), "r")) == 0) {
fprintf(stderr, "fopen: %s %s\n", strerror(errno), &argv[optind][1]);
continue;
}
while (fgets(path, sizeof(path), fp) != 0) {
path[strlen(path) -1] = '\0';
if (!out) {
doin(path);
} else {
doout(path);
}
}
fclose (fp);
fp = 0;
} else {
if (fp != 0) {
fclose (fp);
fp = 0;
}
if (!out) {
doin(argv[optind]);
} else {
doout(argv[optind]);
}
}
}
exit(0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment