X11workbench Toolkit  1.0
Timer Functions

Functions

int CreateTimer (Display *pDisplay, Window wID, unsigned long lInterval, long lID, int iPeriodic)
 Creates a one-shot or periodic timer. More...
 
void DeleteTimer (Display *pDisplay, Window wID, long lID)
 Deletes an existing timer's resources. More...
 

Variables

Atom aWB_TIMER
 timer notifications generated by API More...
 

Detailed Description

The X11workbench Toolkit API has support for one-shot and periodic timer events that are generated via XClientEvent using aWB_TIMER.
These timer events are NOT hyper-accurate, although the timer event time is expressed in microseconds (for math efficiency and convenience). The message loop will check for 'crossing an event time' and generate events whenever a limit has been crossed. This means that event processing time can easily affect timer accuracy. Additionally, if a timer's period is less than the processing time of an event, a timer may be 'missed' as a a result. For this reason you should use a worker thread for timing that requires precise accuracy.

Function Documentation

◆ CreateTimer()

int CreateTimer ( Display *  pDisplay,
Window  wID,
unsigned long  lInterval,
long  lID,
int  iPeriodic 
)

Creates a one-shot or periodic timer.

Parameters
pDisplayThe display associated with the specified window
wIDThe window that receives the aWB_TIMER XClientEvent (None == application)
lIntervalThe timer interval in microseconds
lIDThe unique timer identifier
iPeriodicNon-zero for a recurring timer, zero for a 'one-shot' timer.
Returns
Non-zero on error, zero on success.

Timers can either be periodic (recurring), or one-shot. Use this function to create them. A timer created by this function must be subsequently deleted via DeleteTimer()

Header File: window_helper.h

See also
aWB_TIMER

Definition at line 3183 of file window_helper.c.

◆ DeleteTimer()

void DeleteTimer ( Display *  pDisplay,
Window  wID,
long  lID 
)

Deletes an existing timer's resources.

Parameters
pDisplayThe display associated with the specified window
wIDThe window associated with the timer
lIDThe unique ID associated with the timer

Timers created via CreateTimer() must be subsequently deleted using this function by passing the same Display, Window, and Timer 'unique' ID that were used to create it.

Header File: window_helper.h

See also
aWB_TIMER

Definition at line 3280 of file window_helper.c.

Variable Documentation

◆ aWB_TIMER

Atom aWB_TIMER

timer notifications generated by API

Mid-level timer handling generates WB_TIMER notifications via ClientMessage passed to the appropriate window, either periodic or 'one-shot'
See CreateTimer() for more information.

WB_TIMER message format (relative to XEvent.xclient)

type == ClientMessage
message_type == aWB_TIMER
format == 32 (always)
data.l[0] is the unique identifier associated with the timer
see also: CreateTimer(), DeleteTimer()timer notifications (generated by API)

Definition at line 417 of file window_helper.c.