OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tk/] [doc/] [RestrictEv.3] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1990 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: RestrictEv.3,v 1.1.1.1 2002-01-16 10:25:48 markom Exp $
9
'\"
10
.so man.macros
11
.TH Tk_RestrictEvents 3 "" Tk "Tk Library Procedures"
12
.BS
13
.SH NAME
14
Tk_RestrictEvents \- filter and selectively delay X events
15
.SH SYNOPSIS
16
.nf
17
\fB#include \fR
18
.sp
19
Tk_RestrictProc *
20
\fBTk_RestrictEvents\fR(\fIproc, clientData, prevClientDataPtr\fR)
21
.SH ARGUMENTS
22
.AS Tk_RestrictProc **prevClientDataPtr
23
.AP Tk_RestrictProc *proc in
24
Predicate procedure to call to filter incoming X events.
25
NULL means do not restrict events at all.
26
.AP ClientData clientData in
27
Arbitrary argument to pass to \fIproc\fR.
28
.AP ClientData *prevClientDataPtr out
29
Pointer to place to save argument to previous restrict procedure.
30
.BE
31
 
32
.SH DESCRIPTION
33
.PP
34
This procedure is useful in certain situations where applications
35
are only prepared to receive certain X events.  After
36
\fBTk_RestrictEvents\fR is called, \fBTk_DoOneEvent\fR (and
37
hence \fBTk_MainLoop\fR) will filter X input events through
38
\fIproc\fR.  \fIProc\fR indicates whether a
39
given event is to be processed immediately, deferred until some
40
later time (e.g. when the event restriction is lifted), or discarded.
41
\fIProc\fR
42
is a procedure with arguments and result that match
43
the type \fBTk_RestrictProc\fR:
44
.CS
45
typedef Tk_RestrictAction Tk_RestrictProc(
46
        ClientData \fIclientData\fR,
47
        XEvent *\fIeventPtr\fR);
48
.CE
49
The \fIclientData\fR argument is a copy of the \fIclientData\fR passed
50
to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with
51
information it needs to filter events.  The \fIeventPtr\fR points to
52
an event under consideration.  \fIProc\fR returns a restrict action
53
(enumerated type \fBTk_RestrictAction\fR) that indicates what
54
\fBTk_DoOneEvent\fR should do with the event.  If the return value is
55
\fBTK_PROCESS_EVENT\fR, then the event will be handled immediately.
56
If the return value is \fBTK_DEFER_EVENT\fR, then the event will be
57
left on the event queue for later processing.  If the return value is
58
\fBTK_DISCARD_EVENT\fR, then the event will be removed from the event
59
queue and discarded without being processed.
60
.PP
61
\fBTk_RestrictEvents\fR uses its return value and \fIprevClientDataPtr\fR
62
to return information about the current event restriction procedure
63
(a NULL return value means there are currently no restrictions).
64
These values may be used to restore the previous restriction state
65
when there is no longer any need for the current restriction.
66
.PP
67
There are very few places where \fBTk_RestrictEvents\fR is needed.
68
In most cases, the best way to restrict events is by changing the
69
bindings with the \fBbind\fR Tcl command or by calling
70
\fBTk_CreateEventHandler\fR and \fBTk_DeleteEventHandler\fR from C.
71
The main place where \fBTk_RestrictEvents\fR must be used is when
72
performing synchronous actions (for example, if you need to wait
73
for a particular event to occur on a particular window but you don't
74
want to invoke any handlers for any other events).  The ``obvious''
75
solution in these situations is to call \fBXNextEvent\fR or
76
\fBXWindowEvent\fR, but these procedures cannot be used because
77
Tk keeps its own event queue that is separate from the X event
78
queue.  Instead, call \fBTk_RestrictEvents\fR to set up a filter,
79
then call \fBTk_DoOneEvent\fR to retrieve the desired event(s).
80
.SH KEYWORDS
81
delay, event, filter, restriction

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.