XStFocus.c revision c43cc173
11.41Sthorpej/* $Xorg: XStFocus.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
21.1Smrg
31.1Smrg/************************************************************
41.1Smrg
51.1SmrgCopyright 1989, 1998  The Open Group
61.1Smrg
71.1SmrgPermission to use, copy, modify, distribute, and sell this software and its
81.1Smrgdocumentation for any purpose is hereby granted without fee, provided that
91.1Smrgthe above copyright notice appear in all copies and that both that
101.1Smrgcopyright notice and this permission notice appear in supporting
111.1Smrgdocumentation.
121.1Smrg
131.1SmrgThe above copyright notice and this permission notice shall be included in
141.1Smrgall copies or substantial portions of the Software.
151.1Smrg
161.1SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171.1SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
181.1SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
191.1SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
201.1SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
211.1SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
221.1Smrg
231.1SmrgExcept as contained in this notice, the name of The Open Group shall not be
241.1Smrgused in advertising or otherwise to promote the sale, use or other dealings
251.1Smrgin this Software without prior written authorization from The Open Group.
261.1Smrg
271.1SmrgCopyright 1989 by Hewlett-Packard Company, Palo Alto, California.
281.1Smrg
291.1Smrg			All Rights Reserved
301.1Smrg
311.1SmrgPermission to use, copy, modify, and distribute this software and its
321.1Smrgdocumentation for any purpose and without fee is hereby granted,
331.4Smrgprovided that the above copyright notice appear in all copies and that
341.4Smrgboth that copyright notice and this permission notice appear in
351.1Smrgsupporting documentation, and that the name of Hewlett-Packard not be
361.1Smrgused in advertising or publicity pertaining to distribution of the
371.8Sperrysoftware without specific, written prior permission.
381.8Sperry
391.1SmrgHEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
401.1SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
411.1SmrgHEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
421.1SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
431.1SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
441.1SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
451.1SmrgSOFTWARE.
461.1Smrg
471.1Smrg********************************************************/
481.1Smrg/* $XFree86: xc/lib/Xi/XStFocus.c,v 3.3 2001/12/14 19:55:23 dawes Exp $ */
491.1Smrg
501.1Smrg/***********************************************************************
511.1Smrg *
521.1Smrg * XSetDeviceFocus - Set the focus of an extension device.
531.1Smrg *
541.1Smrg */
551.1Smrg
561.1Smrg#include <X11/extensions/XI.h>
571.1Smrg#include <X11/extensions/XIproto.h>
581.1Smrg#include <X11/Xlibint.h>
591.1Smrg#include <X11/extensions/XInput.h>
601.1Smrg#include <X11/extensions/extutil.h>
611.1Smrg#include "XIint.h"
621.1Smrg
631.1Smrgint
641.1SmrgXSetDeviceFocus(dpy, dev, focus, revert_to, time)
651.1Smrg    register Display *dpy;
661.1Smrg    XDevice *dev;
671.1Smrg    Window focus;
681.1Smrg    int revert_to;
691.1Smrg    Time time;
701.1Smrg{
711.1Smrg    xSetDeviceFocusReq *req;
721.1Smrg    XExtDisplayInfo *info = XInput_find_display(dpy);
731.1Smrg
741.1Smrg    LockDisplay(dpy);
751.1Smrg    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
761.1Smrg	return (NoSuchExtension);
771.1Smrg
781.1Smrg    GetReq(SetDeviceFocus, req);
791.1Smrg    req->reqType = info->codes->major_opcode;
801.1Smrg    req->ReqType = X_SetDeviceFocus;
811.1Smrg    req->device = dev->device_id;
821.1Smrg    req->focus = focus;
831.1Smrg    req->revertTo = revert_to;
841.1Smrg    req->time = time;
851.1Smrg
861.1Smrg    UnlockDisplay(dpy);
871.1Smrg    SyncHandle();
881.1Smrg    return (Success);
891.1Smrg}
901.1Smrg