NAME

App::MathImage::X11::Protocol::GrabServer -- object-oriented server grabbing

SYNOPSIS

use App::MathImage::X11::Protocol::GrabServer;
{
  my $grab = App::MathImage::X11::Protocol::GrabServer->new ($X); 
  ...
  # UngrabServer when $grab destroyed
}

DESCRIPTION

This is an object-oriented approach to GrabServer. A grab object represents a desired grab. When the last is destroyed an $X->UngrabServer is done.

It can be used in a block as a kind of scope guard to grab the server to make a few operations atomic (usually for something global like root window properties etc). Grabs done this way can nest or overlap which is good for a library where an ungrab should wait until the end of any outermost desired grab.

A grab object can be held for an extended time, perhaps for some state driven interaction, but care should be taken not to hold the server too long, as other client programs are locked out.

When weak references are available (Perl 5.6 and up), only a weak reference is held to the target X11::Protocol object. This means the grab doesn't keep it alive and connected once nothing else is interested. The server ungrabs automatically when the connection is closed, so there's no need for an $X->UngrabServer in that case.

FUNCTIONS

$grab = App::MathImage::X11::Protocol::GrabServer->new ($X)

$X should be an X11::Protocol object. Grab the server with $X->GrabServer (if not already done)and return a $grab object representing the grab.

$grab->ungrab

Explicitly ungrab the $grab object. This happens when $grab is destroyed, but can be done sooner if desired. If $grab has already been ungrabbed then nothing is done.

SEE ALSO

X11::Protocol, App::MathImage::X11::Protocol::Extras

HOME PAGE

http://user42.tuxfamily.org/math-image/index.html

LICENSE

Copyright 2010 Kevin Ryde

Math-Image is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Math-Image is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Math-Image. If not, see <http://www.gnu.org/licenses/>.