Re: XForms: making an XForms program grab the pointer

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 6 Aug 97 06:39:22 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I'm not much of an Xlib programmer, how can I make an XForms application
> grab the pointer and never let it go? I want to make a sort of "screen
> lock" program which, when invoked, captures the X pointer and won't let it
> escape to other programs unless a password is entered (or something).

There's no XForms function to do this but there are Xlib functions to
do grabs on various things. XGrabPointer() is the function you want.

You may also wish to look at XGrabServer(). This call is simpler than
XGrabPointer() but has some side effects which may not be desirable
(events to and from other clients queue up and don't get sent until
the server is ungrabbed).

The ungrab calls are XUngrabPointer() and XUngrabServer().

Refer to the manual pages and/or the O'Reilly _Xlib Programming
Manual_ for the details.

Grabs are generally considered to be antisocial in an X environment
but I suppose for a lock program they would be okay. However, you may
already have a screen lock program on your system. `xlock' comes
"standard" on most X distributions and some vendors have their own as
well.

You may wish to use one of the predebugged lock programs rather than
mess around with grabs. If you do decide to roll your own, be sure
you have another terminal or workstation nearby from which you can log
in to kill your program if it hangs. It may be the only way you can
get back control of your console, short of hitting the `reset'
switch.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/