1
/* Using mouse device, get a new screen coordinate and button number.
2
* Button numbers must be the following values which correspond to the
3
* following software meanings: 1 - left button 2 - middle button 3 -
6
* This is called directly by the application programs.
8
* A "pointing hand" pointer is used. Upon button depression, the current
9
* coordinate is returned in (*wx, *wy) and the button pressed in
10
* returned in *button. */
12
#include <grass/gis.h>
14
#include <grass/glocale.h>
16
int XD_Get_location_with_pointer(int *wx, int *wy, int *button)
21
G_warning(_("Monitor: interactive command in redraw"));
25
G_debug(5, "Get_location_with_pointer()");
27
/* set the grass cursor on (defined in Graph_Set.c) */
28
XDefineCursor(dpy, grwin, cur_xh);
30
/* wait for a button-push event in the grass window, and return the
31
* x,y coord and button number */
33
XSelectInput(dpy, grwin, ButtonPressMask | PointerMotionMask);
36
if (!get_xevent(ButtonPressMask, &bpevent))
38
} while (bpevent.type != ButtonPress);
40
XSelectInput(dpy, grwin, gemask);
42
*wx = bpevent.xbutton.x;
43
*wy = bpevent.xbutton.y;
44
*button = bpevent.xbutton.button;
46
XUndefineCursor(dpy, grwin);