DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1731
Version: 2.0-feature


I'm looking for a way to repositioning the mouse cursor.
I need this feature to implement the fly mode in a openGL window in order
to allow the camera rotation caturing the mouse movement events.
The problem is that when mouse cursor hit the border of the screen it does
not generate any other useful event to track the mouse movement.
That is, I continue to move mouse but the cursor coordinate offset does
not change from 0 (because mouse cursor keep it's position on the screen).
So I used to place the cursor at the center of the capturing window at
every event, hidding the cursor itself, and monitoring the offset from the
center of the render window.

Actually I've to do this calling a X or Win32 API directly intead of using
an FLTK call.

Somebody has posted this solution at
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00023.html , in
which he propose the function jump_mouse as

int jump_cursor (int new_x, int new_y)
{
#if defined WIN32
      BOOL result = SetCursorPos(new_x, new_y);
      if (result) return 0; // OK

#elif defined __APPLE__
      CGPoint new_pos;
      CGEventErr err;
      new_pos.x = new_x;
      new_pos.y = new_y;
      err = CGWarpMouseCursorPosition(new_pos);
      if (!err) return 0; // OK

#else // Assume this is Xlib
      Window rootwindow = DefaultRootWindow(fl_display);
      XWarpPointer(fl_display, rootwindow, rootwindow, 0, 0, 0, 0,
new_x, new_y);
      return 0; // Assume OK
#endif

      return -1; // Fail
} // jump_cursor

Would be nice if it could be tested and integrated in the next version of
fltk...


Link: http://www.fltk.org/str.php?L1731
Version: 2.0-feature

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to