[dia] Bug 637462 - Dynamic objects create useless wakeups
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 637462 - Dynamic objects create useless wakeups
- Date: Fri, 7 Jan 2011 21:34:15 +0000 (UTC)
commit 5d2156d9e8b6b16df8c25f3cba6bb058d9e45df4
Author: Hans Breuer <hans breuer org>
Date: Fri Jan 7 22:15:15 2011 +0100
Bug 637462 - Dynamic objects create useless wakeups
No timed wakeup at all if there are no dynamic objects in use. After all
they are mostly an easter-egg and there is only one implementation delivered
with Dia.
app/dynamic_refresh.c | 3 ++-
lib/dynamic_obj.c | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/app/dynamic_refresh.c b/app/dynamic_refresh.c
index cdbda96..a4b50b9 100644
--- a/app/dynamic_refresh.c
+++ b/app/dynamic_refresh.c
@@ -93,7 +93,8 @@ idle_handler (gpointer data)
}
}
idle_id = 0;
- return FALSE;
+ /* remove the idle handler if there is nothing to refresh */
+ return (new_timeout == 0);
}
void
diff --git a/lib/dynamic_obj.c b/lib/dynamic_obj.c
index a4f3a80..1673eb7 100644
--- a/lib/dynamic_obj.c
+++ b/lib/dynamic_obj.c
@@ -27,7 +27,7 @@ typedef struct {
guint timeout;
} DynobjRec;
-static GList* dyn_obj_list;
+static GList* dyn_obj_list = NULL;
void dynobj_list_add_object(DiaObject* obj, guint timeout) {
DynobjRec *dor = g_new(DynobjRec,1);
@@ -87,7 +87,10 @@ static void accum_timeout(gpointer data, gpointer user_data) {
guint dynobj_list_get_dynobj_rate(void) {
guint timeout = 250;
- g_list_foreach(dyn_obj_list,accum_timeout,&timeout);
+ if (dyn_obj_list)
+ g_list_foreach(dyn_obj_list,accum_timeout,&timeout);
+ else
+ timeout = 0; /* no objet to refresh, no timeout */
return timeout;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]