Add Fl::set_mouse method.

This commit is contained in:
Jonathan Moore Liles 2013-09-15 23:48:06 -07:00
parent 02936771b8
commit 6bed472e74
2 changed files with 12 additions and 2 deletions

View File

@ -531,13 +531,16 @@ public:
open it.
*/
static void get_mouse(int &,int &); // platform dependent
/**
Set the pointer position in screen relative coordinates
*/
static void set_mouse(int x,int y); // platform dependent
/**
Returns non zero if we had a double click event.
\retval Non-zero if the most recent FL_PUSH or FL_KEYBOARD was a "double click".
\retval N-1 for N clicks.
A double click is counted if the same button is pressed
again while event_is_click() is true.
again while event_is_click() is true.
*/
static int event_clicks() {return e_clicks;}
/**

View File

@ -765,6 +765,13 @@ void Fl::get_mouse(int &xx, int &yy) {
yy = my;
}
void Fl::set_mouse(int x, int y) {
fl_open_display();
Window root = RootWindow(fl_display, fl_screen);
XWarpPointer(fl_display,None,root,0,0,0,0,x,y);
}
////////////////////////////////////////////////////////////////
// Code used for paste and DnD into the program: