On 26 May 2000, Marcus Sundberg wrote:

> Jay <[EMAIL PROTECTED]> writes:
> 
> > I can't show everything just yet, but here is what I can. This is all of the gii
> > stuff:
> 
> Ok, should be enough.
> 
> >     /* This is where I have to do stuff wrong or my keyboard doesn't work
> >        Keep in mind I am useing the SVGALIB target; it might be the problem */
> >     giiInit();
> >     inp=giiOpen("input-null", NULL);
> >     if (inp==NULL) {
> >             fprintf(stderr, "Error in input libgii, bailing out...");
> >             S9xExit();
> >     }
> >     kbd=giiOpen("input-linux-kbd",NULL);
> >     if (kbd==NULL) {
> >             fprintf(stderr, "Error getting keyboard, bailing out...");
> >             S9xExit();
> >     }
> >     mouse=giiOpen("input-linux-mouse",NULL);
> >     /* I don't think the mouse has ever accually worked */
> >     if (mouse==NULL) {
> >             fprintf(stderr, "Error getting mouse, oh well...");
> >             inp=giiJoinInputs(inp, kbd);
> >     } else {
> >             inp=giiJoinInputs(inp, kbd);
> >             inp=giiJoinInputs(inp, mouse);
> >     }
> >     ggiInit();
> >     vis=ggiOpen(NULL);
> >     if (vis==NULL) {
> >             fprintf(stderr, "Error getting visual");
> >             S9xExit();
> >     }
> 
> Ok, this code is utterly broken. You can't open inputs allready used
> by LibGGI. Start by removing _all_ occurences of gii* functions. If
> there's still a problem, run your program with GGI_DEBUG=255 and we
> can start debugging things.

Yes, and use ggiJoinInputs instead of giiJoinInputs.
 
> >             if (ggiSetGraphMode(vis, 640, 480, 640, 480, GT_32BIT)) {
> >                     fprintf(stderr, "Error getting visual");
> >                     S9xExit();
> >             }
> >     } else {
> >             halfxres=320/2;
> >             halfyres=240/2;
> > 
> >             if (ggiSetGraphMode(vis, 320, 240, 320, 240, GT_32BIT)) {
> >                     fprintf(stderr, "Error getting visual");
> >                     S9xExit();
> >             }
> 
> Also never hardcode values which you don't care about, like in this
> case the virtual size.

Yes, GGI_AUTO should be used instead...
And it is recommended to check if the return-value of ggiSetGraphMode
is < 0, because values < 0 always indicates an error. Values > 0 are
AFAIK still undefined and reserved for future developments.

 
Christoph Egger
E-Mail: [EMAIL PROTECTED]

Reply via email to