diff options
author | George Lebl <jirka@5z.com> | 2002-08-14 22:53:07 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2002-08-14 22:53:07 +0000 |
commit | de66cd84cf366dc1ce17b0b82d4d244769aa0ba6 (patch) | |
tree | 2685191e92f82275e6711ddc4034effb740494ed | |
parent | 86a35bf4adb8974167ab6168ac51d0cc40a196e0 (diff) | |
download | gdm-de66cd84cf366dc1ce17b0b82d4d244769aa0ba6.tar.gz |
a script to run gdmgreeter in Xnest to test themes in the various
Wed Aug 14 16:01:41 2002 George Lebl <jirka@5z.com>
* gui/greeter/Makfile.am, gui/greeter/gdmthemetester: a script to
run gdmgreeter in Xnest to test themes in the various environments
* gui/greeter/greeter_item_capslock.c: if GDM_PARENT_DISPLAY is set
then use it to get capslock state. Currently only used in
gdmthemetester as we have to figure out how to do this inside
the daemon with the cookies and all that.
* gui/gdmXnestchooser.c: close the 0,1,2 descriptors so that we may
do things such as `gdmXnest -b`
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | gui/gdmXnestchooser.c | 8 | ||||
-rw-r--r-- | gui/greeter/Makefile.am | 3 | ||||
-rwxr-xr-x | gui/greeter/gdmthemetester | 78 | ||||
-rw-r--r-- | gui/greeter/greeter.c | 40 | ||||
-rw-r--r-- | gui/greeter/greeter_item_capslock.c | 17 |
7 files changed, 156 insertions, 6 deletions
@@ -1,3 +1,16 @@ +Wed Aug 14 16:01:41 2002 George Lebl <jirka@5z.com> + + * gui/greeter/Makfile.am, gui/greeter/gdmthemetester: a script to + run gdmgreeter in Xnest to test themes in the various environments + + * gui/greeter/greeter_item_capslock.c: if GDM_PARENT_DISPLAY is set + then use it to get capslock state. Currently only used in + gdmthemetester as we have to figure out how to do this inside + the daemon with the cookies and all that. + + * gui/gdmXnestchooser.c: close the 0,1,2 descriptors so that we may + do things such as `gdmXnest -b` + Wed Aug 14 12:16:30 2002 George Lebl <jirka@5z.com> * gui/gdmlogin.c: whack old debug printf (it wasn't harmful due to @@ -13,6 +13,9 @@ TODO things (some must wait until 2.1): - in slave child handler check that the server dead stuff can actually wipe cookies (it needs to have the uid of the user) (probably so) +Set GDM_PARENT_DISPLAY properly for Xnest flexiservers, but we must make sure +cookies are all fine + Languages should be read from available locales. Look at source for locale_config. Currently the way we do things is utter shit. diff --git a/gui/gdmXnestchooser.c b/gui/gdmXnestchooser.c index 417734ce..c50a0541 100644 --- a/gui/gdmXnestchooser.c +++ b/gui/gdmXnestchooser.c @@ -26,6 +26,7 @@ #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> +#include <fcntl.h> #include <signal.h> #include <sys/socket.h> #include <sys/stat.h> @@ -533,6 +534,7 @@ main (int argc, char *argv[]) } printf ("DISPLAY=:%d\n", display); + fflush (stdout); g_snprintf (display_num, sizeof (display_num), ":%d", display); g_snprintf (indirect_host, sizeof (indirect_host), "%s", host); @@ -546,6 +548,12 @@ main (int argc, char *argv[]) if (fork () > 0) { _exit (0); } + close (0); + close (1); + close (2); + open ("/dev/null", O_RDWR); + open ("/dev/null", O_RDONLY); + open ("/dev/null", O_RDONLY); } pid = fork (); diff --git a/gui/greeter/Makefile.am b/gui/greeter/Makefile.am index db2f44ee..33391886 100644 --- a/gui/greeter/Makefile.am +++ b/gui/greeter/Makefile.am @@ -23,6 +23,9 @@ INCLUDES = \ bin_PROGRAMS = \ gdmgreeter +bin_SCRIPTS = \ + gdmthemetester + gdmgreeter_SOURCES = \ greeter.c \ greeter.h \ diff --git a/gui/greeter/gdmthemetester b/gui/greeter/gdmthemetester new file mode 100755 index 00000000..d38b6b63 --- /dev/null +++ b/gui/greeter/gdmthemetester @@ -0,0 +1,78 @@ +#!/bin/sh +echo +echo "GDM Graphical Greeter Theme Tester." +echo +echo "Be sure to test all the environments:" +echo " console, console-timed, flexi, remote-flexi, xdmcp" +echo "Also be sure to test using caps lock" +echo + +if ! which Xnest > /dev/null 2>&1 ; then + echo "ERROR: Xnest not found" + exit 1 +fi + +if ! which gdmXnest > /dev/null 2>&1 ; then + echo "ERROR: gdmXnest not found" + exit 1 +fi + +if ! which gdmgreeter > /dev/null 2>&1 ; then + echo "ERROR: gdmgreeter not found" + exit 1 +fi + +USAGE=" +Usage: $0 <environment> <theme> +<environment> is one of: console, console-timed, flexi, remote-flexi, xdmcp +<theme> is either the path of the theme or the name of an installed theme +" +if [ "$#" != 2 ]; then + echo "$USAGE" + exit 1 +fi + +GDM_THEME="$2" +DOING_GDM_DEVELOPMENT=yes +GDM_PARENT_DISPLAY="$DISPLAY" +export GDM_THEME DOING_GDM_DEVELOPMENT GDM_PARENT_DISPLAY + +case $1 in +console) + GDM_IS_LOCAL=yes + export GDM_IS_LOCAL + ;; +console-timed) + GDM_IS_LOCAL=yes + GDM_FAKE_TIMED=yes + export GDM_IS_LOCAL GDM_FAKE_TIMED + ;; +flexi) + GDM_IS_LOCAL=yes + GDM_FLEXI_SERVER=yes + export GDM_IS_LOCAL GDM_FLEXI_SERVER + ;; +remote-flexi) + GDM_FLEXI_SERVER=yes + export GDM_FLEXI_SERVER + ;; +xdmcp) + ;; +*) + echo "$USAGE" + exit 1 + ;; +esac + +eval `gdmXnest -b` +export DISPLAY + +if [ "x$GDM_PARENT_DISPLAY" = "x$DISPLAY" ]; then + echo "ERROR: Can't start the Xnest server" + exit 1 +fi + +# This may not be necessary +sleep 1 + +gdmgreeter diff --git a/gui/greeter/greeter.c b/gui/greeter/greeter.c index 96024bc4..0e9aee54 100644 --- a/gui/greeter/greeter.c +++ b/gui/greeter/greeter.c @@ -919,11 +919,18 @@ get_theme_file (const char *in, char **theme_dir) dir = NULL; if (DOING_GDM_DEVELOPMENT) { - dir = g_build_filename ("themes", in, NULL); - if (access (dir, F_OK) != 0) + if (access (in, F_OK) == 0) { - g_free (dir); - dir = NULL; + dir = g_strdup (in); + } + else + { + dir = g_build_filename ("themes", in, NULL); + if (access (dir, F_OK) != 0) + { + g_free (dir); + dir = NULL; + } } } if (dir == NULL) @@ -939,10 +946,12 @@ get_theme_file (const char *in, char **theme_dir) } if (access (info, F_OK) != 0) { + char *base = g_path_get_basename (in); /* just guess the name, we have no info about the theme at * this point */ g_free (info); - file = g_strdup_printf ("%s/%s.xml", dir, in); + file = g_strdup_printf ("%s/%s.xml", dir, base); + g_free (base); return file; } @@ -1071,6 +1080,18 @@ main (int argc, char *argv[]) gdm_wm_screen.height); gtk_container_add (GTK_CONTAINER (window), canvas); + if (g_getenv ("GDM_THEME") != NULL) + { + g_free (GdmGraphicalTheme); + GdmGraphicalTheme = g_strdup (g_getenv ("GDM_THEME")); + } + if (DOING_GDM_DEVELOPMENT && + g_getenv ("GDM_FAKE_TIMED") != NULL) + { + g_free (GdmTimedLogin); + GdmTimedLogin = g_strdup ("fake"); + } + theme_file = get_theme_file (GdmGraphicalTheme, &theme_dir); error = NULL; @@ -1080,6 +1101,15 @@ main (int argc, char *argv[]) gdm_wm_screen.height, &error); + /* FIXME: beter information should be printed */ + if (root == NULL && + g_getenv ("GDM_THEME") != NULL && + DOING_GDM_DEVELOPMENT) + { + g_warning ("Theme could not be loaded"); + exit(1); + } + /* Try circles.xml */ if (root == NULL) { diff --git a/gui/greeter/greeter_item_capslock.c b/gui/greeter/greeter_item_capslock.c index b700443c..eb7cdba3 100644 --- a/gui/greeter/greeter_item_capslock.c +++ b/gui/greeter/greeter_item_capslock.c @@ -12,14 +12,29 @@ static gboolean caps_lock_state = FALSE; +extern gboolean DOING_GDM_DEVELOPMENT; + static gboolean is_caps_lock_on (void) { unsigned int states; + Display *dsp = NULL; + + /* HACK! incredible hack, if this is set we get + * indicator state from the parent display, since we must be inside an + * Xnest */ + if (g_getenv ("GDM_PARENT_DISPLAY") != NULL) + dsp = XOpenDisplay (g_getenv ("GDM_PARENT_DISPLAY")); + + if (dsp == NULL) + dsp = GDK_DISPLAY (); - if (XkbGetIndicatorState (GDK_DISPLAY (), XkbUseCoreKbd, &states) != Success) + if (XkbGetIndicatorState (dsp, XkbUseCoreKbd, &states) != Success) return FALSE; + if (dsp != GDK_DISPLAY ()) + XCloseDisplay (dsp); + return (states & ShiftMask) != 0; } |