From ab7989217a7113a021f7e4d0cb45bfe2909d8be3 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sun, 5 Apr 1998 09:18:08 +0000 Subject: [PATCH] take expired timeouts into account, otherwise things like e.g. Sun Apr 5 09:35:55 1998 Tim Janik * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into account, otherwise things like e.g. spin-buttons don't work. also, count gtk_main_quit() as an event. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkmain.c | 37 +++++++++++++++++++++++++++++++------ 8 files changed, 73 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17d009b4cd..59edf8fd91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Apr 5 09:35:55 1998 Tim Janik + + * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into + account, otherwise things like e.g. spin-buttons don't work. + also, count gtk_main_quit() as an event. + Sun Apr 5 08:03:01 1998 Tim Janik * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 17d009b4cd..59edf8fd91 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Sun Apr 5 09:35:55 1998 Tim Janik + + * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into + account, otherwise things like e.g. spin-buttons don't work. + also, count gtk_main_quit() as an event. + Sun Apr 5 08:03:01 1998 Tim Janik * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 17d009b4cd..59edf8fd91 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Sun Apr 5 09:35:55 1998 Tim Janik + + * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into + account, otherwise things like e.g. spin-buttons don't work. + also, count gtk_main_quit() as an event. + Sun Apr 5 08:03:01 1998 Tim Janik * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 17d009b4cd..59edf8fd91 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Sun Apr 5 09:35:55 1998 Tim Janik + + * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into + account, otherwise things like e.g. spin-buttons don't work. + also, count gtk_main_quit() as an event. + Sun Apr 5 08:03:01 1998 Tim Janik * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 17d009b4cd..59edf8fd91 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Sun Apr 5 09:35:55 1998 Tim Janik + + * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into + account, otherwise things like e.g. spin-buttons don't work. + also, count gtk_main_quit() as an event. + Sun Apr 5 08:03:01 1998 Tim Janik * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 17d009b4cd..59edf8fd91 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Sun Apr 5 09:35:55 1998 Tim Janik + + * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into + account, otherwise things like e.g. spin-buttons don't work. + also, count gtk_main_quit() as an event. + Sun Apr 5 08:03:01 1998 Tim Janik * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 17d009b4cd..59edf8fd91 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Sun Apr 5 09:35:55 1998 Tim Janik + + * gtk/gtkmain.c (gtk_events_pending): take expired timeouts into + account, otherwise things like e.g. spin-buttons don't work. + also, count gtk_main_quit() as an event. + Sun Apr 5 08:03:01 1998 Tim Janik * gtk/gtkspinbutton.c: fixed panel allocation and stacking order, diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 283ba18310..4f24f27224 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -419,13 +419,38 @@ gtk_main_quit () gint gtk_events_pending (void) { - gint result = gdk_events_pending() + ((next_event != NULL) ? 1 : 0); + gint result = 0; + + /* if this function is called from a timeout which will only return + * if gtk needs processor time, we need to take iteration_done==TRUE + * into account as well. + */ + result = iteration_done; + result += next_event != NULL; + result += gdk_events_pending(); - if (idle_functions && - (((GtkIdleFunction *)idle_functions->data)->priority <= - GTK_PRIORITY_INTERNAL)) - result += 1; + result += current_idles != NULL; + result += current_timeouts != NULL; + if (!result) + { + result += (idle_functions && + (((GtkIdleFunction *)idle_functions->data)->priority <= + GTK_PRIORITY_INTERNAL)); + } + + if (!result && timeout_functions) + { + guint32 the_time; + GtkTimeoutFunction *timeoutf; + + the_time = gdk_time_get (); + + timeoutf = timeout_functions->data; + + result += timeoutf->interval <= (the_time - timeoutf->start); + } + return result; } @@ -1395,7 +1420,7 @@ gtk_handle_timeouts () } if (current_timeouts) - gtk_handle_current_timeouts(the_time); + gtk_handle_current_timeouts (the_time); } }