From 238afb907d7114d76aa254f5afe3875e18c009f9 Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 2 Mar 2012 16:01:48 +0200 Subject: [PATCH] Created TimerStart --- src/motif.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/motif.c b/src/motif.c index e7f3d724..4ad0245e 100644 --- a/src/motif.c +++ b/src/motif.c @@ -1225,18 +1225,22 @@ static void timer_proc(XtPointer client_data, XtIntervalId *id) cbdata->timer_id = 0; } -static void sp_ev_proc(void *anydata) +void TimerStart(unsigned long interval, Timer_CBdata *cbdata) { - Spin_CBdata *cbdata = (Spin_CBdata *) anydata; - Timer_CBdata *tcbdata = (Timer_CBdata *) cbdata->tcbdata; - /* we count elapsed time since the last event, so first remove an existing timeout, if there is one */ - if (tcbdata->timer_id) { - XtRemoveTimeOut(tcbdata->timer_id); + if (cbdata->timer_id) { + XtRemoveTimeOut(cbdata->timer_id); } - tcbdata->timer_id = XtAppAddTimeOut(app_con, - 250 /* 0.25 second */, timer_proc, tcbdata); + + cbdata->timer_id = XtAppAddTimeOut(app_con, interval, timer_proc, cbdata); +} + +static void sp_ev_proc(void *anydata) +{ + Spin_CBdata *cbdata = (Spin_CBdata *) anydata; + + TimerStart(250 /* 0.25 second */, cbdata->tcbdata); } void AddSpinChoiceCB(SpinStructure *spinp, Spin_CBProc cbproc, void *anydata) -- 2.11.4.GIT