head	1.11;
access;
symbols
	core-8-5-9:1.8
	core-8-5-8:1.8
	macosx-cocoa-merge:1.11
	macosx-cocoa-premerge:1.11
	macosx-carbon-freeze:1.11
	core-8-5-7:1.8
	core-8-5-6:1.8
	core-8-6-b1:1.11
	core-8-6-a3:1.10
	core-8-5-5:1.8
	core-8-6-a2:1.9
	core-8-5-4:1.8
	core-8-5-3:1.8
	core-8-6-a1:1.8
	core-8-4-19:1.2.26.1
	core-8-5-branch:1.8.0.2
	core-8-5-2:1.8
	core-8-4-18:1.2.26.1
	core-8-5-1:1.8
	core-8-4-17:1.2.26.1
	core-8-5-0:1.8
	core-8-5-b3:1.7
	core-8-5-b2:1.6
	core-8-4-16:1.2.26.1
	core-8-5-b1:1.4
	core-stablilizer-merge:1.4
	core-stabilizer-branch:1.4.0.2
	core-stabilizer-merge:1.8
	core-8-4-15:1.2.26.1
	core-8-5-a6:1.4
	core-8-5-a5:1.4
	core-8-4-14:1.2.26.1
	core-8-5-a4:1.4
	core-8-4-13:1.2.26.1
	core-8-4-12:1.2.26.1
	core-8-4-11:1.2.26.1
	core-8-5-a3:1.4
	core-8-4-10:1.2.26.1
	core-8-4-9-branch:1.2.26.1.0.2
	core-8-5-a2:1.4
	core-8-4-9:1.2.26.1
	core-8-4-8:1.2.26.1
	core-8-4-7:1.2
	core-8-5-a1:1.2
	core-8-4-6:1.2
	core-8-4-5:1.2
	mistachkin-dev-branch:1.2.0.28
	core-8-4-4:1.2
	core-8-4-3:1.2
	core-8-4-branch:1.2.0.26
	core-8-4-2:1.2
	core-8-4-1:1.2
	core-8-3-5:1.2
	core-8-4-0:1.2
	macosx-8-4-merge-2002-08-31-trunk:1.2
	macosx-8-4-premerge-2002-08-31-branch:1.2
	macosx-8-4-premerge-2002-08-31-trunk:1.2
	macosx-8-4-merge-2002-08-30-branch:1.2
	macosx-8-4-merge-2002-08-30-trunk:1.2
	macosx-8-4-merge-2002-08-20-branch:1.2
	macosx-8-4-merge-2002-08-20-trunk:1.2
	core-8-4-b2:1.2
	core-8-4-b1:1.2
	macosx-premerge-6-9-02:1.2
	core-8-4-a4:1.2
	core-8-3-4:1.2
	macosx-8-4-branch:1.2.0.24
	macosx-8-4-branchpoint:1.2
	core-8-4-a3:1.2
	core-8-3-3:1.2
	dgp-privates-into-namespace:1.2.0.22
	tclpro-1-5-0:1.2
	core-8-4-win-speedup:1.2.0.20
	core-8-4-a2:1.2
	tclpro-1-4-1:1.2
	tclpro-1-4-0:1.2
	core-8-3-2:1.2
	ajuba-ajuba2-2-1-base:1.2
	ajuba-ajuba2-2-0:1.2
	core-8-4-a1:1.2
	core-8-3-1-branch:1.2.0.18
	core-8-3-1:1.2
	scriptics-sc-2-0-b5:1.2
	scriptics-sc-2-0-fixed:1.2
	scriptics-sc-2-0-b2:1.2
	scriptics-sc-2-0-b1:1.2
	core-8-3-0:1.2
	core-8-3-b2:1.2
	core-8-3-b1:1.2
	scriptics-sc-1-1:1.2
	scriptics-sc-1-1-b1:1.2
	core-8-2-3:1.2
	scriptics-sc-1-1-branch:1.2.0.16
	scriptics-sc-1-1-base:1.2
	scriptics-sc-1-0:1.2
	scriptics-sc-1-0-branch:1.2.0.14
	scriptics-sc-1-0-base:1.2
	core-8-2-2:1.2
	core-8-2-1:1.2
	scriptics-bc-1-0-b1:1.2
	core-8-2-1-branch:1.2.0.12
	scriptics-tclpro-1-3-0:1.2
	core-8-2-0:1.2
	core-8-2-b3-branch:1.2.0.10
	core-8-2-b3-base:1.2
	scriptics-tclpro-1-3-b4:1.2
	core-8-2-b2:1.2
	scriptics-tclpro-1-3-b3:1.2
	core-8-2-b1:1.2
	scriptics-tclpro-1-3-b2:1.2
	merge-to-mainline-5/21/99:1.2
	scriptics-tclpro-1-3-b2-branch:1.2.0.8
	core-8-1-1:1.2
	scriptics-tclpro-1-3-b1:1.2
	core-8-1-1-base:1.2
	core-8-1-0:1.2
	merge-to-mainline-4-29-99:1.2
	merge-to-mainline-4-23-99:1.2
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.1
	core-8-1-b2:1.1.4.1
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@# @;


