GrPointer.c revision 61b2299d
11.67Sthorpej/* $Xorg: GrPointer.c,v 1.4 2001/02/09 02:03:33 xorgcvs Exp $ */
21.348Schristos/*
31.84Slukem
41.248SapbCopyright 1986, 1998  The Open Group
51.84Slukem
61.84SlukemPermission to use, copy, modify, distribute, and sell this software and its
71.84Slukemdocumentation for any purpose is hereby granted without fee, provided that
81.84Slukemthe above copyright notice appear in all copies and that both that
91.84Slukemcopyright notice and this permission notice appear in supporting
101.84Slukemdocumentation.
111.84Slukem
121.84SlukemThe above copyright notice and this permission notice shall be included in
131.84Slukemall copies or substantial portions of the Software.
141.84Slukem
151.84SlukemTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161.84SlukemIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171.84SlukemFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
181.84SlukemOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
191.84SlukemAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
201.84SlukemCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
211.84Slukem
221.84SlukemExcept as contained in this notice, the name of The Open Group shall not be
231.84Slukemused in advertising or otherwise to promote the sale, use or other dealings
241.84Slukemin this Software without prior written authorization from The Open Group.
251.84Slukem
261.84Slukem*/
271.84Slukem
281.84Slukem#define NEED_REPLIES
291.84Slukem#ifdef HAVE_CONFIG_H
301.84Slukem#include <config.h>
311.1Stv#endif
321.249Sapb#include "Xlibint.h"
331.1Stv
341.249Sapbint XGrabPointer(
351.249Sapb    register Display *dpy,
361.249Sapb    Window grab_window,
371.249Sapb    Bool owner_events,
381.249Sapb    unsigned int event_mask, /* CARD16 */
391.249Sapb    int pointer_mode,
401.249Sapb    int keyboard_mode,
411.249Sapb    Window confine_to,
421.249Sapb    Cursor curs,
431.249Sapb    Time time)
441.249Sapb{
451.249Sapb    xGrabPointerReply rep;
461.249Sapb    register xGrabPointerReq *req;
471.249Sapb    register int status;
481.249Sapb    LockDisplay(dpy);
491.249Sapb    GetReq(GrabPointer, req);
501.249Sapb    req->grabWindow = grab_window;
511.249Sapb    req->ownerEvents = owner_events;
521.249Sapb    req->eventMask = event_mask;
531.249Sapb    req->pointerMode = pointer_mode;
541.249Sapb    req->keyboardMode = keyboard_mode;
551.249Sapb    req->confineTo = confine_to;
561.249Sapb    req->cursor = curs;
571.249Sapb    req->time = time;
581.249Sapb
591.249Sapb    /* if we ever return, suppress the error */
601.249Sapb    if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0)
611.249Sapb	rep.status = GrabSuccess;
621.249Sapb    status = rep.status;
631.249Sapb    UnlockDisplay(dpy);
641.249Sapb    SyncHandle();
651.249Sapb    return (status);
661.249Sapb}
671.249Sapb