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.

>               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.

>       case GIIK_P4:   byte4 = 1;      break;
>       case GIIK_P6:   byte4 = 2;      break;
>       case GIIK_P2:   byte4 = 4;      break;
>       case GIIK_P8:   byte4 = 8;      break;

The sym filed of a key event can never contain any of these. The sym
field describes the meaning of the key, which would be plain '4', '6',
'2' and '8' respectively for the above keys.

>       case GIIK_PEnter:               byte4 = 16;     break; // Start
>       case GIIK_PPlus:                byte4 = 32;     break; // Select

Neither can it contain any of these. Sym field would be GIIK_Enter and
GIIK_Plus (which is equivalent to '+').

>       case 27:        S9xExit ();     break;

Broken assumption, use GIIK_Escape.

You might want to consider using the label field as the sym field
will change for many keys when you have a modifier pressed. For
things like '+', '-' and other non-alphanumeric symbols it is however
wise to check the sym field as many keyboard maps don't have these
on an unshifted keys.

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: [EMAIL PROTECTED]

Reply via email to