*add* changed everything to kernel timer for easier integration with new timer

*todo* adapt tooltip also to the timer syntax
*fix* memory leak



git-svn-id: http://tint2.googlecode.com/svn/trunk@266 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
Andreas.Fink85
2009-11-15 16:55:50 +00:00
parent 429660abb6
commit 806451955b
9 changed files with 113 additions and 87 deletions

View File

@@ -32,8 +32,9 @@
#include "server.h"
#include "panel.h"
#include "tooltip.h"
#include "timer.h"
static int urgent_timer = 0;
Task *add_task (Window win)
{
@@ -411,6 +412,21 @@ void active_task()
}
void blink_urgent()
{
GSList* urgent_task = urgent_list;
while (urgent_task) {
Task_urgent* t = urgent_task->data;
if ( t->tick < max_tick_urgent) {
t->tsk->area.is_active = !t->tsk->area.is_active;
t->tsk->area.redraw = 1;
t->tick++;
}
urgent_task = urgent_task->next;
}
}
void add_urgent(Task *tsk)
{
// first check if task is already in the list and reset the counter
@@ -431,7 +447,11 @@ void add_urgent(Task *tsk)
t->tsk = tsk;
t->tick = 0;
urgent_list = g_slist_prepend(urgent_list, t);
time_precision = 1;
if (urgent_timer == 0)
urgent_timer = install_timer(0, 1000000, 1, 0, blink_urgent);
else
reset_timer(urgent_timer, 0, 1000000, 1, 0);
}
@@ -444,7 +464,7 @@ void del_urgent(Task *tsk)
urgent_list = g_slist_remove(urgent_list, t);
free(t);
if (!urgent_list)
init_precision();
reset_timer(urgent_timer, 0, 0, 0, 0);
return;
}
urgent_task = urgent_task->next;