qcontrol() in 3.3.1
randy frank
randy at tessa.iaf.uiowa.edu
Sat Dec 8 02:09:52 AEST 1990
Ok, I was paging through my 3.3.1 GL refs manual and came
accross qcontrol() and qgetfd(). (I had never heard of these before.
Are they new/unhearlded routines in 3.3.1?) They appear to do what I
want. Reading the man pages it keeps warning against this but it
looks like QC_SENDEVENT could be used to send an event from a program
with input focus to another without focus if the program with focus
had the result of a qgetfd() call from within the other program.
So I pasted this together to test the use of qcontrol:
#include <stdio.h>
#include <gl/qcontrol.h>
#include <device.h>
#include <gl.h>
main()
{
long myque,wid;
short devid,data;
long icnt,ocnt,i;
short idata[100],odata[100];
myque = winopen("broad\0");
myque = qgetfd();
printf("Queue desc = %d\n",myque);
devid = 0x3ff0;
icnt = 2;
idata[0] = 0x3ff0;
idata[1] = 0;
ocnt = 0;
i = qcontrol(QC_ADDDEVICE,icnt,idata,ocnt,odata);
if (i != 0) printf("Error %d\n",i);
qdevice(MOUSEX);
qdevice(0x3ff0);
qenter(REDRAW,wid);
while (1) {
i = qread(&data);
if (i == REDRAW) {
(void) reshapeviewport();
(void) color(BLACK);
(void) clear();
}
if (i == 0x3ff0) {
printf("0x3ff0 event = %d\n",data);
}
if (i == MOUSEX) {
printf("0x3ff0 via get call = %d\n",getvaluator(0x3ff0));
icnt = 5;
idata[0] = myque;
idata[1] = 1;
idata[2] = 0x3ff0;
idata[3] = data;
idata[4] = NULLDEV;
ocnt = 0;
i=qcontrol(QC_SENDEVENT,icnt,idata,ocnt,odata);
if (i != 0) printf("Error %d\n",i);
icnt = 4;
idata[0] = 0x3ff0;
idata[1] = data;
idata[2] = NULLDEV;
idata[3] = NULLDEV;
i=qcontrol(QC_CHANGEDEVICE,icnt,idata,ocnt,odata);
if (i != 0) printf("Error %d\n",i);
(void) printf("MOUSEX= %d\n",data);
}
}
}
Problem: It does not work. None of the qcontrols return errors
but neither does the 0x3ff0 pseudo device change with MOUSEX. It is not
catching changes in 0x3ff0 in the event loop nor can I poll it with
getvaluator.
If anyone can point me to my mistake I would greatly appreciate it.
Thanks in advance...
--
rjf.
Randy Frank, Engineer | (319) 335-6712
University of Iowa, Image Analysis Facility | 73 EMRB
randy at tessa.iaf.uiowa.edu | Iowa City, IA 52242
More information about the Comp.sys.sgi
mailing list