[comp.windows.x] XGrabPointer behavior

bill@cosi.UUCP (02/06/91)

I am trying to write a client which does the following:

1) Grabs the pointer, and allows the user to draw a rubber box on the
root window.  The boundary of the box is determined by using button
press/release events to determine where opposite corners are.

2) Once this box is defined, my program grabs the image within the box
(XGetImage) for further processing.

The second part is easy.  The first part is giving me a headache.
The program I am working with currently displays a dummy window (which
I would like to get rid of), then does a XGrabPointer and follows the
motion events, drawing/redrawing the rubber box as appropriate.  This
seems to work OK.  However, despite the fact that I've done a pointer
grab, the button press events are lost unless the pointer is in the
client's dummy window.  Am I misunderstanding the function of XGrabPointer,
or am I missing something more subtle?

Also - for my education, I would like to see the source to xwd, but I don't
know where to get it.  Can anyone tell me where to look that doesn't require
ftp?

janssen@parc.xerox.com (Bill Janssen) (02/07/91)

I think what you want already exists.  Get the program xsnap
from the contrib archive on expo:  xsnap.tar.Z.

Bill
--
 Bill Janssen        janssen@parc.xerox.com      (415) 494-4763
 Xerox Palo Alto Research Center
 3333 Coyote Hill Road, Palo Alto, California   94304

mouse@lightning.mcrcim.mcgill.EDU (02/08/91)

> I am trying to write a client which does the following:

> 1) Grabs the pointer, and allows the user to draw a rubber box on the
> root window.

> 2) Once this box is defined, [...]

> The second part is easy.  The first part is giving me a headache.
> The program I am working with currently displays a dummy window
> (which I would like to get rid of), then does a XGrabPointer and
> follows the motion events, drawing/redrawing the rubber box as
> appropriate.  This seems to work OK.  However, despite the fact that
> I've done a pointer grab, the button press events are lost unless the
> pointer is in the client's dummy window.  Am I misunderstanding the
> function of XGrabPointer, or am I missing something more subtle?

As for getting rid of the dummy window, well, why not use the root
window of the screen as the grab and confine-to windows for the grab?
Why create another window for the purpose?

As for missing ButtonPress events, this could be a misunderstanding of
the way pointer events are distributed when a grab is active.  I'd need
to see the arguments to XGrabPointer to say much more.

> Also - for my education, I would like to see the source to xwd, but I
> don't know where to get it.  Can anyone tell me where to look that
> doesn't require ftp?

It's on the MIT X tape, mit/clients/xwd/ and files therein.  If you
don't have the MIT distribution, I can't suggest much but consulting
your friendly neighborhood archive site....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu