Version 2 of Tk_CreateGenericHandler

Updated 2005-04-05 06:30:32

George Peter Staplin April 4, 2005: Tk_CreateGenericHandler is a public C function provided by the Tk library. It's accessible through stubs as well.

DOCUMENTATION:

http://www.tcl.tk/man/tcl8.5/TkLib/CrtGenHdlr.htm

In Tk_MainLoop (the Tk event loop) Tcl_DoOneEvent is called. The code path eventually reaches Tk_HandleEvent. Where a list of generic-handler function pointers are iterated and called. Each generic handler is passed an XEvent.

If the generic handler returns non-zero the XEvent is considered processed fully, and Tk_HandleEvent returns.

If the generic handler returns 0 then Tk will attempt to pass the XEvent to any handlers it's suited for.

USED FOR:

Tk_CreateGenericHandler is useful for creating window managers for systems running X.

BUGS:

For years the ClientMessage and GenericHandler code was broken. The ClientMessage handling would overwrite the GenericHandler data. This is thought to have been a copy and paste bug. I fixed it in the 8.5 HEAD during refactoring. It should be in 8.5a2+ as well. It is not known how many people this bug effected. ClientMessage and GenericHandler handlers should work well together now.


Category Tk Library