Commit 1747a04d authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

if available include <sys/sockio.h>. Should fix first part of #86679

Mon Jul 08 20:01:23 2002  George Lebl <jirka@5z.com>

	* configure.in, acconfig.h, daemon/misc.c, gui/gdmchooser.c:
	  if available include <sys/sockio.h>.  Should fix first
	  part of #86679

	* gui/Makefile.am: link gdmsetup and gdmflexiserver with -lXau,
	  should fix second part of #86679

	* gui/gdmwm.c: Fix #86620, don't set up the wm stuff if the
	  substructureredirect selection fails on the root window.

	* daemon/slave.c: don't clear the env for chooser, greeter and
	  config.  I suppose it was fairly foolish to do so anyway.
	  Should fix #87387 partly

	* configure.in, daemon/gdm.in, daemon/Makefile.am: rename
	  gdm to gdm-binary and install a new script called gdm
	  which calls gdm-binary.  This way the standard env is
	  read in and other good stuff can happen.  Should fix #87387
	  completely

	* gui/gdmchooser.c, gui/gdmlogin.c: properly center windows

	* gui/gdmchooser.c: don't die on every minor problem, and
	  fix querying the interfaces

	* gui/gdmchooser.c, gui/gdmsetup.c: fix crashes and the event
	  fixup function

	* gui/gdmchooser.glade: fix signal connections so that we can
	  actually select some host
