CrtGenHdlr.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" Copyright (c) 1992-1994 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: CrtGenHdlr.3,v 1.2 1998/09/14 18:22:46 stanton Exp $
- '"
- .so man.macros
- .TH Tk_CreateGenericHandler 3 "" Tk "Tk Library Procedures"
- .BS
- .SH NAME
- Tk_CreateGenericHandler, Tk_DeleteGenericHandler - associate procedure callback with all X events
- .SH SYNOPSIS
- .nf
- fB#include <tk.h>fR
- .sp
- fBTk_CreateGenericHandlerfR(fIproc, clientDatafR)
- .sp
- fBTk_DeleteGenericHandlerfR(fIproc, clientDatafR)
- .SH ARGUMENTS
- .AS "Tk_GenericProc" clientData
- .AP Tk_GenericProc *proc in
- Procedure to invoke whenever any X event occurs on any display.
- .AP ClientData clientData in
- Arbitrary one-word value to pass to fIprocfR.
- .BE
- .SH DESCRIPTION
- .PP
- fBTk_CreateGenericHandlerfR arranges for fIprocfR to be
- invoked in the future whenever any X event occurs. This mechanism is
- fInotfR intended for dispatching X events on windows managed by Tk
- (you should use fBTk_CreateEventHandlerfR for this purpose).
- fBTk_CreateGenericHandlerfR is intended for other purposes, such
- as tracing X events, monitoring events on windows not owned by Tk,
- accessing X-related libraries that were not originally designed for
- use with Tk, and so on.
- .PP
- The callback to fIprocfR will be made by fBTk_HandleEventfR;
- this mechanism only works in programs that dispatch events
- through fBTk_HandleEventfR (or through other Tk procedures that
- call fBTk_HandleEventfR, such as fBTk_DoOneEventfR or
- fBTk_MainLoopfR).
- .PP
- fIProcfR should have arguments and result that match the
- type fBTk_GenericProcfR:
- .CS
- typedef int Tk_GenericProc(
- ClientData fIclientDatafR,
- XEvent *fIeventPtrfR);
- .CE
- The fIclientDatafR parameter to fIprocfR is a copy of the fIclientDatafR
- argument given to fBTk_CreateGenericHandlerfR when the callback
- was created. Typically, fIclientDatafR points to a data
- structure containing application-specific information about
- how to handle events.
- fIEventPtrfR is a pointer to the X event.
- .PP
- Whenever an X event is processed by fBTk_HandleEventfR, fIprocfR
- is called. The return value from fIprocfR is normally 0.
- A non-zero return value indicates that the event is not to be handled
- further; that is, fIprocfR has done all processing that is to be
- allowed for the event.
- .PP
- If there are multiple generic event handlers, each one is called
- for each event, in the order in which they were established.
- .PP
- fBTk_DeleteGenericHandlerfR may be called to delete a
- previously-created generic event handler: it deletes each handler
- it finds that matches the fIprocfR and fIclientDatafR arguments. If
- no such handler exists, then fBTk_DeleteGenericHandlerfR returns
- without doing anything. Although Tk supports it, it's probably
- a bad idea to have more than one callback with the same
- fIprocfR and fIclientDatafR arguments.
- .PP
- 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
- fBXSelectInputfR to select the desired events, if that is necessary.
- .SH KEYWORDS
- bind, callback, event, handler