#include <tk.h> Tk_RestrictProc * Tk_RestrictEvents(proc, arg, prevArgPtr)
This procedure is useful in certain situations where applications are only prepared to receive certain X events. After Tk_RestrictEvents is called, Tk_DoOneEvent (and hence Tk_MainLoop) will filter X input events through proc. Proc indicates whether a given event is to be processed immediately or deferred until some later time (e.g. when the event restriction is lifted). Proc is a standard X predicate procedure, of the sort passed to XCheckIfEvent. It must have arguments and result that match the type Tk_RestrictProc:
Tk_RestrictEvents uses its return value and prevArgPtr to return information about the current event restriction procedure (a NULL return value means there are currently no restrictions). These values may be used to restore the previous restriction state when there is no longer any need for the current restriction.
There are very few places where Tk_RestrictEvents is needed. Please use it only where it is absolutely necessary. If only a local restriction is needed, it can probably be achieved more cleanly by changing event-to-Tcl bindings or by calling Tk_DeleteEventHandler.