parent 9348367b
Mon Jul 08 20:01:23 2002 George Lebl <jirka@5z.com>
* configure.in, acconfig.h, daemon/misc.c, gui/gdmchooser.c:
if available include <sys/sockio.h>. Should fix first
part of #86679
* gui/Makefile.am: link gdmsetup and gdmflexiserver with -lXau,
should fix second part of #86679
* gui/gdmwm.c: Fix #86620, don't set up the wm stuff if the
substructureredirect selection fails on the root window.
* daemon/slave.c: don't clear the env for chooser, greeter and
config. I suppose it was fairly foolish to do so anyway.
Should fix #87387 partly
* configure.in, daemon/gdm.in, daemon/Makefile.am: rename
gdm to gdm-binary and install a new script called gdm
which calls gdm-binary. This way the standard env is
read in and other good stuff can happen. Should fix #87387
completely
* gui/gdmchooser.c, gui/gdmlogin.c: properly center windows
* gui/gdmchooser.c: don't die on every minor problem, and
fix querying the interfaces
* gui/gdmchooser.c, gui/gdmsetup.c: fix crashes and the event
fixup function
* gui/gdmchooser.glade: fix signal connections so that we can
actually select some host
2002-07-08 Frederic Crozat <fcrozat@mandrakesoft.com>
* gui/greeter/themes/happygnome/Makefile.am:
......
......@@ -27,3 +27,4 @@
#undef EXPANDED_SESSDIR
#undef GETTEXT_PACKAGE
#undef HAVE_LOGINCAP
#undef HAVE_SYS_SOCKIO_H
......@@ -303,6 +303,12 @@ AC_CHECK_HEADER(login_cap.h, [
LIBS="$LIBS -lutil"
AC_DEFINE(HAVE_LOGINCAP)])
#
# Check for sys/sockio.h
#
AC_CHECK_HEADERS(sys/sockio.h, [
AC_DEFINE(HAVE_SYS_SOCKIO_H)])
#
# Xdmcp checking
#
......@@ -442,6 +448,7 @@ vicious-extensions/Makefile
config/gdm.conf
config/Gnome
config/gnomerc
daemon/gdm
gdm-restart
gdm-safe-restart
gdmsetup-security
......
......@@ -3,4 +3,4 @@ Makefile.in
.deps
.libs
gdm
gdmgreeter
gdm-binary
......@@ -21,9 +21,9 @@ INCLUDES = \
$(GNOME_INCLUDEDIR)
bin_PROGRAMS = gdm
bin_PROGRAMS = gdm-binary
gdm_SOURCES = \
gdm_binary_SOURCES = \
gdm.c \
gdm.h \
display.c \
......@@ -53,9 +53,9 @@ gdm_SOURCES = \
gdm-net.c \
gdm-net.h
EXTRA_gdm_SOURCES = verify-pam.c verify-crypt.c verify-shadow.c
EXTRA_gdm_binary_SOURCES = verify-pam.c verify-crypt.c verify-shadow.c
gdm_LDADD = \
gdm_binary_LDADD = \
$(DAEMON_LIBS) \
$(X_LIBS) \
$(XDMCP_LIBS) \
......@@ -67,3 +67,6 @@ gdm_LDADD = \
-L$(top_builddir)/vicious-extensions \
-lvicious
bin_SCRIPTS = gdm
EXTRA_DIST = gdm.in
#!/bin/sh
# A script so that
# 1) we read the standard system env vars
# 2) syadmins/integrators can add their own private options etc...
exec @EXPANDED_BINDIR@/gdm-binary "$@"
# fallback, use PATH
exec gdm-binary "$@"
......@@ -34,6 +34,9 @@
#include <errno.h>
#include <grp.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
#include <vicious.h>
......@@ -708,7 +711,7 @@ gdm_peek_local_address_list (void)
#endif
ifc.ifc_len = sizeof(struct ifreq) * num;
ifc.ifc_buf = buf = g_malloc (ifc.ifc_len);
ifc.ifc_buf = buf = g_malloc0 (ifc.ifc_len);
if (ioctl (sockfd, SIOCGIFCONF, &ifc) < 0) {
gdm_error (_("%s: Cannot get local addresses!"),
"gdm_peek_local_address_list");
......
......@@ -736,7 +736,9 @@ run_config (GdmDisplay *display, struct passwd *pwent)
setgid (0);
/* setup environment */
gdm_clearenv_no_lang ();
/* FIXME: clearing environment is likely fairly stupid,
* is there any reason we should do it anyway? */
/* gdm_clearenv_no_lang (); */
/* root here */
gnome_setenv ("XAUTHORITY", display->authfile, TRUE);
......@@ -1308,7 +1310,10 @@ gdm_slave_greeter (void)
_("%s: Couldn't set userid to %d"),
"gdm_slave_greeter", GdmUserId);
gdm_clearenv_no_lang ();
/* FIXME: clearing environment is likely fairly stupid,
* is there any reason we should do it anyway? */
/* gdm_clearenv_no_lang (); */
gnome_setenv ("XAUTHORITY", GDM_AUTHFILE (d), TRUE);
gnome_setenv ("DISPLAY", d->name, TRUE);
......@@ -1656,7 +1661,10 @@ gdm_slave_chooser (void)
_("%s: Couldn't set userid to %d"),
"gdm_slave_chooser", GdmUserId);
gdm_clearenv_no_lang ();
/* FIXME: clearing environment is likely fairly stupid,
* is there any reason we should do it anyway? */
/* gdm_clearenv_no_lang (); */
gnome_setenv ("XAUTHORITY", GDM_AUTHFILE (d), TRUE);
gnome_setenv ("DISPLAY", d->name, TRUE);
......
......@@ -92,6 +92,7 @@ gdmlogin_LDADD = \
gdmsetup_LDFLAGS = -export-dynamic
gdmsetup_LDADD = \
$(GUI_LIBS) \
-lXau \
$(INTLLIBS) \
-L$(top_builddir)/vicious-extensions \
-lviciousui
......@@ -110,6 +111,7 @@ gdmXnestchooser_LDADD = \
gdmflexiserver_LDADD = \
$(GUI_LIBS) \
-lXau \
$(INTLLIBS) \
-L$(top_builddir)/vicious-extensions \
-lviciousui
......
......@@ -44,6 +44,9 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <net/if.h>
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
#include <viciousui.h>
......@@ -79,6 +82,7 @@ static gchar *client_address = NULL;
static gint connection_type = 0;
static void gdm_chooser_abort (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
static void gdm_chooser_warn (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
/* Exported for glade */
gboolean gdm_chooser_cancel (void);
......@@ -415,14 +419,15 @@ gdm_chooser_find_bcaddr (void)
#endif
ifc.ifc_len = sizeof (struct ifreq) * num;
ifc.ifc_buf = buf = g_malloc (ifc.ifc_len);
ifc.ifc_buf = buf = g_malloc0 (ifc.ifc_len);
if (ioctl (sockfd, SIOCGIFCONF, &ifc) < 0) {
g_free (buf);
gdm_chooser_abort ("Cannot get local addresses!");
gdm_chooser_warn ("Cannot get local addresses!");
return;
}
ifr = ifc.ifc_req;
num = ifc.ifc_len / sizeof(struct ifreq);
for (i = 0 ; i < num ; i++) {
if ( ! ve_string_empty (ifr[i].ifr_name)) {
struct ifreq ifreq;
......@@ -436,7 +441,7 @@ gdm_chooser_find_bcaddr (void)
ifreq.ifr_name[sizeof (ifreq.ifr_name) - 1] = '\0';
if (ioctl (sockfd, SIOCGIFFLAGS, &ifreq) < 0)
gdm_chooser_abort ("Could not get SIOCGIFFLAGS for %s", ifr[i].ifr_name);
gdm_chooser_warn ("Could not get SIOCGIFFLAGS for %s", ifr[i].ifr_name);
if ((ifreq.ifr_flags & IFF_UP) == 0 ||
(ifreq.ifr_flags & IFF_BROADCAST) == 0 ||
......@@ -744,14 +749,29 @@ gdm_chooser_abort (const gchar *format, ...)
exit (EXIT_FAILURE);
}
static void
gdm_chooser_warn (const gchar *format, ...)
{
va_list args;
gchar *s;
va_start (args, format);
s = g_strdup_vprintf (format, args);
va_end (args);
syslog (LOG_ERR, "%s", s);
closelog ();
}
static void
gdm_chooser_parse_config (void)
{
/* stupid, or is it?
struct stat unused;
if (stat (GDM_CONFIG_FILE, &unused) == -1)
gdm_chooser_abort (_("gdm_chooser_parse_config: No configuration file: %s. Aborting."), GDM_CONFIG_FILE);
*/
gnome_config_push_prefix ("=" GDM_CONFIG_FILE "=/");
......@@ -897,10 +917,17 @@ gdm_chooser_gui_init (void)
gtk_rc_parse (GdmGtkRC);
/* Load default host image */
if (access (GdmHostDefaultIcon, R_OK) != 0)
gdm_chooser_abort (_("Can't open default host icon: %s"), GdmHostDefaultIcon);
else
if (access (GdmHostDefaultIcon, R_OK) != 0) {
gdm_chooser_warn (_("Can't open default host icon: %s"), GdmHostDefaultIcon);
/* bogus image */
defhostimg = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
FALSE /* has_alpha */,
8 /* bits_per_sample */,
48 /* width */,
48 /* height */);
} else {
defhostimg = gdk_pixbuf_new_from_file (GdmHostDefaultIcon, NULL);
}
/* Main window */
chooser_app = glade_helper_load ("gdmchooser.glade",
......@@ -1011,11 +1038,17 @@ gdm_event (GSignalInvocationHint *ihint,
const GValue *param_values,
gpointer data)
{
GdkEvent *event;
/* HAAAAAAAAAAAAAAAAACK */
/* Since the user has not logged in yet and may have left/right
* mouse buttons switched, we just translate every right mouse click
* to a left mouse click */
GdkEvent *event = g_value_get_pointer ((GValue *)param_values);
if (n_param_values != 2 ||
!G_VALUE_HOLDS (&param_values[1], GDK_TYPE_EVENT))
return FALSE;
event = g_value_get_boxed (&param_values[1]);
if ((event->type == GDK_BUTTON_PRESS ||
event->type == GDK_2BUTTON_PRESS ||
event->type == GDK_3BUTTON_PRESS ||
......@@ -1122,8 +1155,11 @@ main (int argc, char *argv[])
NULL /* destroy_notify */);
}
gtk_widget_queue_resize (chooser);
gtk_widget_show_now (chooser);
gdm_wm_center_window (GTK_WINDOW (chooser));
/* can it ever happen that it'd be NULL here ??? */
if (chooser->window != NULL) {
gdm_wm_init (GDK_WINDOW_XWINDOW (chooser->window));
......
......@@ -17,7 +17,6 @@
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
......@@ -188,6 +187,8 @@
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">False</property>
<signal name="select_icon" handler="gdm_chooser_browser_select" last_modification_time="Tue, 09 Jul 2002 02:43:48 GMT"/>
<signal name="unselect_icon" handler="gdm_chooser_browser_unselect" last_modification_time="Tue, 09 Jul 2002 02:44:00 GMT"/>
</widget>
</child>
</widget>
......
......@@ -2716,16 +2716,6 @@ create_handle (void)
return title_box;
}
static void
login_realized (GtkWidget *w)
{
/* In case we're out of bounds, after realization we'll have correct
* limits to make the window be on screen */
if (GdmSetPosition) {
set_screen_pos (login, GdmPositionX, GdmPositionY);
}
}
static gboolean
update_clock (gpointer data)
{
......@@ -3331,11 +3321,9 @@ gdm_login_gui_init (void)
"resizable", TRUE,
NULL);
/* do it now, and we'll also do it later */
if (GdmSetPosition) {
set_screen_pos (login, GdmPositionX, GdmPositionY);
g_signal_connect (G_OBJECT (login), "realize",
G_CALLBACK (login_realized),
NULL);
} else {
gdm_wm_center_window (GTK_WINDOW (login));
}
......@@ -4119,8 +4107,15 @@ main (int argc, char *argv[])
NULL /* destroy_notify */);
}
gtk_widget_queue_resize (login);
gtk_widget_show_now (login);
if (GdmSetPosition) {
set_screen_pos (login, GdmPositionX, GdmPositionY);
} else {
gdm_wm_center_window (GTK_WINDOW (login));
}
/* can it ever happen that it'd be NULL here ??? */
if (login->window != NULL) {
gdm_wm_init (GDK_WINDOW_XWINDOW (login->window));
......
......@@ -1905,11 +1905,17 @@ gdm_event (GSignalInvocationHint *ihint,
const GValue *param_values,
gpointer data)
{
GdkEvent *event;
/* HAAAAAAAAAAAAAAAAACK */
/* Since the user has not logged in yet and may have left/right
* mouse buttons switched, we just translate every right mouse click
* to a left mouse click */
GdkEvent *event = g_value_get_pointer ((GValue *)param_values);
if (n_param_values != 2 ||
!G_VALUE_HOLDS (&param_values[1], GDK_TYPE_EVENT))
return FALSE;
event = g_value_get_boxed (&param_values[1]);
if ((event->type == GDK_BUTTON_PRESS ||
event->type == GDK_2BUTTON_PRESS ||
event->type == GDK_3BUTTON_PRESS ||
......@@ -1955,6 +1961,9 @@ main (int argc, char *argv[])
gtk_rc_parse (gtkrc);
g_free (gtkrc);
/* evil, but oh well */
g_type_class_ref (GTK_TYPE_WIDGET);
/* also setup third button to work as first to work in reverse
* situations transparently */
sid = g_signal_lookup ("event",
......
......@@ -187,7 +187,7 @@ trap_push (void)
gdk_error_trap_push ();
}
static gboolean
static int
trap_pop (void)
{
trap_depth --;
......@@ -1087,6 +1087,18 @@ gdm_wm_init (Window login_window)
wm_root = DefaultRootWindow (wm_disp);
/* set event mask for events on root window */
XGetWindowAttributes (wm_disp, wm_root, &attribs);
XSelectInput (wm_disp, wm_root,
attribs.your_event_mask |
SubstructureNotifyMask |
SubstructureRedirectMask);
if (trap_pop () != 0)
return;
trap_push ();
add_all_current_windows ();
source = g_source_new (&event_funcs, sizeof (GSource));
......@@ -1099,13 +1111,6 @@ gdm_wm_init (Window login_window)
g_source_set_can_recurse (source, FALSE);
g_source_attach (source, NULL);
/* set event mask for events on root window */
XGetWindowAttributes (wm_disp, wm_root, &attribs);
XSelectInput (wm_disp, wm_root,
attribs.your_event_mask |
SubstructureNotifyMask |
SubstructureRedirectMask);
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