Commit 47c12da9 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Actually make the xinerama scaling thing work. Also limit the dragging to

Tue May 08 16:38:02 2001  George Lebl <jirka@5z.com>

	* gui/gdmlogin.c:  Actually make the xinerama scaling thing work.
	  Also limit the dragging to within xinerama screens and avoid
	  dead space.  Allow jumping in between xinerama screens when
	  dragging as well.
parent 2f2141b1
......@@ -14,4 +14,11 @@
#undef HAVE_SETENV
#undef HAVE_UNSETENV
#undef HAVE_CLEARENV
#undef EXPANDED_DATADIR
#undef EXPANDED_PIXMAPDIR
#undef EXPANDED_BINDIR
#undef EXPANDED_GDMCONFIGDIR
#undef EXPANDED_LOCALEDIR
#undef EXPANDED_AUTHDIR
#undef EXPANDED_SYSCONFDIR
#undef EXPANDED_SESSDIR
......@@ -50,7 +50,7 @@ MaxIconHeight=128
[greeter]
TitleBar=true
ConfigAvailable=false
ConfigAvailable=true
Browser=false
DefaultFace=@EXPANDED_PIXMAPDIR@/nobody.png
DefaultLocale=english
......@@ -75,6 +75,7 @@ XineramaScreen=0
#Type can be 0=None, 1=Image, 2=Color
BackgroundType=2
BackgroundImage=
BackgroundScaleToFit=true
BackgroundColor=#007777
BackgroundProgram=
......
......@@ -203,10 +203,12 @@ exec_prefix=$REAL_EXEC_PREFIX
DATADIR_TMP="$datadir"
EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
AC_SUBST(EXPANDED_DATADIR)
AC_DEFINE(EXPANDED_DATADIR,"$EXPANDED_DATADIR")
PIXMAPDIR_TMP="$datadir/pixmaps"
EXPANDED_PIXMAPDIR=`eval echo $PIXMAPDIR_TMP`
AC_SUBST(EXPANDED_PIXMAPDIR)
AC_DEFINE(EXPANDED_PIXMAPDIR,"$EXPANDED_PIXMAPDIR")
BINDIR_TMP="$bindir"
EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
......@@ -222,22 +224,27 @@ else
fi
EXPANDED_GDMCONFIGDIR=`eval echo $GDMCONFIGDIR_TMP`
AC_SUBST(EXPANDED_GDMCONFIGDIR)
AC_DEFINE(EXPANDED_GDMCONFIGDIR,"$EXPANDED_GDMCONFIGDIR")
LOCALEDIR_TMP="$sysconfdir/gdm"
EXPANDED_LOCALEDIR=`eval echo $LOCALEDIR_TMP`
AC_SUBST(EXPANDED_LOCALEDIR)
AC_DEFINE(EXPANDED_LOCALEDIR,"$EXPANDED_LOCALEDIR")
AUTHDIR_TMP="$localstatedir/gdm"
EXPANDED_AUTHDIR=`eval echo $AUTHDIR_TMP`
AC_SUBST(EXPANDED_AUTHDIR)
AC_DEFINE(EXPANDED_AUTHDIR,"$EXPANDED_AUTHDIR")
SYSCONFDIR_TMP="$sysconfdir"
EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
AC_SUBST(EXPANDED_SYSCONFDIR)
AC_DEFINE(EXPANDED_SYSCONFDIR,"$EXPANDED_SYSCONFDIR")
SESSDIR_TMP="$sysconfdir/gdm/Sessions"
EXPANDED_SESSDIR=`eval echo $SESSDIR_TMP`
AC_SUBST(EXPANDED_SESSDIR)
AC_DEFINE(EXPANDED_SESSDIR,"$EXPANDED_SESSDIR")
## Stuff for debian/changelog.in
if test -e "debian/changelog"; then
......
......@@ -63,6 +63,7 @@ gchar *GdmAutomaticLogin = NULL;
gchar *GdmConfigurator = NULL;
gboolean GdmConfigAvailable = FALSE;
gboolean GdmSystemMenu = FALSE;
gint GdmXineramaScreen = 0;
gchar *GdmGreeter = NULL;
gchar *GdmChooser = NULL;
gchar *GdmLogDir = NULL;
......@@ -146,6 +147,7 @@ gdm_config_parse (void)
GdmConfigurator = gnome_config_get_string (GDM_KEY_CONFIGURATOR);
GdmConfigAvailable = gnome_config_get_bool (GDM_KEY_CONFIG_AVAILABLE);
GdmSystemMenu = gnome_config_get_bool (GDM_KEY_SYSMENU);
GdmXineramaScreen = gnome_config_get_int (GDM_KEY_XINERAMASCREEN);
GdmReboot = gnome_config_get_string (GDM_KEY_REBOOT);
GdmRetryDelay = gnome_config_get_int (GDM_KEY_RETRYDELAY);
GdmRootPath = gnome_config_get_string (GDM_KEY_ROOTPATH);
......
......@@ -55,31 +55,32 @@
/* Opcodes for the highly sophisticated protocol used for
* daemon<->greeter communications */
#define GDM_MSGERR 'D'
#define GDM_NOECHO 'U'
#define GDM_PROMPT 'N'
#define GDM_SESS 'G'
#define GDM_LANG '&'
#define GDM_SSESS 'C'
#define GDM_SLANG 'R'
#define GDM_RESET 'A'
#define GDM_QUIT 'P'
#define GDM_STOP '!'
#define GDM_MSGERR 'D'
#define GDM_NOECHO 'U'
#define GDM_PROMPT 'N'
#define GDM_SESS 'G'
#define GDM_LANG '&'
#define GDM_SSESS 'C'
#define GDM_SLANG 'R'
#define GDM_RESET 'A'
#define GDM_QUIT 'P'
#define GDM_STOP '!'
/* crap, these don't fit into the above theme, this protocol
* is thus liable to change */
#define GDM_GNOMESESS '?'
#define GDM_GNOMESESS '?'
#define GDM_STARTTIMER 's'
#define GDM_STOPTIMER 'S'
#define GDM_LOGIN 'L' /* this is the login prompt, much like PROMPT but
different */
#define GDM_SETLOGIN 'l' /* this just sets the login to be this, just for
the greeters knowledge */
#define GDM_DISABLE '-' /* disable the login screen */
#define GDM_ENABLE '+' /* enable the login screen */
#define GDM_STOPTIMER 'S'
#define GDM_LOGIN 'L' /* this is the login prompt, much like PROMPT but
different */
#define GDM_SETLOGIN 'l' /* this just sets the login to be this, just for
the greeters knowledge */
#define GDM_DISABLE '-' /* disable the login screen */
#define GDM_ENABLE '+' /* enable the login screen */
#define GDM_RESETOK 'r' /* reset but don't shake */
/* Different login interruptions */
#define GDM_INTERRUPT_TIMED_LOGIN 'T'
#define GDM_INTERRUPT_CONFIGURE 'C'
#define GDM_INTERRUPT_CONFIGURE 'C'
/* The dreaded miscellaneous category */
#define MAX_ARGS 32
......@@ -87,30 +88,31 @@
#define PIPE_SIZE 4096
/* Configuration constants */
#define GDM_KEY_CHOOSER "daemon/Chooser=gdmchooser"
#define GDM_KEY_CHOOSER "daemon/Chooser=" EXPANDED_BINDIR "/gdmchooser --disable-sound --disable-crash-dialog"
#define GDM_KEY_AUTOMATICLOGIN "daemon/AutomaticLogin="
#define GDM_KEY_GREETER "daemon/Greeter=gdmlogin"
#define GDM_KEY_GREETER "daemon/Greeter=" EXPANDED_BINDIR "/gdmlogin --disable-sound --disable-crash-dialog"
#define GDM_KEY_GROUP "daemon/Group=gdm"
#define GDM_KEY_HALT "daemon/HaltCommand=shutdown -h now"
#define GDM_KEY_INITDIR "daemon/DisplayInitDir="
#define GDM_KEY_HALT "daemon/HaltCommand=/sbin/shutdown -h now"
#define GDM_KEY_INITDIR "daemon/DisplayInitDir=" EXPANDED_SYSCONFDIR "/gdm/Init"
#define GDM_KEY_KILLIC "daemon/KillInitClients=true"
#define GDM_KEY_LOGDIR "daemon/LogDir="
#define GDM_KEY_PATH "daemon/DefaultPath=/bin:/usr/bin:/usr/bin/X11:/usr/local/bin"
#define GDM_KEY_LOGDIR "daemon/LogDir=" EXPANDED_AUTHDIR
#define GDM_KEY_PATH "daemon/DefaultPath=/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:" EXPANDED_BINDIR
#define GDM_KEY_PIDFILE "daemon/PidFile=/var/run/gdm.pid"
#define GDM_KEY_POSTSESS "daemon/PostSessionScriptDir="
#define GDM_KEY_PRESESS "daemon/PreSessionScriptDir="
#define GDM_KEY_REBOOT "daemon/RebootCommand=shutdown -r now"
#define GDM_KEY_ROOTPATH "daemon/RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin"
#define GDM_KEY_GNOMEDEFAULTSESSION "daemon/GnomeDefaultSession=/usr/share/gnome/default.session"
#define GDM_KEY_SERVAUTH "daemon/ServAuthDir=/var/gdm"
#define GDM_KEY_SESSDIR "daemon/SessionDir="
#define GDM_KEY_POSTSESS "daemon/PostSessionScriptDir=" EXPANDED_SYSCONFDIR "/gdm/PostSession/"
#define GDM_KEY_PRESESS "daemon/PreSessionScriptDir=" EXPANDED_SYSCONFDIR "/gdm/PreSession/"
#define GDM_KEY_REBOOT "daemon/RebootCommand=/sbin/shutdown -r now"
#define GDM_KEY_ROOTPATH "daemon/RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:" EXPANDED_BINDIR
#define GDM_KEY_GNOMEDEFAULTSESSION "daemon/GnomeDefaultSession=" EXPANDED_DATADIR "/gnome/default.session"
#define GDM_KEY_SERVAUTH "daemon/ServAuthDir=" EXPANDED_AUTHDIR
#define GDM_KEY_SESSDIR "daemon/SessionDir=" EXPANDED_SYSCONFDIR "/gdm/Sessions/"
#define GDM_KEY_UAUTHDIR "daemon/UserAuthDir="
#define GDM_KEY_UAUTHFB "daemon/UserAuthFBDir=/tmp"
#define GDM_KEY_UAUTHFILE "daemon/UserAuthFile=.Xauthority"
#define GDM_KEY_USER "daemon/User=gdm"
#define GDM_KEY_TIMED_LOGIN "daemon/TimedLogin="
#define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay=0"
#define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay=30"
#define GDM_KEY_ALLOWROOT "security/AllowRoot=true"
#define GDM_KEY_ALLOWREMOTEROOT "security/AllowRemoteRoot=true"
......@@ -120,35 +122,35 @@
#define GDM_KEY_RETRYDELAY "security/RetryDelay=3"
#define GDM_KEY_VERBAUTH "security/VerboseAuth=true"
#define GDM_KEY_XDMCP "xdmcp/Enable=true"
#define GDM_KEY_XDMCP "xdmcp/Enable=false"
#define GDM_KEY_MAXPEND "xdmcp/MaxPending=4"
#define GDM_KEY_MAXSESS "xdmcp/MaxSessions=16"
#define GDM_KEY_MAXWAIT "xdmcp/MaxWait=30"
#define GDM_KEY_DISPERHOST "xdmcp/DisplaysPerHost=1"
#define GDM_KEY_UDPPORT "xdmcp/Port=177"
#define GDM_KEY_INDIRECT "xdmcp/HonorIndirect=true"
#define GDM_KEY_INDIRECT "xdmcp/HonorIndirect=false"
#define GDM_KEY_MAXINDIR "xdmcp/MaxPendingIndirect=4"
#define GDM_KEY_MAXINDWAIT "xdmcp/MaxWaitIndirect=30"
#define GDM_KEY_GTKRC "gui/GtkRC="
#define GDM_KEY_GTKRC "gui/GtkRC=" EXPANDED_DATADIR "/themes/Default/gtk/gtkrc"
#define GDM_KEY_ICONWIDTH "gui/MaxIconWidth=128"
#define GDM_KEY_ICONHEIGHT "gui/MaxIconHeight=128"
#define GDM_KEY_BROWSER "greeter/Browser=false"
#define GDM_KEY_EXCLUDE "greeter/Exclude=bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody"
#define GDM_KEY_FACE "greeter/DefaultFace=nobody.png"
#define GDM_KEY_FACEDIR "greeter/GlobalFaceDir="
#define GDM_KEY_EXCLUDE "greeter/Exclude=bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm"
#define GDM_KEY_FACE "greeter/DefaultFace=" EXPANDED_PIXMAPDIR "nobody.png"
#define GDM_KEY_FACEDIR "greeter/GlobalFaceDir=" EXPANDED_DATADIR "/faces/"
#define GDM_KEY_FONT "greeter/Font=-adobe-helvetica-bold-r-normal-*-*-180-*-*-*-*-*-*"
#define GDM_KEY_ICON "greeter/Icon=gdm.xpm"
#define GDM_KEY_ICON "greeter/Icon=" EXPANDED_PIXMAPDIR "/gdm.xpm"
#define GDM_KEY_LOCALE "greeter/DefaultLocale=english"
#define GDM_KEY_LOCFILE "greeter/LocaleFile="
#define GDM_KEY_LOGO "greeter/Logo="
#define GDM_KEY_LOCFILE "greeter/LocaleFile=" EXPANDED_LOCALEDIR "/locale.alias"
#define GDM_KEY_LOGO "greeter/Logo=" EXPANDED_PIXMAPDIR "/gnome-logo-large.png"
#define GDM_KEY_QUIVER "greeter/Quiver=true"
#define GDM_KEY_SYSMENU "greeter/SystemMenu=true"
#define GDM_KEY_CONFIGURATOR "daemon/Configurator=/usr/sbin/gdmconfig"
#define GDM_KEY_CONFIG_AVAILABLE "greeter/ConfigAvailable=false"
#define GDM_KEY_CONFIG_AVAILABLE "greeter/ConfigAvailable=true"
#define GDM_KEY_TITLE_BAR "greeter/TitleBar=true"
#define GDM_KEY_WELCOME "greeter/Welcome=Welcome to %h"
#define GDM_KEY_WELCOME "greeter/Welcome=Welcome to %n"
#define GDM_KEY_XINERAMASCREEN "greeter/XineramaScreen=0"
#define GDM_KEY_BACKGROUNDPROG "greeter/BackgroundProgram="
#define GDM_KEY_BACKGROUNDIMAGE "greeter/BackgroundImage="
......@@ -161,8 +163,8 @@
#define GDM_KEY_POSITIONY "greeter/PositionY=0"
#define GDM_KEY_SCAN "chooser/ScanTime=3"
#define GDM_KEY_HOST "chooser/DefaultHostImg=nohost.png"
#define GDM_KEY_HOSTDIR "chooser/HostImageDir="
#define GDM_KEY_HOST "chooser/DefaultHostImg=" EXPANDED_PIXMAPDIR "/nohost.png"
#define GDM_KEY_HOSTDIR "chooser/HostImageDir=" EXPANDED_DATADIR "/hosts/"
#define GDM_KEY_DEBUG "debug/Enable=false"
......@@ -207,6 +209,9 @@ struct _GdmDisplay {
gboolean disabled;
gboolean timed_login_ok;
int screenx;
int screeny;
};
......@@ -244,6 +249,7 @@ void gdm_run (void);
void gdm_quit (void);
#define gdm_string_empty(x) ((x)==NULL||(x)[0]=='\0')
#define gdm_sure_string(x) ((x)!=NULL?(x):"")
#endif /* __GDM_H__ */
......
......@@ -460,6 +460,8 @@ gdm_server_alloc (gint id, const gchar *command)
d->sessionid = 0;
d->acctime = 0;
d->dsp = NULL;
d->screenx = 0; /* xinerama offset */
d->screeny = 0;
d->last_start_time = 0;
d->retry_count = 0;
......@@ -474,24 +476,24 @@ gdm_server_alloc (gint id, const gchar *command)
}
/* ignore handlers */
static gint
static int
ignore_xerror_handler (Display *disp, XErrorEvent *evt)
{
return 0;
return 0;
}
static gint
static int
ignore_xioerror_handler (Display *disp)
{
return 0;
return 0;
}
void
gdm_server_whack_clients (GdmDisplay *disp)
{
int i, screen_count;
gint (* old_xerror_handler) (Display *, XErrorEvent *);
gint (* old_xioerror_handler) (Display *);
int (* old_xerror_handler) (Display *, XErrorEvent *);
int (* old_xioerror_handler) (Display *);
if (disp == NULL ||
disp->dsp == NULL)
......@@ -521,6 +523,7 @@ gdm_server_whack_clients (GdmDisplay *disp)
}
}
XSync (disp->dsp, False);
XSetErrorHandler (old_xerror_handler);
XSetIOErrorHandler (old_xioerror_handler);
}
......
......@@ -21,6 +21,7 @@
#include <config.h>
#include <gnome.h>
#include <gdk/gdkx.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
......@@ -29,6 +30,9 @@
#include <sys/wait.h>
#include <strings.h>
#include <X11/Xlib.h>
#ifdef HAVE_LIBXINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include <signal.h>
#include <pwd.h>
#include <grp.h>
......@@ -69,6 +73,7 @@ extern gchar *GdmAutomaticLogin;
extern gchar *GdmConfigurator;
extern gboolean GdmConfigAvailable;
extern gboolean GdmSystemMenu;
extern gint GdmXineramaScreen;
extern gchar *GdmGreeter;
extern gchar *GdmDisplayInit;
extern gchar *GdmPreSession;
......@@ -189,6 +194,72 @@ setup_automatic_session (GdmDisplay *display, const char *name)
gdm_debug ("gdm_slave_start: DisplayInit script finished");
}
#ifdef HAVE_LIBXINERAMA
/* Yay thread unsafety */
static gboolean x_error_occured = FALSE;
/* ignore handlers */
static int
ignore_xerror_handler (Display *disp, XErrorEvent *evt)
{
x_error_occured = TRUE;
return 0;
}
static int
ignore_xioerror_handler (Display *disp)
{
x_error_occured = TRUE;
return 0;
}
#endif
static void
gdm_screen_init (GdmDisplay *display)
{
#ifdef HAVE_LIBXINERAMA
int (* old_xerror_handler) (Display *, XErrorEvent *);
int (* old_xioerror_handler) (Display *);
gboolean have_xinerama = FALSE;
x_error_occured = FALSE;
old_xerror_handler = XSetErrorHandler (ignore_xerror_handler);
old_xioerror_handler = XSetIOErrorHandler (ignore_xioerror_handler);
have_xinerama = XineramaIsActive (display->dsp);
XSync (display->dsp, False);
XSetErrorHandler (old_xerror_handler);
XSetIOErrorHandler (old_xioerror_handler);
if (x_error_occured)
have_xinerama = FALSE;
if (have_xinerama) {
int screen_num;
XineramaScreenInfo *xscreens =
XineramaQueryScreens (display->dsp,
&screen_num);
if (screen_num <= 0)
gdm_fail ("Xinerama active, but <= 0 screens?");
if (screen_num <= GdmXineramaScreen)
GdmXineramaScreen = 0;
display->screenx = xscreens[GdmXineramaScreen].x_org;
display->screeny = xscreens[GdmXineramaScreen].y_org;
XFree (xscreens);
} else
#endif
{
display->screenx = 0;
display->screeny = 0;
}
}
static void
gdm_slave_run (GdmDisplay *display)
......@@ -234,6 +305,10 @@ gdm_slave_run (GdmDisplay *display)
}
if (d->dsp != NULL) {
/* checkout xinerama */
gdm_screen_init (d);
if (d->type == TYPE_LOCAL &&
gdm_first_login &&
! gdm_string_empty (GdmAutomaticLogin) &&
......@@ -307,6 +382,7 @@ run_error_dialog (const char *error)
gtk_init (&argc, &argv);
dialog = gtk_dialog_new ();
gtk_widget_set_uposition (dialog, d->screenx, d->screeny);
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
GTK_SIGNAL_FUNC(gtk_main_quit),
......@@ -328,8 +404,21 @@ run_error_dialog (const char *error)
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (dialog));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show_all (dialog);
gtk_widget_show_now (dialog);
if (dialog->window != NULL) {
gdk_error_trap_push ();
XSetInputFocus (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (dialog->window),
RevertToPointerRoot,
CurrentTime);
gdk_flush ();
gdk_error_trap_pop ();
}
gtk_main ();
......@@ -490,7 +579,7 @@ gdm_slave_wait_for_login (void)
gdm_verify_cleanup ();
gdm_slave_greeter_ctl_no_ret (GDM_ENABLE, "");
gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
gdm_slave_greeter_ctl_no_ret (GDM_RESETOK, "");
continue;
}
......@@ -794,7 +883,7 @@ find_a_session (void)
}
static char *
find_prog (const char *name, const char *args)
find_prog (const char *name, const char *args, char **retpath)
{
char *ret;
char *path;
......@@ -809,27 +898,30 @@ find_prog (const char *name, const char *args)
};
path = gnome_is_program_in_path (name);
if (path != NULL) {
if (path != NULL &&
access (path, X_OK) == 0) {
ret = g_strdup_printf ("%s %s", path, args);
g_free (path);
*retpath = path;
return ret;
}
g_free (path);
for (i = 0; try[i] != NULL; i++) {
path = g_strconcat (try[i], name, NULL);
if (g_file_exists (path)) {
if (access (path, X_OK) == 0) {
ret = g_strdup_printf ("%s %s", path, args);
g_free (path);
*retpath = path;
return ret;
}
g_free (path);
}
*retpath = NULL;
return NULL;
}
static void
gdm_slave_session_start (void)
{
char *cfgdir, *sesspath;
char *cfgdir, *sesspath, *sessexec;
struct stat statbuf;
struct passwd *pwent;
char *save_session = NULL, *session = NULL, *language = NULL, *usrsess, *usrlang;
......@@ -1112,10 +1204,12 @@ gdm_slave_session_start (void)
sigprocmask (SIG_SETMASK, &sysmask, NULL);
sesspath = NULL;
sessexec = NULL;
if (strcmp (session, GDM_SESSION_FAILSAFE_GNOME) == 0) {
sesspath = find_prog ("gnome-session",
"--choose-session=Default");
"--choose-session=Default",
&sessexec);
if (sesspath == NULL) {
/* yaikes */
gdm_error (_("gdm_slave_session_start: gnome-session not found for a failsafe gnome session, trying xterm"));
......@@ -1138,8 +1232,12 @@ gdm_slave_session_start (void)
/* an if and not an else, we could have done a fall-through
* to here in the above code if we can't find gnome-session */
if (strcmp (session, GDM_SESSION_FAILSAFE_XTERM) == 0) {
char *params = g_strdup_printf ("-geometry 80x24+%d+%d",
d->screenx, d->screeny);
sesspath = find_prog ("xterm",
"-geometry 80x24-0-0");
params,
&sessexec);
g_free (params);
if (sesspath == NULL) {
run_error_dialog
(_("Cannot find \"xterm\" to start "
......@@ -1153,7 +1251,7 @@ gdm_slave_session_start (void)
"console so that you may fix your system\n"
"if you cannot log in any other way.\n"
"To exit the terminal emulator, type\n"
"'exit'and an enter into the window."));
"'exit' and an enter into the window."));
}
}
......@@ -1180,8 +1278,8 @@ gdm_slave_session_start (void)
gdm_error (_("gdm_slave_session_start: User not allowed to log in"));
run_error_dialog (_("The system administrator has\n"
"disabled your account."));
} else if (access (sesspath, X_OK|R_OK) != 0) {
gdm_error (_("gdm_slave_session_start: Could not find session `%s'"), sesspath);
} else if (access (sessexec != NULL ? sessexec : sesspath, X_OK) != 0) {
gdm_error (_("gdm_slave_session_start: Could not find/run session `%s'"), sesspath);
/* if we can't read and exec the session, then make a nice
* error dialog */
run_error_dialog
......
......@@ -763,6 +763,11 @@ gdm_center_window (GtkWindow *cw)
x = screen.x + (screen.width - req.width)/2;
y = screen.y + (screen.height - req.height)/2;
if (x < screen.x)
x = screen.x;
if (y < screen.y)
y = screen.y;
gtk_widget_set_uposition (GTK_WIDGET (cw), x, y);
}
......@@ -1273,7 +1278,7 @@ gdm_login_session_handler (GtkWidget *widget)
cursess = gtk_object_get_data (GTK_OBJECT (widget), SESSION_NAME);
s = g_strdup_printf (_("%s session selected"), _(cursess));
s = g_strdup_printf (_("%s session selected"), translate_session (cursess));
gtk_label_set (GTK_LABEL (msg), s);
g_free (s);
......@@ -1977,9 +1982,6 @@ gdm_login_ctrl_handler (GIOChannel *source, GIOCondition cond, gint fd)
break;
case GDM_RESET:
g_io_channel_read (source, buf, PIPE_SIZE-1, &len);
buf[len-1] = '\0';
if (GdmQuiver) {
gdk_window_get_position (login->window, &x, &y);
......@@ -1999,6 +2001,10 @@ gdm_login_ctrl_handler (GIOChannel *source, GIOCondition cond, gint fd)
}
}
case GDM_RESETOK:
g_io_channel_read (source, buf, PIPE_SIZE-1, &len);
buf[len-1] = '\0';
if (curuser != NULL) {
g_free (curuser);
curuser = NULL;
......@@ -3245,6 +3251,65 @@ revert_focus_to_login (void)
}
}
static void
center_x_window (Window w)
{
XSizeHints hints;
Status status;
long ret;
int x, y;
Window root;
unsigned int width, height, border, depth;
gdk_error_trap_push ();
status = XGetWMNormalHints (GDK_DISPLAY (),
w,
&hints,
&ret);
if ( ! status) {
gdk_flush ();
gdk_error_trap_pop ();
return;
}
if (hints.flags & USPosition &&
hints.flags & USSize) {
gdk_flush ();
gdk_error_trap_pop ();
return;
}
XGetGeometry (GDK_DISPLAY (), w,
&root, &x, &y, &width, &height, &border, &depth);
/* we replace the x,y and width,height with some new values */
if ( ! (hints.flags & USSize)) {
if (width > screen.width)
width = screen.width;
if (height > screen.height)
height = screen.height;
}
if ( ! (hints.flags & USPosition)) {
/* we wipe the X with some new values */
x = screen.x + (screen.width - width)/2;
y = screen.y + (screen.height - height)/2;
if (x < screen.x)
x = screen.x;
if (y < screen.y)
y = screen.y;
}
XMoveResizeWindow (GDK_DISPLAY (), w, x, y, width, height);
gdk_flush ();
gdk_error_trap_pop ();
}
static GdkFilterReturn
root_filter (GdkXEvent *gdk_xevent,
GdkEvent *event,
......@@ -3252,8 +3317,34 @@ root_filter (GdkXEvent *gdk_xevent,
{
Window w;
XEvent *xevent = (XEvent *)gdk_xevent;
XWindowChanges wchanges;
switch (xevent->type) {
case MapRequest:
w = xevent->xmaprequest.window;
center_x_window (w);
XMapWindow (GDK_DISPLAY (), w);
break;
case ConfigureRequest:
w = xevent->xconfigurerequest.window;
wchanges.x = xevent->xconfigurerequest.x;
wchanges.y = xevent->xconfigurerequest.y;
wchanges.width = xevent->xconfigurerequest.width;
wchanges.height = xevent->xconfigurerequest.height;
wchanges.border_width = xevent->xconfigurerequest.border_width;
wchanges.sibling = xevent->xconfigurerequest.above;
wchanges.stack_mode = xevent->xconfigurerequest.detail;
XConfigureWindow (GDK_DISPLAY (),
w,
xevent->xconfigurerequest.value_mask,
&wchanges);
break;
case CirculateRequest:
w = xevent->xcirculaterequest.window;
XCirculateSubwindows (GDK_DISPLAY (),
w,
xevent->xcirculaterequest.place);
break;
case MapNotify:
if ( ! xevent->xmap.override_redirect) {
w = xevent->xmap.window;
......@@ -3447,7 +3538,8 @@ main (int argc, char *argv[])
XSelectInput (GDK_DISPLAY (),
GDK_ROOT_WINDOW (),
attribs.your_event_mask |
SubstructureNotifyMask);
SubstructureNotifyMask |
SubstructureRedirectMask);
gdk_flush ();
gdk_error_trap_pop ();
......
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