/* This routine is a C routine to read the mouse coordinates for the * SunCGI device driver (i.e., it implements the cross-hair command). * * This routine was taken from the Sun CGI manual (chapter 5 example on * CGI input). * * xsize - horizontal size of graphics window * ysize - vertical size of graphics window * ixcoor - returned x coordinate * iycoor - returned y coordinate * ierror - error status ( 0 for good data, 1 for error) */ #include #include sunloc_(xsize,ysize,ixcoor,iycoor,ierror) int *xsize, *ysize; int *ixcoor, *iycoor; int *ierror; { Cawresult stat; Ccoor point; Cinrep ivalue; Cint name; Cint trigger; point.x = *xsize; point.y = *ysize; ivalue.xypt = &point; initialize_lid(IC_LOCATOR, 1, &ivalue); associate(2, IC_LOCATOR, 1); track_on(IC_LOCATOR, 1, 1, (Ccoorpair *)0, &ivalue); request_input(IC_LOCATOR, 1, 10 * 1000 * 1000, &stat, &ivalue, &trigger); if (stat == VALID_DATA) { *ixcoor = ivalue.xypt->x; *iycoor = ivalue.xypt->y; *ierror = 0; } else { *ierror = 1; *ixcoor = 0; *iycoor = 0; } dissociate(2, IC_LOCATOR, 1); release_input_device(IC_LOCATOR, 1); return; }