Sun Microsystems 800-1256-04 — Sun Microsystems 800-1256-04 SunCGI Reference Manual PDF

Chapter 5 - Input 91 0 iinclude !define TEN_SECONDS (10 * 1000 * 1000) main() { Cawresult stat; Ccoor point; Cinrep ivalue; Cint name; Cint trigger; Cvwsurf device; NORMAL_VWSURF(device, PIXWINDD); point.x = 16384; point.y = 16384; ivalue.xypt = &point; open_cgi () ; open_vws(&narne, &device); initialize_lid(IC_LOCATOR, 1, &ivalue); associate(2, IC_LOCATOR, 1); track_on(IC_LOCATOR, 1, 1, (Ccoorpair *)O, &ivalue); request_input(IC_LOCATOR, 1, TEN_SECONDS, &stat, &ivalue, &trigger); if (stat-= VALID_DATA) printf("trigger activated at %d %d \n", ivalue.xypt->x, ivalue.xypt->y); else printf("trigger not activated \n"); dissociate(2, IC_LOCATOR, 1); release_input_device(IC_LOCATOR, 1); 0 close_vws(name); close_ cgi () ; Figure 5-2 Example Program with LOCATOR Input Device Request Input Cerror request_input(devclass, devnum, timeout, valid, sample, trigger) Cdevoff devclass; /* device type*/ Cint devnum; /* device number*/ Cint timeout; /* amount of time to wait for input*/ Cawresult *valid; /* device status*/ Cinrep *sample; /* device value*/ Cint *trigger; /* trigger number*/ 0 request_ input waits timeout microseconds for activation of a trigger associ- ated with a specific device.

If timeout is negative, the request will wait forever. Version C of 17 March 1986