Changeset 0175246 in mainline for uspace/srv/kbd/generic/kbd.c


Ignore:
Timestamp:
2009-04-05T16:20:02Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
Children:
482c86f
Parents:
56fa418
Message:

Primitive means of switching keyboard layout at run time. Use Ctrl+Fn, 1 = QWERTY, 2 = Dvorak, 3 = Czech. Remove compile-time option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/kbd/generic/kbd.c

    r56fa418 r0175246  
    7171int cir_phone = -1;
    7272
     73#define NUM_LAYOUTS 3
     74
     75static layout_op_t *layout[NUM_LAYOUTS] = {
     76        &us_qwerty_op,
     77        &us_dvorak_op,
     78        &cz_op
     79};
     80
     81static int active_layout = 0;
     82
    7383void kbd_push_scancode(int scancode)
    7484{
     
    124134        printf("keycode: %u\n", key);
    125135*/
     136        if (type == KE_PRESS && (mods & KM_LCTRL) &&
     137                key == KC_F1) {
     138                active_layout = 0;
     139                return;
     140        }
     141
     142        if (type == KE_PRESS && (mods & KM_LCTRL) &&
     143                key == KC_F2) {
     144                active_layout = 1;
     145                return;
     146        }
     147
     148        if (type == KE_PRESS && (mods & KM_LCTRL) &&
     149                key == KC_F3) {
     150                active_layout = 2;
     151                return;
     152        }
     153
    126154        ev.type = type;
    127155        ev.key = key;
    128156        ev.mods = mods;
    129157
    130         ev.c = layout_parse_ev(&ev);
     158        ev.c = layout[active_layout]->parse_ev(&ev);
    131159
    132160        async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
Note: See TracChangeset for help on using the changeset viewer.