~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to display/drivers/XDRIVER/Get_w_pointer.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 -
4
 
 * right button
5
 
 * 
6
 
 * This is called directly by the application programs.
7
 
 * 
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. */
11
 
 
12
 
#include <grass/gis.h>
13
 
#include "includes.h"
14
 
#include <grass/glocale.h>
15
 
 
16
 
int XD_Get_location_with_pointer(int *wx, int *wy, int *button)
17
 
{
18
 
    XEvent bpevent;
19
 
 
20
 
    if (redraw_pid) {
21
 
        G_warning(_("Monitor: interactive command in redraw"));
22
 
        return -1;
23
 
    }
24
 
 
25
 
    G_debug(5, "Get_location_with_pointer()");
26
 
 
27
 
    /* set the grass cursor on (defined in Graph_Set.c) */
28
 
    XDefineCursor(dpy, grwin, cur_xh);
29
 
 
30
 
    /* wait for a button-push event in the grass window, and return the
31
 
     * x,y coord and button number */
32
 
 
33
 
    XSelectInput(dpy, grwin, ButtonPressMask | PointerMotionMask);
34
 
 
35
 
    do {
36
 
        if (!get_xevent(ButtonPressMask, &bpevent))
37
 
            break;
38
 
    } while (bpevent.type != ButtonPress);
39
 
 
40
 
    XSelectInput(dpy, grwin, gemask);
41
 
 
42
 
    *wx = bpevent.xbutton.x;
43
 
    *wy = bpevent.xbutton.y;
44
 
    *button = bpevent.xbutton.button;
45
 
 
46
 
    XUndefineCursor(dpy, grwin);
47
 
 
48
 
    return 0;
49
 
}