Hi folks,
maybe I'm doing something horribly wrong, ... but if not,
we have a rather large bug somewhere in GII:
I am writing a multi-visual GGI application and need to
determine where an event originated from.
For starters I had explicitly coded the "usual" origins
that appear when running on X into a switch, but of course
that breaks when I simply set GGI_INPUT=input-null.
So in order to fix that right, I though I would just try to
get all origin values while the inputs are still unjoined
and then keep that for later reference.
The function I use for storing away the origin data looks
like this:
int ggi_findorigin(ggi_visual_t vis,ggi_originbounds_t *origins) {
gii_input_t input;
gii_cmddata_getdevinfo dummy;
uint32 n;
uint32 origin;
input=ggiGetInput(vis);
printf("dev/inp=%p,%p\n",vis,input);
origins->first=0xffffffff;origins->last=0x00000000;
for(n=0;0==giiQueryDeviceInfoByNumber(input,n,&origin,&dummy);n++) {
if (origins->first>origin) origins->first=origin;
if (origins->last <origin) origins->last =origin;
}
printf("found %x,%x\n", origins->first, origins->last);
for(n=0;n<0x10000;n++) {
if (0==giiQueryDeviceInfo(input,n,&dummy)) {
printf("verify origin:%x.\n",n);
}
}
return (origins->first>origins->last);
}
O.K. - what does that do ?
First I get the Input from the visual - the printf is just there to
make sure that I don't accidentially query the same visual or something.
Then I query the attached devices by number and should get back the
origins they are sending on.
As this doesn't work right (see below), I try to verify my findings
by just scanning through the first 65536 possible origins and
listing those found.
Now in the main program I do:
state.info=ggiOpen(NULL);
ggi_findorigin(state.info, &state.ob_info);
state.visxy=ggiOpen(NULL);
ggi_findorigin(state.visxy,&state.ob_xy);
state.visxz=ggiOpen(NULL);
state.visyz=ggiOpen(NULL);
state.visrender=ggiOpen(NULL);
[...]
/* Find the origin ranges of all visuals
*/
ggi_findorigin(state.info, &state.ob_info);
ggi_findorigin(state.visxy,&state.ob_xy);
ggi_findorigin(state.visxz,&state.ob_xz);
ggi_findorigin(state.visyz,&state.ob_yz);
ggi_findorigin(state.visrender,&state.ob_render);
The two extra findorigins are a try to hotfix the problem for now
and to demonstrate the problem better.
Now when I run that (with GGI_INPUT=input-null), I get:
dev/inp=0x8318fa0,0x831caa0
found 100,101
verify origin:100.
verify origin:101.
dev/inp=0x831f9a8,0x83210d8
found 300,301
verify origin:300.
verify origin:301.
** These two are from the two queries right after the open and they
** seem to give correct data.
dev/inp=0x8318fa0,0x831caa0
found 900,901
dev/inp=0x831f9a8,0x83210d8
found 900,901
dev/inp=0x8323740,0x8324e70
found 900,901
dev/inp=0x83274d8,0x8328c08
found 900,901
dev/inp=0x832b278,0x832c9a8
found 900,901
verify origin:900.
verify origin:901.
** These are from the 5 consecutive ones later (inputs are still
** unjoined there. Only the last finding is correct, which
** seems to be proved by the "verfiy" lines.
However that seems to indicate a big bug somewhere, as
1. giiQueryDeviceInfoByNumber should work on any input, not just
the last one created
2. giiQueryDeviceInfo should always find the origins as well.
Comments, Ideas ?
Andy
--
Andreas Beck | Email : <[EMAIL PROTECTED]>