Tk Library Procedures Tk_CreateGenericHandler(3TK)
_________________________________________________________________
NAME
Tk_CreateGenericHandler, Tk_DeleteGenericHandler - associate
procedure callback with all X eventsSYNOPSIS
#include
Tk_CreateGenericHandler(proc, clientData)
Tk_DeleteGenericHandler(proc, clientData)
ARGUMENTSTk_GenericProc *proc (in) Procedure to invoke
whenever any X event occurs on any display.ClientData clientData (in) Arbitrary one-word
value to pass to proc._________________________________________________________________
DESCRIPTION
Tk_CreateGenericHandler arranges for proc to be invoked in
the future whenever any X event occurs. This mechanism is not intended for dispatching X events on windows managed byTk (you should use Tk_CreateEventHandler for this purpose).
Tk_CreateGenericHandler is intended for other purposes, such
as tracing X events, monitoring events on windows not ownedby Tk, accessing X-related libraries that were not origi-
nally designed for use with Tk, and so on.The callback to proc will be made by Tk_HandleEvent; this
mechanism only works in programs that dispatch eventsthrough Tk_HandleEvent (or through other Tk procedures that
call Tk_HandleEvent, such as Tk_DoOneEvent or Tk_MainLoop).
Proc should have arguments and result that match the typeTk_GenericProc:
typedef int Tk_GenericProc(
ClientData clientData, XEvent *eventPtr); The clientData parameter to proc is a copy of the clientDataargument given to Tk_CreateGenericHandler when the callback
was created. Typically, clientData points to a data struc-
ture containing application-specific information about how
to handle events. EventPtr is a pointer to the X event. Tk Last change: 1Tk Library Procedures Tk_CreateGenericHandler(3TK)
Whenever an X event is processed by Tk_HandleEvent, proc is
called. The return value from proc is normally 0. A non-
zero return value indicates that the event is not to be han-
dled further; that is, proc has done all processing that is to be allowed for the event. If there are multiple generic event handlers, each one iscalled for each event, in the order in which they were esta-
blished.Tk_DeleteGenericHandler may be called to delete a
previously-created generic event handler: it deletes each
handler it finds that matches the proc and clientData argu-
ments. If no such handler exists, thenTk_DeleteGenericHandler returns without doing anything.
Although Tk supports it, it's probably a bad idea to have more than one callback with the same proc and clientData arguments. Establishing a generic event handler does nothing to ensure that the process will actually receive the X events that the handler wants to process. For example, it is the caller's responsibility to invoke XSelectInput to select the desired events, if that is necessary. KEYWORDS bind, callback, event, handlerATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:_______________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE|
|____________________|__________________|_
| Availability | runtime/tk-8 |
|____________________|__________________|_
| Interface Stability| Uncommitted ||____________________|_________________|
NOTES Source for Tk is available on http://opensolaris.org. Tk Last change: 2