Changeset 12b6796 in mainline for uspace/srv/kbd/generic/kbd.c


Ignore:
Timestamp:
2009-02-20T22:47:08Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5ad8661
Parents:
90e3d6a
Message:

Tackle scroll lock and cope with lock-key hardware auto-repeat.

File:
1 edited

Legend:

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

    r90e3d6a r12b6796  
    6464static unsigned mods = KM_NUM_LOCK;
    6565
     66/** Currently pressed lock keys. We track these to tackle autorepeat. */
     67static unsigned lock_keys;
     68
    6669void kbd_push_scancode(int scancode)
    6770{
     
    99102        }
    100103
    101         if (mod_mask != 0 && type == KE_PRESS)
    102                 mods = mods ^ mod_mask;
     104        if (mod_mask != 0) {
     105                if (type == KE_PRESS) {
     106                        /*
     107                         * Only change lock state on transition from released
     108                         * to pressed. This prevents autorepeat from messing
     109                         * up the lock state.
     110                         */
     111                        mods = mods ^ (mod_mask & ~lock_keys);
     112                        lock_keys = lock_keys | mod_mask;
     113                } else {
     114                        lock_keys = lock_keys & ~mod_mask;
     115                }
     116        }
    103117
    104118        printf("type: %d\n", type);
Note: See TracChangeset for help on using the changeset viewer.