This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] libgui/src/tkWarpPointer.c for cygwin


Approved.

At 10:52 AM 5/3/01 -0700, Keith Seitz wrote:
>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 <windows.h>
>+#include <winuser.h>
>+#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 */

Syd Polk		spolk@redhat.com
Engineering Manager	+1 408 543 9430
Red Hat, Inc.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]