Changeset cb9313e in mainline for uspace/srv/hid/input/input.c


Ignore:
Timestamp:
2019-05-12T15:02:29Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
3e1bc35
Parents:
1e8b633
git-author:
Matthieu Riolo <matthieu.riolo@…> (2019-05-12 05:41:53)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-05-12 15:02:29)
Message:

Adding a configuration flag which allows to define which is
the default keyboard layout

This commit adds a new configuration flag which defines the
default keyboard layout. This layout will be hardcoded into
the system. Changing to this keyboard layout can be done by
pressing CTRL+F1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/input.c

    r1e8b633 rcb9313e  
    6666#include "serial.h"
    6767
    68 #define NUM_LAYOUTS  4
    69 
    70 static layout_ops_t *layout[NUM_LAYOUTS] = {
    71         &us_qwerty_ops,
    72         &us_dvorak_ops,
    73         &cz_ops,
    74         &ar_ops
    75 };
    76 
    7768typedef struct {
    7869        /** Link into the list of clients */
     
    206197        }
    207198
    208         // TODO: More elegant layout switching
    209 
    210         if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
    211             (key == KC_F1)) {
     199        if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) && (key == KC_F1)) {
    212200                layout_destroy(kdev->active_layout);
    213                 kdev->active_layout = layout_create(layout[0]);
    214                 return;
    215         }
    216 
    217         if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
    218             (key == KC_F2)) {
    219                 layout_destroy(kdev->active_layout);
    220                 kdev->active_layout = layout_create(layout[1]);
    221                 return;
    222         }
    223 
    224         if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
    225             (key == KC_F3)) {
    226                 layout_destroy(kdev->active_layout);
    227                 kdev->active_layout = layout_create(layout[2]);
    228                 return;
    229         }
    230 
    231         if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
    232             (key == KC_F4)) {
    233                 layout_destroy(kdev->active_layout);
    234                 kdev->active_layout = layout_create(layout[3]);
     201                kdev->active_layout = layout_create(&layout_default);
    235202                return;
    236203        }
     
    392359        kdev->mods = KM_NUM_LOCK;
    393360        kdev->lock_keys = 0;
    394         kdev->active_layout = layout_create(layout[0]);
     361        kdev->active_layout = layout_create(&layout_default);
    395362
    396363        return kdev;
Note: See TracChangeset for help on using the changeset viewer.