home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / Xlib_WarpPointer.c < prev    next >
C/C++ Source or Header  |  2000-06-15  |  3KB  |  86 lines

  1. #include "Xlib.h"
  2. #include "Xlib_private.h"
  3. #include "GetReq.h"
  4.  
  5.  
  6. /*
  7.  
  8. Copyright 1986, 1998  The Open Group
  9.  
  10. All Rights Reserved.
  11.  
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14.  
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  18. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  19. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21.  
  22. Except as contained in this notice, the name of The Open Group shall not be
  23. used in advertising or otherwise to promote the sale, use or other dealings
  24. in this Software without prior written authorization from The Open Group.
  25.  
  26. */
  27.  
  28.  
  29. /* 
  30.  * Arguments
  31.  * 
  32.  *  display    Specifies the connection to the X server. 
  33.  *  src_w        Specifies the source window or None. 
  34.  *  dest_w        Specifies the destination window or None. 
  35.  *  src_x
  36.  *  src_y
  37.  *  src_width
  38.  *  src_height    Specify a rectangle in the source window. 
  39.  *  dest_x
  40.  *  dest_y        Specify the x and y coordinates within the destination window. 
  41.  * 
  42.  * 
  43.  * Description
  44.  * 
  45.  * If dest_w is None, XWarpPointer() moves the pointer by the offsets (dest_x, dest_y) relative to the current position of the
  46.  * pointer. If dest_w is a window, XWarpPointer() moves the pointer to the offsets (dest_x, dest_y) relative to the origin of dest_w.
  47.  * However, if src_w is a window, the move only takes place if the window src_w contains the pointer and if the specified rectangle of
  48.  * src_w contains the pointer. 
  49.  * 
  50.  * The src_x and src_y coordinates are relative to the origin of src_w. If src_height is zero, it is replaced with the current height of
  51.  * src_w minus src_y. If src_width is zero, it is replaced with the current width of src_w minus src_x. 
  52.  * 
  53.  * There is seldom any reason for calling this function. The pointer should normally be left to the user. If you do use this function,
  54.  * however, it generates events just as if the user had instantaneously moved the pointer from one position to another. Note that you
  55.  * cannot use XWarpPointer() to move the pointer outside the confine_to window of an active pointer grab. An attempt to do so
  56.  * will only move the pointer as far as the closest edge of the confine_to window. 
  57.  * 
  58.  * XWarpPointer() can generate a BadWindow error. 
  59.  * 
  60.  * Diagnostics
  61.  * 
  62.  *  BadWindow    A value for a Window argument does not name a defined Window.
  63.  */
  64.  
  65.  
  66. int XWarpPointer(register Display *dpy, Window src_win, Window dest_win, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y)
  67. {       
  68.     register xWarpPointerReq *req;
  69.  
  70.     DBUG_ENTER("XWarpPointer");
  71.     LockDisplay(dpy);
  72.     GetReq(WarpPointer, req);
  73.     req->srcWid = src_win;
  74.     req->dstWid = dest_win;
  75.     req->srcX = src_x;
  76.     req->srcY = src_y;
  77.     req->srcWidth = src_width;
  78.     req->srcHeight = src_height;
  79.     req->dstX = dest_x;
  80.     req->dstY = dest_y;
  81.     UnlockDisplay(dpy);
  82.     SyncHandle();
  83.     DBUG_RETURN(1);
  84. }
  85.  
  86.