XIDefineCursor.c revision c27c18e8
1c27c18e8Smrg/************************************************************ 2c27c18e8Smrg 3c27c18e8SmrgCopyright 2006 Peter Hutterer <peter@cs.unisa.edu.au> 4c27c18e8Smrg 5c27c18e8SmrgPermission to use, copy, modify, distribute, and sell this software and its 6c27c18e8Smrgdocumentation for any purpose is hereby granted without fee, provided that 7c27c18e8Smrgthe above copyright notice appear in all copies and that both that 8c27c18e8Smrgcopyright notice and this permission notice appear in supporting 9c27c18e8Smrgdocumentation. 10c27c18e8Smrg 11c27c18e8SmrgThe above copyright notice and this permission notice shall be included in 12c27c18e8Smrgall copies or substantial portions of the Software. 13c27c18e8Smrg 14c27c18e8SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15c27c18e8SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16c27c18e8SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17c27c18e8SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18c27c18e8SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19c27c18e8SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20c27c18e8Smrg 21c27c18e8SmrgExcept as contained in this notice, the name of The Open Group shall not be 22c27c18e8Smrgused in advertising or otherwise to promote the sale, use or other dealings 23c27c18e8Smrgin this Software without prior written authorization from The Open Group. 24c27c18e8Smrg 25c27c18e8Smrg*/ 26c27c18e8Smrg 27c27c18e8Smrg/*********************************************************************** 28c27c18e8Smrg * 29c27c18e8Smrg * XIDefineCursor - Change the cursor of an extension input device. 30c27c18e8Smrg * 31c27c18e8Smrg */ 32c27c18e8Smrg#include <stdint.h> 33c27c18e8Smrg#include <X11/extensions/XI2proto.h> 34c27c18e8Smrg#include <X11/Xlibint.h> 35c27c18e8Smrg#include <X11/extensions/XInput2.h> 36c27c18e8Smrg#include <X11/extensions/extutil.h> 37c27c18e8Smrg#include "XIint.h" 38c27c18e8Smrg 39c27c18e8Smrg 40c27c18e8Smrgint XIDefineCursor(Display *dpy, int deviceid, Window w, Cursor cursor) 41c27c18e8Smrg{ 42c27c18e8Smrg xXIChangeCursorReq *req; 43c27c18e8Smrg 44c27c18e8Smrg XExtDisplayInfo *info = XInput_find_display(dpy); 45c27c18e8Smrg LockDisplay(dpy); 46c27c18e8Smrg 47c27c18e8Smrg if (_XiCheckExtInit(dpy, Dont_Check, info) == -1) 48c27c18e8Smrg return (NoSuchExtension); 49c27c18e8Smrg 50c27c18e8Smrg GetReq(XIChangeCursor, req); 51c27c18e8Smrg req->reqType = info->codes->major_opcode; 52c27c18e8Smrg req->ReqType = X_XIChangeCursor; 53c27c18e8Smrg req->deviceid = deviceid; 54c27c18e8Smrg req->win = w; 55c27c18e8Smrg req->cursor = cursor; 56c27c18e8Smrg UnlockDisplay(dpy); 57c27c18e8Smrg SyncHandle(); 58c27c18e8Smrg return Success; 59c27c18e8Smrg} 60c27c18e8Smrg 61c27c18e8Smrgint XIUndefineCursor(Display *dpy, int deviceid, Window w) 62c27c18e8Smrg{ 63c27c18e8Smrg return XIDefineCursor(dpy, deviceid, w, None); 64c27c18e8Smrg} 65c27c18e8Smrg 66