Changeset 07b7c48 in mainline for uspace/lib/clui/tinput.c


Ignore:
Timestamp:
2013-04-12T09:01:10Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
902f0906
Parents:
bc4bf97
Message:

Extend console library API to support different event types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/clui/tinput.c

    rbc4bf97 r07b7c48  
    816816                console_flush(ti->console);
    817817               
    818                 kbd_event_t ev;
    819                 if (!console_get_kbd_event(ti->console, &ev))
     818                cons_event_t ev;
     819                if (!console_get_event(ti->console, &ev))
    820820                        return EIO;
    821821               
    822                 if (ev.type != KEY_PRESS)
     822                if (ev.type != CEV_KEY || ev.ev.key.type != KEY_PRESS)
    823823                        continue;
    824824               
    825                 if (((ev.mods & KM_CTRL) != 0) &&
    826                     ((ev.mods & (KM_ALT | KM_SHIFT)) == 0))
    827                         tinput_key_ctrl(ti, &ev);
    828                
    829                 if (((ev.mods & KM_SHIFT) != 0) &&
    830                     ((ev.mods & (KM_CTRL | KM_ALT)) == 0))
    831                         tinput_key_shift(ti, &ev);
    832                
    833                 if (((ev.mods & KM_CTRL) != 0) &&
    834                     ((ev.mods & KM_SHIFT) != 0) &&
    835                     ((ev.mods & KM_ALT) == 0))
    836                         tinput_key_ctrl_shift(ti, &ev);
    837                
    838                 if ((ev.mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)
    839                         tinput_key_unmod(ti, &ev);
    840                
    841                 if (ev.c >= ' ') {
     825                kbd_event_t *kev = &ev.ev.key;
     826               
     827                if (((kev->mods & KM_CTRL) != 0) &&
     828                    ((kev->mods & (KM_ALT | KM_SHIFT)) == 0))
     829                        tinput_key_ctrl(ti, kev);
     830               
     831                if (((kev->mods & KM_SHIFT) != 0) &&
     832                    ((kev->mods & (KM_CTRL | KM_ALT)) == 0))
     833                        tinput_key_shift(ti, kev);
     834               
     835                if (((kev->mods & KM_CTRL) != 0) &&
     836                    ((kev->mods & KM_SHIFT) != 0) &&
     837                    ((kev->mods & KM_ALT) == 0))
     838                        tinput_key_ctrl_shift(ti, kev);
     839               
     840                if ((kev->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)
     841                        tinput_key_unmod(ti, kev);
     842               
     843                if (kev->c >= ' ') {
    842844                        tinput_sel_delete(ti);
    843                         tinput_insert_char(ti, ev.c);
     845                        tinput_insert_char(ti, kev->c);
    844846                }
    845847        }
Note: See TracChangeset for help on using the changeset viewer.