From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: Syd Polk Cc: Insight Maling List Subject: Re: [RFA] libgui/src/tkWarpPointer.c for cygwin Date: Thu, 03 May 2001 10:52:00 -0000 Message-id: References: <4.2.0.58.20010503104909.01a4b5e0@pop.cygnus.com> X-SW-Source: 2001-q2/msg00181.html On Thu, 3 May 2001, Syd Polk wrote: > Can you change it and repost the patch? Here it is. Keith Index: libgui/src/tkWarpPointer.c =================================================================== RCS file: /cvs/src/src/libgui/src/tkWarpPointer.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 tkWarpPointer.c --- libgui/src/tkWarpPointer.c 2000/02/07 00:19:47 1.1.1.1 +++ libgui/src/tkWarpPointer.c 2001/05/03 17:51:59 @@ -24,9 +24,11 @@ * * * ---------------------------------------------------------------------------*/ -#ifndef _WIN32 - #include "tk.h" +#ifdef _WIN32 +#include +#include +#endif int WarpPointer (clientData, interp, objc, objv) @@ -36,12 +38,11 @@ Tcl_Obj *CONST objv[]; { Tk_Window tkwin; - Window win; int x, y; char *str; if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "x y widgetId"); + Tcl_WrongNumArgs(interp, 1, objv, "widgetId x y"); return TCL_ERROR; } @@ -53,9 +54,18 @@ Tk_MainWindow (interp)); if (tkwin == NULL) return TCL_ERROR; + + { +#ifdef _WIN32 + int wx, wy; + Tk_GetRootCoords (tkwin, &wx, &wy); + SetCursorPos (wx + x, wy + y); +#else + Window win = Tk_WindowId(tkwin); + XWarpPointer(Tk_Display(tkwin), None, win, 0, 0, 0, 0, x, y); +#endif + } - win = Tk_WindowId(tkwin); - XWarpPointer(Tk_Display(tkwin), None, win, 0, 0, 0, 0, x, y); return TCL_OK; } @@ -66,5 +76,3 @@ return TCL_ERROR; return TCL_OK; } - -#endif /* !_WIN32 */