STR #1731

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File ]

STR #1731

Application:FLTK Library
Status:5 - New
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Summary:SetCursorPosition implementation
Created By:alexroat
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files

Trouble Report Comments:

Post Text ]
Name/Time/Date Text top right image
#1 alexroat
02:40 Jul 06, 2007
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 , 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

      return -1; // Fail
} // jump_cursor

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

Return to Bugs & Features | Post Text | Post File ]


Comments are owned by the poster. All other content is copyright 1998-2023 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.