On 1/6/06, Denis Oliver Kropp <[EMAIL PROTECTED]> wrote:
> Denis Oliver Kropp wrote:
> > Mike Emmel wrote:
> >
> >>On 1/6/06, Denis Oliver Kropp <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >>>Mike Emmel wrote:
> >>>
> >>>
> >>>>I'm not sure about this
> >>>>-     if (id >= DIKI_0 && id <= DIKI_9 )Yep m
> >>>>+     if (id >= DIKI_0 && id <= DIKI_9 && !shift ){
> >>>>         return DIKS_0 + id - DIKI_0;
> >>>>+     } else {
> >>>>+         switch(id) {
> >>>>+             case DIKI_1: return DIKS_EXCLAMATION_MARK;
> >>>>+             case DIKI_2: return DIKS_AT;
> >>>>+             case DIKI_3: return DIKS_NUMBER_SIGN;
> >>>>+             case DIKI_4: return DIKS_DOLLAR_SIGN;
> >>>>+             case DIKI_5: return DIKS_PERCENT_SIGN;
> >>>>+             case DIKI_6: return DIKS_CIRCUMFLEX_ACCENT;
> >>>>+             case DIKI_7: return DIKS_AMPERSAND;
> >>>>+             case DIKI_8: return DIKS_ASTERISK;
> >>>>+             case DIKI_9: return DIKS_PARENTHESIS_LEFT;
> >>>>+             case DIKI_0: return DIKS_PARENTHESIS_RIGHT;
> >>>>+             default:;
> >>>>+         }
> >>>>+     }
> >>>>
> >>>>I had code like this before and it broke things.
> >>>>I don't think you want to set the key_id to a DIKS.
> >>>>Can someone comment  on this please.
> >>>>Denis ???
> >>>Yep m
> >>>This is a part of the id_to_symbol() function, so it's correct
> >>>to return DIKS_* here, but I'm wondering why DIKI_1 translates to
> >>>an exclamation mark and not to DIKS_1 :)
> >>>
> >>
> >>
> >>That code runs if the shift key is down.
> >
> >
> > Hmm, I would have done a cascaded if to save the switch.
>
> if (id >= DIKI_0 && id <= DIKI_9) {
>       if (shift) {
>            switch(id) {
>               case DIKI_1: return DIKS_EXCLAMATION_MARK;
>               case DIKI_2: return DIKS_AT;
>               case DIKI_3: return DIKS_NUMBER_SIGN;
>               case DIKI_4: return DIKS_DOLLAR_SIGN;
>               case DIKI_5: return DIKS_PERCENT_SIGN;
>               case DIKI_6: return DIKS_CIRCUMFLEX_ACCENT;
>               case DIKI_7: return DIKS_AMPERSAND;
>               case DIKI_8: return DIKS_ASTERISK;
>               case DIKI_9: return DIKS_PARENTHESIS_LEFT;
>               case DIKI_0: return DIKS_PARENTHESIS_RIGHT;
>               default:;
>           }
>      }
>      else
>           return DIKS_0 + id - DIKI_0;
> }
>
I'll change it that way its cleaner it took me a sec to figure it out too.
Mike

> --
> Best regards,
>    Denis Oliver Kropp
>
> .------------------------------------------.
> | DirectFB - Hardware accelerated graphics |
> | http://www.directfb.org/                 |
> "------------------------------------------"
>

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to