Commit 10e32d10 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

whack the redundant queries for halt, reboot and suspend, we already have

Mon Aug 19 16:50:30 2002  George Lebl <jirka@5z.com>

	* gui/greeter/greeter_system.c: whack the redundant queries for
	  halt, reboot and suspend, we already have a dialog the person
	  answers.  Fixes #90971

	* gui/greeter/greeter_item_capslock.c: include libgnome.h

	* gui/gdmsetup.c: Listen for a property on the root window
	  _GDM_SETUP_INSENSITIVE and if non-zero make self insensitive

	* daemon/slave.c: when restarting the greeter set the above property
	  to make the setup be insensitive for a bit.  This makes sure the
	  user doesn't twiddle with the interface which could make things
	  weird looking, especially if the user twiddles greeter settings or
	  opens new windows.
parent b953c7bb
Mon Aug 19 16:50:30 2002 George Lebl <jirka@5z.com>
* gui/greeter/greeter_system.c: whack the redundant queries for
halt, reboot and suspend, we already have a dialog the person
answers. Fixes #90971
* gui/greeter/greeter_item_capslock.c: include libgnome.h
* gui/gdmsetup.c: Listen for a property on the root window
_GDM_SETUP_INSENSITIVE and if non-zero make self insensitive
* daemon/slave.c: when restarting the greeter set the above property
to make the setup be insensitive for a bit. This makes sure the
user doesn't twiddle with the interface which could make things
weird looking, especially if the user twiddles greeter settings or
opens new windows.
Mon Aug 19 12:17:22 2002 George Lebl <jirka@5z.com>
* pixmaps/gdm.png: my gf didn't like my other icon so of course ... I
......
......@@ -40,6 +40,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#ifdef HAVE_LIBXINERAMA
#include <X11/extensions/Xinerama.h>
#endif
......@@ -67,6 +68,7 @@ static GdmDisplay *d;
static gchar *login = NULL;
static sigset_t mask;
static gboolean greet = FALSE;
static gboolean configurator = FALSE;
static gboolean remanage_asap = FALSE;
static gboolean do_timed_login = FALSE; /* if this is true,
login the timed login */
......@@ -187,6 +189,38 @@ check_notifies_now (void)
g_list_free (list);
}
static void
gdm_slave_desensitize_config (void)
{
if (configurator &&
d->dsp != NULL) {
gulong foo = 1;
Atom atom = XInternAtom (d->dsp,
"_GDM_SETUP_INSENSITIVE",
False);
XChangeProperty (d->dsp,
DefaultRootWindow (d->dsp),
atom,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) &foo, 1);
XSync (d->dsp, False);
}
}
static void
gdm_slave_sensitize_config (void)
{
if (d->dsp != NULL) {
XDeleteProperty (d->dsp,
DefaultRootWindow (d->dsp),
XInternAtom (d->dsp,
"_GDM_SETUP_INSENSITIVE",
False));
XSync (d->dsp, False);
}
}
/* ignore handlers */
static int
ignore_xerror_handler (Display *disp, XErrorEvent *evt)
......@@ -878,6 +912,7 @@ run_config (GdmDisplay *display, struct passwd *pwent)
_exit (0);
} else {
configurator = TRUE;
/* XXX: is this a race if we don't push a sigchld block?
* but then we don't get a signal for restarting the greeter */
/* wait for the config proggie to die */
......@@ -887,12 +922,15 @@ run_config (GdmDisplay *display, struct passwd *pwent)
* handler */
ve_waitpid_no_signal (pid, 0, 0);
display->sesspid = 0;
configurator = FALSE;
}
}
static void
restart_the_greeter (void)
{
gdm_slave_desensitize_config ();
/* no login */
g_free (login);
login = NULL;
......@@ -924,6 +962,8 @@ restart_the_greeter (void)
if (greeter_no_focus)
gdm_slave_greeter_ctl_no_ret (GDM_NOFOCUS, "");
gdm_slave_sensitize_config ();
}
static void
......@@ -3095,6 +3135,8 @@ gdm_slave_child_handler (int sig)
if (pid == d->greetpid && greet) {
if (WIFEXITED (status) &&
WEXITSTATUS (status) == DISPLAY_RESTARTGREETER) {
gdm_slave_desensitize_config ();
greet = FALSE;
d->greetpid = 0;
whack_greeter_fds ();
......
......@@ -64,6 +64,27 @@ setup_cursor (GdkCursorType type)
gdk_cursor_unref (cursor);
}
static void
setup_window_cursor (GdkCursorType type)
{
GdkCursor *cursor = gdk_cursor_new (type);
GtkWidget *setup_dialog = glade_helper_get
(xml, "setup_dialog", GTK_TYPE_WINDOW);
if (setup_dialog->window)
gdk_window_set_cursor (setup_dialog->window, cursor);
gdk_cursor_unref (cursor);
}
static void
unsetup_window_cursor (void)
{
GtkWidget *setup_dialog = glade_helper_get
(xml, "setup_dialog", GTK_TYPE_WINDOW);
if (setup_dialog->window)
gdk_window_set_cursor (setup_dialog->window, NULL);
}
static void
update_greeters (void)
{
......@@ -1873,6 +1894,88 @@ setup_gui (void)
GDM_KEY_WELCOME);
}
static gboolean
get_sensitivity (void)
{
static Atom atom = 0;
Display *disp = gdk_x11_get_default_xdisplay ();
Window root = gdk_x11_get_default_root_xwindow ();
gulong *data;
gulong nitems_return;
gulong bytes_after_return;
Atom type_returned;
int format_returned;
if (atom == 0)
atom = XInternAtom (disp, "_GDM_SETUP_INSENSITIVE", False);
if (XGetWindowProperty (disp,
root,
atom,
0, 1,
False,
XA_CARDINAL,
&type_returned, &format_returned,
&nitems_return,
&bytes_after_return,
(unsigned char **)&data) != Success)
return TRUE;
if (format_returned != 32 ||
data[0] == 0) {
XFree (data);
return TRUE;
} else {
XFree (data);
return FALSE;
}
}
static void
update_sensitivity (void)
{
gboolean sensitive = get_sensitivity ();
GtkWidget *setup_dialog = glade_helper_get (xml, "setup_dialog",
GTK_TYPE_WINDOW);
gtk_widget_set_sensitive (setup_dialog, sensitive);
if (sensitive)
unsetup_window_cursor ();
else
setup_window_cursor (GDK_WATCH);
}
static GdkFilterReturn
root_window_filter (GdkXEvent *gdk_xevent,
GdkEvent *event,
gpointer data)
{
XEvent *xevent = (XEvent *)gdk_xevent;
if (xevent->type == PropertyNotify)
update_sensitivity ();
return GDK_FILTER_CONTINUE;
}
static void
setup_disable_handler (void)
{
XWindowAttributes attribs = { 0, };
Display *disp = gdk_x11_get_default_xdisplay ();
Window root = gdk_x11_get_default_root_xwindow ();
update_sensitivity ();
/* set event mask for events on root window */
XGetWindowAttributes (disp, root, &attribs);
XSelectInput (disp, root,
attribs.your_event_mask |
PropertyChangeMask);
gdk_window_add_filter (gdk_get_default_root_window (),
root_window_filter, NULL);
}
static gboolean
gdm_event (GSignalInvocationHint *ihint,
guint n_param_values,
......@@ -1978,8 +2081,11 @@ main (int argc, char *argv[])
setup_gui ();
if (RUNNING_UNDER_GDM)
if (RUNNING_UNDER_GDM) {
setup_disable_handler ();
setup_cursor (GDK_LEFT_PTR);
}
gtk_main ();
......
#include "config.h"
#include <gtk/gtk.h>
#include <libgnome/libgnome.h>
#include <gdk/gdkkeysyms.h>
#include <string.h>
#include <gdk/gdkx.h>
......
......@@ -49,32 +49,32 @@ working_command_exists (const char *commands)
static void
greeter_reboot_handler (void)
{
if (greeter_query (_("Are you sure you want to reboot the machine?"))) {
/*if (greeter_query (_("Are you sure you want to reboot the machine?"))) {*/
closelog();
_exit (DISPLAY_REBOOT);
}
/*}*/
}
static void
greeter_halt_handler (void)
{
if (greeter_query (_("Are you sure you want to shut down the machine?"))) {
/* if (greeter_query (_("Are you sure you want to shut down the machine?"))) { */
closelog();
_exit (DISPLAY_HALT);
}
/* } */
}
static void
greeter_suspend_handler (void)
{
if (greeter_query (_("Are you sure you want to suspend the machine?"))) {
/* if (greeter_query (_("Are you sure you want to suspend the machine?"))) { */
closelog();
_exit (DISPLAY_SUSPEND);
}
/* } */
}
static void
......
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