| [ 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 |
Subsystem: | Unassigned |
Summary: | SetCursorPosition implementation |
Version: | 2.0-feature |
Created By: | alexroat |
Assigned To: | Unassigned |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]No files
Trouble Report Comments:
[ Post Text ]
|
#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 http://www.mail-archive.com/fltk-opengl@easysw.com/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... | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |