public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [RFA] libgui/src/tkWarpPointer.c for cygwin
@ 2001-05-02 13:12 Keith Seitz
  2001-05-02 17:05 ` Syd Polk
  0 siblings, 1 reply; 11+ messages in thread
From: Keith Seitz @ 2001-05-02 13:12 UTC (permalink / raw)
  To: Insight Maling List

Hi,

I am working on making the Insight testsuite work (better?), and I wanted
to make sure (as much as possible) that we are able to run the same tests
on Cygwin and unix.

For some tests, it is necessary to warp the pointer. This patch simply
implements this functionality on Windows, too.

Keith

src/libgui/ChangeLog:
2001-05-01  Keith Seitz  <keiths@cygnus.com>

	* src/tkWarpPointer.c (WarpPointer): Implement for windows.

Patch:
Index: src/tkWarpPointer.c
===================================================================
RCS file: /cvs/cvsfiles/devo/libgui/src/tkWarpPointer.c,v
retrieving revision 1.2
diff -p -r1.2 tkWarpPointer.c
*** tkWarpPointer.c	1999/01/28 01:18:27	1.2
--- tkWarpPointer.c	2001/05/02 20:11:06
***************
*** 24,32 ****
  *
  *
  * ---------------------------------------------------------------------------*/
- #ifndef _WIN32
-
  #include "tk.h"

  int
  WarpPointer (clientData, interp, objc, objv)
--- 24,34 ----
  *
  *
  * ---------------------------------------------------------------------------*/
  #include "tk.h"
+ #ifdef _WIN32
+ #include <windows.h>
+ #include <winuser.h>
+ #endif

  int
  WarpPointer (clientData, interp, objc, objv)
*************** WarpPointer (clientData, interp, objc, o
*** 36,47 ****
      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");
        return TCL_ERROR;
      }

--- 38,48 ----
      Tcl_Obj *CONST objv[];
  {
      Tk_Window tkwin;
      int x, y;
      char *str;

      if (objc != 4) {
!       Tcl_WrongNumArgs(interp, 1, objv, "widgetId x y");
        return TCL_ERROR;
      }

*************** WarpPointer (clientData, interp, objc, o
*** 53,61 ****
  			 Tk_MainWindow (interp));
      if (tkwin == NULL)
        return TCL_ERROR;

-     win = Tk_WindowId(tkwin);
-     XWarpPointer(Tk_Display(tkwin), None, win, 0, 0, 0, 0, x, y);
      return TCL_OK;
  }

--- 54,71 ----
  			 Tk_MainWindow (interp));
      if (tkwin == NULL)
        return TCL_ERROR;
+
+     {
+ #ifdef _WIN32
+       int wx, wy;
+       Tk_GetRootCoords (tkwin, &wx, &wy);
+       SetCursorPos@8 (wx + x, wy + y);
+ #else
+       Window win = Tk_WindowId(tkwin);
+       XWarpPointer(Tk_Display(tkwin), None, win, 0, 0, 0, 0, x, y);
+ #endif
+     }

      return TCL_OK;
  }

*************** cyg_create_warp_pointer_command (Tcl_Int
*** 66,70 ****
      return TCL_ERROR;
    return TCL_OK;
  }
-
- #endif /* !_WIN32 */
--- 76,78 ----

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-05-17 13:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-02 13:12 [RFA] libgui/src/tkWarpPointer.c for cygwin Keith Seitz
2001-05-02 17:05 ` Syd Polk
2001-05-02 19:34   ` Christopher Faylor
2001-05-03  7:03   ` Keith Seitz
2001-05-03 10:48     ` Syd Polk
2001-05-03 10:52       ` Keith Seitz
2001-05-03 10:59         ` Syd Polk
2001-05-04  4:43         ` Insight port to the 'original' Windows Kai Ruottu
2001-05-04  7:05           ` Keith Seitz
2001-05-10  2:27             ` Kai Ruottu
2001-05-17 13:41               ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).