Ignore:
Timestamp:
Mar 23, 2006, 7:36:59 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Massive rework of the event handling code, as per the TODO list.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_conio.c

    r672 r681  
    122122}
    123123
    124 static unsigned int conio_get_event(caca_t *kk)
     124static int conio_get_event(caca_t *kk, struct caca_event *ev)
    125125{
    126     unsigned int event;
     126    unsigned char ch;
     127    struct caca_event release;
    127128
    128129    if(!_conio_kbhit())
    129         return CACA_EVENT_NONE;
     130    {
     131        ev->type = CACA_EVENT_NONE;
     132        return 0;
     133    }
    130134
    131     event = getch();
    132     _push_event(kk, CACA_EVENT_KEY_RELEASE | event);
    133     return CACA_EVENT_KEY_PRESS | event;
     135    ch = getch();
     136
     137    ev->type = CACA_EVENT_KEY_PRESS;
     138    ev->data.key.c = ch;
     139    ev->data.key.ucs4 = (uint32_t)ch;
     140    ev->data.key.utf8[0] = ch;
     141    ev->data.key.utf8[1] = '\0';
     142
     143    release = *ev;
     144    release.type = CACA_EVENT_KEY_RELEASE;
     145    _push_event(kk, &release);
     146
     147    return 1;
    134148}
    135149
Note: See TracChangeset for help on using the changeset viewer.