Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / grab.pod
CommitLineData
86530b38
AT
1# Copyright (c) 1992 The Regents of the University of California.
2# Copyright (c) 1994-1996 Sun Microsystems, Inc.
3# See the file "license.terms" for information on usage and redistribution
4# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5#
6#
7
8=head1 NAME
9
10grab - Confine pointer and keyboard events to a window sub-tree
11
12=for category User Interaction
13
14=head1 SYNOPSIS
15
16I<$widget>-E<gt>B<grab>
17
18I<$widget>-E<gt>B<grab>I<Option>
19
20=head1 DESCRIPTION
21
22This set of methods implement simple pointer and keyboard grabs for Tk.
23Tk's grabs are different than the grabs
24described in the Xlib documentation.
25When a grab is set for a particular window, Tk restricts all pointer
26events to the grab window and its descendants in Tk's window hierarchy.
27Whenever the pointer is within the grab window's subtree, the pointer
28will behave exactly the same as if there had been no grab at all
29and all events will be reported in the normal fashion.
30When the pointer is outside I<$widget>'s tree, button presses and
31releases and
32mouse motion events are reported to I<$widget>, and window entry
33and window exit events are ignored.
34The grab subtree ``owns'' the pointer:
35windows outside the grab subtree will be visible on the screen
36but they will be insensitive until the grab is released.
37The tree of windows underneath the grab window can include top-level
38windows, in which case all of those top-level windows
39and their descendants will continue to receive mouse events
40during the grab.
41
42Two forms of grabs are possible: local and global.
43A local grab affects only the grabbing application: events will
44be reported to other applications as if the grab had never occurred.
45Grabs are local by default.
46A global grab locks out all applications on the screen,
47so that only the given subtree of the grabbing application will be
48sensitive to pointer events (mouse button presses, mouse button releases,
49pointer motions, window entries, and window exits).
50During global grabs the window manager will not receive pointer
51events either.
52
53During local grabs, keyboard events (key presses and key releases)
54are delivered as usual: the window
55manager controls which application receives keyboard events, and
56if they are sent to any window in the grabbing application then they are
57redirected to the focus window.
58During a global grab Tk grabs the keyboard so that all keyboard events
59are always sent to the grabbing application.
60The B<focus> method is still used to determine which window in the
61application receives the keyboard events.
62The keyboard grab is released when the grab is released.
63
64Grabs apply to particular displays. If an application has windows
65on multiple displays then it can establish a separate grab on each
66display.
67The grab on a particular display affects only the windows on
68that display.
69It is possible for different applications on a single display to have
70simultaneous local grabs, but only one application can have a global
71grab on a given display at once.
72
73The B<grab> methods take any of the following forms:
74
75=over 4
76
77=item I<$widget>-E<gt>B<grabCurrent>
78
79Returns the current grab
80window in this application for I<$widget>'s display, or an empty
81string if there is no such window.
82
83=item I<$widget>-E<gt>B<grabs>
84
85Returns a list whose elements
86are all of the windows grabbed by this application for all displays,
87or an empty string if the application has no grabs.
88
89I<Not implemented yet!>
90
91=item I<$widget>-E<gt>B<grabRelease>
92
93Releases the grab on I<$widget> if there is one, otherwise does
94nothing. Returns an empty string.
95
96=item I<$widget>-E<gt>B<grab>
97
98Sets a local grab on I<$widget>.
99If a grab was already in effect for this application on
100I<$widget>'s display then it is automatically released.
101If there is already a local grab on I<$widget>, then the command
102does nothing. Returns an empty string.
103
104=item I<$widget>-E<gt>B<grabGlobal>
105
106Sets a global grab on I<$widget>.
107If a grab was already in effect for this application on
108I<$widget>'s display then it is automatically released.
109If there is already a global grab on I<$widget>,
110then the command does nothing. Returns an empty string.
111
112=item I<$widget>-E<gt>B<grabStatus>
113
114Returns B<none> if no grab is currently set on I<$widget>,
115B<local> if a local grab is set on I<$widget>, and
116B<global> if a global grab is set.
117
118=back
119
120=head1 BUGS
121
122It took an incredibly complex and gross implementation to produce
123the simple grab effect described above.
124Given the current implementation, it isn't safe for applications
125to use the Xlib grab facilities at all except through the Tk grab
126procedures.
127If applications try to manipulate X's grab mechanisms directly,
128things will probably break.
129
130If a single process is managing several different Tk applications,
131only one of those applications can have a local grab for a given
132display at any given time. If the applications are in different
133processes, this restriction doesn't exist.
134
135=head1 KEYWORDS
136
137grab, keyboard events, pointer events, window
138
139=cut
140