1.11
date	2008.10.18.14.22.21;	author dkf;	state Exp;
branches;
next	1.10;

1.10
date	2008.09.23.13.36.40;	author dkf;	state Exp;
branches;
next	1.9;

1.9
date	2008.06.30.22.57.02;	author dkf;	state Exp;
branches;
next	1.8;

1.8
date	2007.12.13.15.23.43;	author dgp;	state Exp;
branches;
next	1.7;

1.7
date	2007.10.29.16.04.13;	author dkf;	state Exp;
branches;
next	1.6;

1.6
date	2007.10.26.20.13.23;	author dgp;	state Exp;
branches;
next	1.5;

1.5
date	2007.10.24.14.32.58;	author dkf;	state Exp;
branches;
next	1.4;

1.4
date	2004.10.28.10.22.51;	author dkf;	state Exp;
branches
	1.4.2.1;
next	1.3;

1.3
date	2004.06.21.21.19.41;	author dkf;	state Exp;
branches;
next	1.2;

1.2
date	98.09.14.18.22.56;	author stanton;	state Exp;
branches
	1.2.26.1;
next	1.1;

1.1
date	98.04.01.09.39.52;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.16.19;	author stanton;	state Exp;
branches;
next	;

1.2.26.1
date	2004.10.28.10.19.29;	author dkf;	state Exp;
branches;
next	;

1.4.2.1
date	2007.11.01.16.37.14;	author dgp;	state Exp;
branches;
next	;


desc
@@


1.11
log
@Implementation of the [tk busy] command on non-OSX.
Adapted from [Patch 1997907]
@
text
@'\"
'\" Copyright (c) 1992 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: grab.n,v 1.10 2008/09/23 13:36:40 dkf Exp $
'\" 
.so man.macros
.TH grab n "" Tk "Tk Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
grab \- Confine pointer and keyboard events to a window sub-tree
.SH SYNOPSIS
\fBgrab \fR?\fB\-global\fR? \fIwindow\fR
.sp
\fBgrab \fIoption \fR?\fIarg arg \fR...?
.BE
.SH DESCRIPTION
.PP
This command implements simple pointer and keyboard grabs for Tk.
Tk's grabs are different than the grabs
described in the Xlib documentation.
When a grab is set for a particular window, Tk restricts all pointer
events to the grab window and its descendants in Tk's window hierarchy.
Whenever the pointer is within the grab window's subtree, the pointer
will behave exactly the same as if there had been no grab at all
and all events will be reported in the normal fashion.
When the pointer is outside \fIwindow\fR's tree, button presses and
releases and
mouse motion events are reported to \fIwindow\fR, and window entry
and window exit events are ignored. The grab subtree
.QW owns
the pointer:
windows outside the grab subtree will be visible on the screen
but they will be insensitive until the grab is released.
The tree of windows underneath the grab window can include top-level
windows, in which case all of those top-level windows
and their descendants will continue to receive mouse events
during the grab.
.PP
Two forms of grabs are possible:  local and global.
A local grab affects only the grabbing application:  events will
be reported to other applications as if the grab had never occurred.
Grabs are local by default.
A global grab locks out all applications on the screen,
so that only the given subtree of the grabbing application will be
sensitive to pointer events (mouse button presses, mouse button releases,
pointer motions, window entries, and window exits).
During global grabs the window manager will not receive pointer
events either.
.PP
During local grabs, keyboard events (key presses and key releases)
are delivered as usual:  the window
manager controls which application receives keyboard events, and
if they are sent to any window in the grabbing application then they are
redirected to the focus window.
During a global grab Tk grabs the keyboard so that all keyboard events
are always sent to the grabbing application.
The \fBfocus\fR command is still used to determine which window in the
application receives the keyboard events.
The keyboard grab is released when the grab is released.
.PP
Grabs apply to particular displays.  If an application has windows
on multiple displays then it can establish a separate grab on each
display.
The grab on a particular display affects only the windows on
that display.
It is possible for different applications on a single display to have
simultaneous local grabs, but only one application can have a global
grab on a given display at once.
.PP
The \fBgrab\fR command can take any of the following forms:
.TP
\fBgrab \fR?\fB\-global\fR? \fIwindow\fR
Same as \fBgrab set\fR, described below.
.TP
\fBgrab current \fR?\fIwindow\fR?
If \fIwindow\fR is specified, returns the name of the current grab
window in this application for \fIwindow\fR's display, or an empty
string if there is no such window.
If \fIwindow\fR is omitted, the command returns a list whose elements
are all of the windows grabbed by this application for all displays,
or an empty string if the application has no grabs.
.TP
\fBgrab release \fIwindow\fR
Releases the grab on \fIwindow\fR if there is one, otherwise does
nothing.  Returns an empty string.
.TP
\fBgrab set \fR?\fB\-global\fR? \fIwindow\fR
Sets a grab on \fIwindow\fR.  If \fB\-global\fR is specified then the
grab is global, otherwise it is local.
If a grab was already in effect for this application on
\fIwindow\fR's display then it is automatically released.
If there is already a grab on \fIwindow\fR and it has the same
global/local form as the requested grab, then the command
does nothing.  Returns an empty string.
.TP
\fBgrab status \fIwindow\fR
Returns \fBnone\fR if no grab is currently set on \fIwindow\fR,
\fBlocal\fR if a local grab is set on \fIwindow\fR, and
\fBglobal\fR if a global grab is set.
.SH WARNING
.PP
It is very easy to use global grabs to render a display completely
unusable (e.g. by setting a grab on a widget which does not respond to
events and not providing any mechanism for releasing the grab).  Take
\fIextreme\fR care when using them!
.SH BUGS
.PP
It took an incredibly complex and gross implementation to produce
the simple grab effect described above.
Given the current implementation, it is not safe for applications
to use the Xlib grab facilities at all except through the Tk grab
procedures.
If applications try to manipulate X's grab mechanisms directly,
things will probably break.
.PP
If a single process is managing several different Tk applications,
only one of those applications can have a local grab for a given
display at any given time.  If the applications are in different
processes, this restriction does not exist.
.SH EXAMPLE
.PP
Set a grab so that only one button may be clicked out of a group.  The
other buttons are unresponsive to the mouse until the middle button is
clicked.
.CS
pack [button .b1 \-text "Click me! #1" \-command {destroy .b1}]
pack [button .b2 \-text "Click me! #2" \-command {destroy .b2}]
pack [button .b3 \-text "Click me! #3" \-command {destroy .b3}]
\fBgrab\fR .b2
.CE
.SH "SEE ALSO"
busy(n)
.SH KEYWORDS
grab, keyboard events, pointer events, window
'\" Local Variables:
'\" mode: nroff
'\" End:
@


