RestrictEv.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" Copyright (c) 1990 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: RestrictEv.3,v 1.2 1998/09/14 18:22:53 stanton Exp $
- '"
- .so man.macros
- .TH Tk_RestrictEvents 3 "" Tk "Tk Library Procedures"
- .BS
- .SH NAME
- Tk_RestrictEvents - filter and selectively delay X events
- .SH SYNOPSIS
- .nf
- fB#include <tk.h>fR
- .sp
- Tk_RestrictProc *
- fBTk_RestrictEventsfR(fIproc, clientData, prevClientDataPtrfR)
- .SH ARGUMENTS
- .AS Tk_RestrictProc **prevClientDataPtr
- .AP Tk_RestrictProc *proc in
- Predicate procedure to call to filter incoming X events.
- NULL means do not restrict events at all.
- .AP ClientData clientData in
- Arbitrary argument to pass to fIprocfR.
- .AP ClientData *prevClientDataPtr out
- Pointer to place to save argument to previous restrict procedure.
- .BE
- .SH DESCRIPTION
- .PP
- This procedure is useful in certain situations where applications
- are only prepared to receive certain X events. After
- fBTk_RestrictEventsfR is called, fBTk_DoOneEventfR (and
- hence fBTk_MainLoopfR) will filter X input events through
- fIprocfR. fIProcfR indicates whether a
- given event is to be processed immediately, deferred until some
- later time (e.g. when the event restriction is lifted), or discarded.
- fIProcfR
- is a procedure with arguments and result that match
- the type fBTk_RestrictProcfR:
- .CS
- typedef Tk_RestrictAction Tk_RestrictProc(
- ClientData fIclientDatafR,
- XEvent *fIeventPtrfR);
- .CE
- The fIclientDatafR argument is a copy of the fIclientDatafR passed
- to fBTk_RestrictEventsfR; it may be used to provide fIprocfR with
- information it needs to filter events. The fIeventPtrfR points to
- an event under consideration. fIProcfR returns a restrict action
- (enumerated type fBTk_RestrictActionfR) that indicates what
- fBTk_DoOneEventfR should do with the event. If the return value is
- fBTK_PROCESS_EVENTfR, then the event will be handled immediately.
- If the return value is fBTK_DEFER_EVENTfR, then the event will be
- left on the event queue for later processing. If the return value is
- fBTK_DISCARD_EVENTfR, then the event will be removed from the event
- queue and discarded without being processed.
- .PP
- fBTk_RestrictEventsfR uses its return value and fIprevClientDataPtrfR
- 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.
- .PP
- There are very few places where fBTk_RestrictEventsfR is needed.
- In most cases, the best way to restrict events is by changing the
- bindings with the fBbindfR Tcl command or by calling
- fBTk_CreateEventHandlerfR and fBTk_DeleteEventHandlerfR from C.
- The main place where fBTk_RestrictEventsfR must be used is when
- performing synchronous actions (for example, if you need to wait
- for a particular event to occur on a particular window but you don't
- want to invoke any handlers for any other events). The ``obvious''
- solution in these situations is to call fBXNextEventfR or
- fBXWindowEventfR, but these procedures cannot be used because
- Tk keeps its own event queue that is separate from the X event
- queue. Instead, call fBTk_RestrictEventsfR to set up a filter,
- then call fBTk_DoOneEventfR to retrieve the desired event(s).
- .SH KEYWORDS
- delay, event, filter, restriction