Commit 4c524a4f authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

on non-local displays, and on displays other then the primary :0 display,


Tue Jun 01 11:24:46 2004  George Lebl <jirka@5z.com>

	* gui/gdmlogin.c, gui/greeter/greeter_item_canvas.c,
	  gui/greeter/greeter.c, gui/gdmchooser.c, gui/gdmcommon.[ch]:
	  on non-local displays, and on displays other then the primary
	  :0 display, disable cursor blinking after 20 seconds of
	  inactivity as it eats bandwidth and cpu for nothing.
	  Should fix #135764

	* gui/gdmwm.c: minor cosmetic cleanup
parent 0d763c83
Tue Jun 01 11:24:46 2004 George Lebl <jirka@5z.com>
* gui/gdmlogin.c, gui/greeter/greeter_item_canvas.c,
gui/greeter/greeter.c, gui/gdmchooser.c, gui/gdmcommon.[ch]:
on non-local displays, and on displays other then the primary
:0 display, disable cursor blinking after 20 seconds of
inactivity as it eats bandwidth and cpu for nothing.
Should fix #135764
* gui/gdmwm.c: minor cosmetic cleanup
Fri May 28 12:53:42 2004 George Lebl <jirka@5z.com>
* config/XKeepsCrashing, config/PreSession.in,
......
......@@ -81,6 +81,7 @@ gdmchooser_LDFLAGS = -export-dynamic
gdmchooser_LDADD = \
$(EXTRA_CHOOSER_LIBS) \
libgdmwm.a \
libgdmcommon.a \
$(GUIGLADE_LIBS) \
$(X_LIBS) \
$(XDMCP_LIBS) \
......
......@@ -166,6 +166,19 @@ static gboolean GdmMulticast;
static gchar *GdmMulticastAddr;
#endif
/* HACK: for gdmcommon, else it complains */
/* */ gchar *GdmInfoMsgFile;
/* */ gchar *GdmInfoMsgFont;
/* */ gchar *GdmSoundProgram;
/* */ gboolean GdmSoundOnLogin;
/* */ gchar *GdmSoundOnLoginFile;
/* */ void
/* */ gdm_kill_thingies (void)
/* */ {
/* */ ; /* nothing */
/* */ }
enum {
GDM_BACKGROUND_NONE = 0,
GDM_BACKGROUND_IMAGE = 1,
......@@ -1808,6 +1821,11 @@ gdm_chooser_gui_init (void)
gtk_window_resize (GTK_WINDOW (chooser),
width, height);
/* cursor blinking is evil on remote displays, don't do it forever */
gdm_setup_blinking ();
gdm_setup_blinking_entry (add_entry);
if (RUNNING_UNDER_GDM) {
gtk_widget_show_now (chooser);
gdm_wm_center_window (GTK_WINDOW (chooser));
......
......@@ -244,3 +244,107 @@ gdm_common_login_sound (void)
fflush (stdout);
}
}
typedef struct {
GtkWidget *entry;
gboolean blink;
} EntryBlink;
static GSList *entries = NULL;
static guint noblink_timeout = 0;
#define NOBLINK_TIMEOUT (20*1000)
static void
setup_blink (gboolean blink)
{
GSList *li;
for (li = entries; li != NULL; li = li->next) {
EntryBlink *eb = li->data;
if (eb->blink) {
GtkSettings *settings
= gtk_widget_get_settings (eb->entry);
g_object_set (settings,
"gtk-cursor-blink", blink, NULL);
gtk_widget_queue_resize (eb->entry);
}
}
}
static gboolean
no_blink (gpointer data)
{
noblink_timeout = 0;
setup_blink (FALSE);
return FALSE;
}
static gboolean
delay_noblink (GSignalInvocationHint *ihint,
guint n_param_values,
const GValue *param_values,
gpointer data)
{
setup_blink (TRUE);
if (noblink_timeout > 0)
g_source_remove (noblink_timeout);
noblink_timeout
= g_timeout_add (NOBLINK_TIMEOUT, no_blink, NULL);
return TRUE;
}
void
gdm_setup_blinking (void)
{
guint sid;
if ( ! ve_string_empty (g_getenv ("GDM_IS_LOCAL")) &&
strncmp (ve_sure_string (g_getenv ("DISPLAY")), ":0", 2) == 0)
return;
sid = g_signal_lookup ("activate",
GTK_TYPE_MENU_ITEM);
g_signal_add_emission_hook (sid,
0 /* detail */,
delay_noblink,
NULL /* data */,
NULL /* destroy_notify */);
sid = g_signal_lookup ("key_press_event",
GTK_TYPE_WIDGET);
g_signal_add_emission_hook (sid,
0 /* detail */,
delay_noblink,
NULL /* data */,
NULL /* destroy_notify */);
sid = g_signal_lookup ("button_press_event",
GTK_TYPE_WIDGET);
g_signal_add_emission_hook (sid,
0 /* detail */,
delay_noblink,
NULL /* data */,
NULL /* destroy_notify */);
noblink_timeout = g_timeout_add (NOBLINK_TIMEOUT, no_blink, NULL);
}
void
gdm_setup_blinking_entry (GtkWidget *entry)
{
EntryBlink *eb;
GtkSettings *settings;
if ( ! ve_string_empty (g_getenv ("GDM_IS_LOCAL")) &&
strncmp (ve_sure_string (g_getenv ("DISPLAY")), ":0", 2) == 0)
return;
eb = g_new0 (EntryBlink, 1);
eb->entry = entry;
settings = gtk_widget_get_settings (eb->entry);
g_object_get (settings, "gtk-cursor-blink", &(eb->blink), NULL);
entries = g_slist_prepend (entries, eb);
}
......@@ -45,4 +45,7 @@ void gdm_common_login_sound (void);
/* The greeter defines this, we just call it from here */
void gdm_kill_thingies (void);
void gdm_setup_blinking (void);
void gdm_setup_blinking_entry (GtkWidget *entry);
#endif /* GDM_COMMON_H */
......@@ -3033,6 +3033,10 @@ gdm_login_gui_init (void)
g_signal_connect (G_OBJECT(entry), "activate",
G_CALLBACK (gdm_login_enter),
NULL);
/* cursor blinking is evil on remote displays, don't do it forever */
gdm_setup_blinking ();
gdm_setup_blinking_entry (entry);
hline2 = gtk_hseparator_new ();
gtk_widget_ref (hline2);
......
......@@ -1090,14 +1090,14 @@ event_prepare (GSource *source,
gint *timeout)
{
*timeout = -1;
return XPending (wm_disp);
return XPending (wm_disp) > 0;
}
static gboolean
event_check (GSource *source)
{
if (event_poll_fd.revents & G_IO_IN) {
return XPending (wm_disp);
return XPending (wm_disp) > 0;
} else {
return FALSE;
}
......@@ -1106,7 +1106,7 @@ event_check (GSource *source)
static void
process_events (void)
{
while (XPending (wm_disp)) {
while (XPending (wm_disp) > 0) {
XEvent ev;
XNextEvent (wm_disp, &ev);
event_process (&ev);
......
......@@ -1293,6 +1293,8 @@ main (int argc, char *argv[])
greeter_setup_items ();
gdm_setup_blinking ();
gtk_widget_show_all (window);
gtk_window_move (GTK_WINDOW (window), gdm_wm_screen.x, gdm_wm_screen.y);
gtk_widget_show_now (window);
......
......@@ -386,6 +386,9 @@ greeter_item_create_canvas_item (GreeterItemInfo *item)
"width", (double)rect.width,
NULL);
/* cursor blinking is evil on remote displays, don't do it forever */
gdm_setup_blinking_entry (entry);
break;
case GREETER_ITEM_TYPE_LIST:
......
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