1.10
log
@Fix [Bug 2118116]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.9 2008/06/30 22:57:02 dkf Exp $
d136 2
@


1.9
log
@Minor doc updates (removing out of date changebars, improving typedef formatting,
 etc.)
@
text
@a0 1
'\" -*- nroff -*-
d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.8 2007/12/13 15:23:43 dgp Exp $
d138 3
@


1.8
log
@merge stable branch onto HEAD
@
text
@d1 1
d9 1
a9 1
'\" RCS: @@(#) $Id: grab.n,v 1.4.2.1 2007/11/01 16:37:14 dgp Exp $
a21 1

d107 1
d127 1
a136 1

@


1.7
log
@Lots more GOOBE stuff. Now works with 'make html'!
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.6 2007/10/26 20:13:23 dgp Exp $
@


1.6
log
@        * doc/*.1:              Revert doc changes that broke
        * doc/*.3:              `make html` so we can get the release
        * doc/*.n:              out the door.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.4 2004/10/28 10:22:51 dkf Exp $
d35 3
a37 2
and window exit events are ignored.
The grab subtree ``owns'' the pointer:
d115 1
a115 1
Given the current implementation, it isn't safe for applications
d124 1
a124 1
processes, this restriction doesn't exist.
@


1.5
log
@Lots of improvements to look and feel of manual pages
@
text
@d36 1
a36 3
The grab subtree
.QW owns
the pointer:
@


1.4
log
@Assorted minor documentation fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.3 2004/06/21 21:19:41 dkf Exp $
d36 3
a38 1
The grab subtree ``owns'' the pointer:
@


1.4.2.1
log
@merge updates from HEAD
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.4 2004/10/28 10:22:51 dkf Exp $
d35 2
a36 3
and window exit events are ignored. The grab subtree
.QW owns
the pointer:
d114 1
a114 1
Given the current implementation, it is not safe for applications
d123 1
a123 1
processes, this restriction does not exist.
@


1.3
log
@Added example and warning about global grabs
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.2 1998/09/14 18:22:56 stanton Exp $
d132 1
a132 1
grab .b2
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id$
d105 5
a109 1

d124 10
@


1.2.26.1
log
@Backport of documentation fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.2 1998/09/14 18:22:56 stanton Exp $
d105 1
a105 5
.SH WARNING
It is very easy to use global grabs to render a display completely
unusable (e.g. by setting a grab on a widget which does not respond to
events and not providing any mechanism for releasing the grab).  Take
\fIextreme\fR care when using them!
a119 10
.SH EXAMPLE
Set a grab so that only one button may be clicked out of a group.  The
other buttons are unresponsive to the mouse until the middle button is
clicked.
.CS
pack [button .b1 \-text "Click me! #1" \-command {destroy .b1}]
pack [button .b2 \-text "Click me! #2" \-command {destroy .b2}]
pack [button .b3 \-text "Click me! #3" \-command {destroy .b3}]
\fBgrab\fR .b2
.CE
@


1.1
log
@Initial revision
@
text
@d8 1
a8 1
'\" SCCS: @@(#) grab.n 1.15 96/03/26 18:22:48
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: grab.n,v 1.2 1998/09/14 18:22:56 stanton Exp $
@


