Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset cb9313e in mainline


Ignore:
Timestamp:
2019-05-12T15:02:29Z (18 months 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.

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r1e8b633 rcb9313e  
    497497! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&MACHINE=msim] CONFIG_MSIM_PRN (y/n)
    498498
     499% Default Keyboard Layout
     500@ "ar" Arabic
     501@ "cz" Czech
     502@ "us_dvorak" English US (DVORAK)
     503@ "us_qwerty" English US
     504! [CONFIG_PC_KBD=y|CONFIG_AT_KBD=y|CONFIG_MSIM_KBD=y] CONFIG_KB_LAYOUT (choice)
     505
    499506% Support for VIA CUDA controller
    500507! [CONFIG_HID_IN=generic&PLATFORM=ppc32] CONFIG_VIA_CUDA (y/n)
  • defaults/amd64/Makefile.config

    r1e8b633 rcb9313e  
    5353CONFIG_PC_KBD = y
    5454
     55# Default keyboard layout
     56CONFIG_KB_LAYOUT = us_qwerty
     57
    5558# EGA support
    5659CONFIG_EGA = y
  • defaults/arm32/Makefile.config

    r1e8b633 rcb9313e  
    3838CONFIG_HID_OUT = generic
    3939
     40# Default keyboard layout
     41CONFIG_KB_LAYOUT = us_qwerty
     42
    4043# Dynamic linking support
    4144CONFIG_RTLD = y
  • defaults/arm64/Makefile.config

    r1e8b633 rcb9313e  
    4747CONFIG_HID_OUT = generic
    4848
     49# Default keyboard layout
     50CONFIG_KB_LAYOUT = us_qwerty
     51
    4952# Optimization level
    5053OPTIMIZATION = 3
  • defaults/ia64/Makefile.config

    r1e8b633 rcb9313e  
    5050CONFIG_HID_OUT = generic
    5151
     52# Default keyboard layout
     53CONFIG_KB_LAYOUT = us_qwerty
     54
    5255# Optimization level
    5356OPTIMIZATION = 3
  • defaults/mips32/Makefile.config

    r1e8b633 rcb9313e  
    4444CONFIG_HID_OUT = generic
    4545
     46# Default keyboard layout
     47CONFIG_KB_LAYOUT = us_qwerty
     48
    4649# Barebone build with essential binaries only
    4750CONFIG_BAREBONE = y
  • defaults/ppc32/Makefile.config

    r1e8b633 rcb9313e  
    4141CONFIG_HID_OUT = generic
    4242
     43# Default keyboard layout
     44CONFIG_KB_LAYOUT = us_qwerty
     45
    4346# Framebuffer support
    4447CONFIG_FB = y
  • defaults/riscv64/Makefile.config

    r1e8b633 rcb9313e  
    3838CONFIG_HID_OUT = generic
    3939
     40# Default keyboard layout
     41CONFIG_KB_LAYOUT = us_qwerty
     42
    4043# Optimization level
    4144OPTIMIZATION = 3
  • defaults/sparc64/Makefile.config

    r1e8b633 rcb9313e  
    5353CONFIG_HID_OUT = generic
    5454
     55# Default keyboard layout
     56CONFIG_KB_LAYOUT = us_qwerty
     57
    5558# Start AP processors by the loader
    5659CONFIG_AP = y
  • defaults/special/Makefile.config

    r1e8b633 rcb9313e  
    3232CONFIG_TEST = y
    3333
     34# Default keyboard layout
     35CONFIG_KB_LAYOUT = us_qwerty
     36
    3437# Optimization level
    3538OPTIMIZATION = 3
  • uspace/srv/hid/input/Makefile

    r1e8b633 rcb9313e  
    3232LIBS = drv
    3333
     34ROOT_PATH = $(USPACE_PREFIX)/..
     35CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
     36
     37include $(CONFIG_MAKEFILE)
     38
     39ifndef CONFIG_KB_LAYOUT
     40$(error CONFIG_KB_LAYOUT must be set! Please reconfigure your HelenOS.config)
     41endif
     42
    3443SOURCES = \
    35         layout/cz.c \
    36         layout/us_qwerty.c \
    37         layout/us_dvorak.c \
    38         layout/ar.c \
     44        layout/$(CONFIG_KB_LAYOUT).c \
    3945        port/chardev.c \
    4046        proto/mousedev.c \
     
    4753        stroke.c
    4854
     55
    4956include $(USPACE_PREFIX)/Makefile.common
     57
  • 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;
  • uspace/srv/hid/input/layout.h

    r1e8b633 rcb9313e  
    5656} layout_ops_t;
    5757
    58 extern layout_ops_t us_qwerty_ops;
    59 extern layout_ops_t us_dvorak_ops;
    60 extern layout_ops_t cz_ops;
    61 extern layout_ops_t ar_ops;
     58extern layout_ops_t layout_default;
    6259
    6360extern layout_t *layout_create(layout_ops_t *);
  • uspace/srv/hid/input/layout/ar.c

    r1e8b633 rcb9313e  
    4646static wchar_t ar_parse_ev(layout_t *, kbd_event_t *ev);
    4747
    48 layout_ops_t ar_ops = {
     48#ifdef CONFIG_KB_LAYOUT_ar
     49
     50layout_ops_t layout_default = {
    4951        .create = ar_create,
    5052        .destroy = ar_destroy,
    5153        .parse_ev = ar_parse_ev
    5254};
     55
     56#endif
    5357
    5458static wchar_t map_not_shifted[] = {
  • uspace/srv/hid/input/layout/cz.c

    r1e8b633 rcb9313e  
    5757} layout_cz_t;
    5858
    59 layout_ops_t cz_ops = {
     59#ifdef CONFIG_KB_LAYOUT_us_qwerty
     60
     61layout_ops_t layout_default = {
    6062        .create = cz_create,
    6163        .destroy = cz_destroy,
    6264        .parse_ev = cz_parse_ev
    6365};
     66
     67#endif
    6468
    6569static wchar_t map_lcase[] = {
  • uspace/srv/hid/input/layout/us_dvorak.c

    r1e8b633 rcb9313e  
    4545static wchar_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
    4646
    47 layout_ops_t us_dvorak_ops = {
     47#ifdef CONFIG_KB_LAYOUT_us_dvorak
     48
     49layout_ops_t layout_default = {
    4850        .create = us_dvorak_create,
    4951        .destroy = us_dvorak_destroy,
    5052        .parse_ev = us_dvorak_parse_ev
    5153};
     54
     55#endif
    5256
    5357static wchar_t map_lcase[] = {
  • uspace/srv/hid/input/layout/us_qwerty.c

    r1e8b633 rcb9313e  
    4545static wchar_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
    4646
    47 layout_ops_t us_qwerty_ops = {
     47#ifdef CONFIG_KB_LAYOUT_us_qwerty
     48
     49layout_ops_t layout_default = {
    4850        .create = us_qwerty_create,
    4951        .destroy = us_qwerty_destroy,
    5052        .parse_ev = us_qwerty_parse_ev
    5153};
     54
     55#endif
    5256
    5357static wchar_t map_lcase[] = {
Note: See TracChangeset for help on using the changeset viewer.