T.R | Title | User | Personal Name | Date | Lines |
---|
1168.1 | timers? | LENSMN::bonini | We apologize for the inconvenience. | Tue Jul 25 1989 10:33 | 5 |
|
Why not simply set a timer at startup and reset the timer when you get
a mouse or key press event from X? If the timer expires, your program exits.
|
1168.2 | | TAVPRO::HAREL_B | Hanoch Harel SWAS Israel | Tue Jul 25 1989 13:14 | 6 |
|
> Why not simply set a timer at startup and reset the timer when you get
> a mouse or key press event from X? If the timer expires, your program exits.
Its quite costly to reset timers every pointer motion.
|
1168.3 | Depending on granularity, it can be easy | PRNSYS::LOMICKAJ | Jeff Lomicka | Tue Jul 25 1989 13:57 | 13 |
| If the exact duration of the delay is not critical, you can start a
timer, and keep a counter for each "activity" you detect. Incrementing
the counter on each event should not be very expensive. When the timer
expires, if the counter is non-zero, you have seen activity. Zero the
counter and re-submit the timer. If the counter is still zero, then
there was no activity during the preceeding timer interval.
If you wanted, say, a 30 minute timer, you could fire it at 1-minute
intervals without incurring much overhead at all. When you accumulate
30 of them with no activity, you triger your inactivity event handler.
|
1168.4 | No X magic...just a little hacking | DECWIN::FISHER | Burns Fisher 381-1466, ZKO3-4/W23 | Tue Jul 25 1989 14:01 | 19 |
| Try something like this: (A little crude, but...)
Clear flag1, set flag2.
Set a timer to go off every n minutes
When you get an event, set flag1.
When the timer goes off, if flag1 and flag2 are both clear, then timeout,
else if flag2 = flag1; clear flag1
This should give you a timeout with no activity in n minutes � n. For
finer granularity make flag 2 a counter, set n to the granularity you want
and increment flag2 to count the number of times you have come through the
timer without having an event.
Burns
|
1168.5 | | CASEE::LACROIX | Object oriented dog food? No, sorry | Tue Jul 25 1989 14:04 | 12 |
| >> Why not simply set a timer at startup and reset the timer when you get
>> a mouse or key press event from X? If the timer expires, your program exits.
>
> Its quite costly to reset timers every pointer motion.
You don't have to reset the timer for every event! Just remember the
time when you got the last event, and when the timer triggers, decide
whether you want to reset the timer (with a new computed value) or
exit.
Denis.
|
1168.6 | Three great minds... | DECWIN::FISHER | Burns Fisher 381-1466, ZKO3-4/W23 | Tue Jul 25 1989 14:10 | 1 |
|
|
1168.7 | Thanx you all | TAVPRO::HAREL_B | Hanoch Harel SWAS Israel | Thu Jul 27 1989 01:52 | 2 |
|
|