Changeset 0175246 in mainline


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, topic/simplify-dev-export
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.

Files:
15 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r56fa418 r0175246  
    457457% External ramdisk
    458458! [PLATFORM=sparc64] CONFIG_RD_EXTERNAL (y/n)
    459 
    460 % Keyboard layout
    461 @ "cz" Czech
    462 @ "us_qwerty" US QWERTY
    463 @ "us_dvorak" US Dvorak
    464 ! KBD_LAYOUT (choice)
  • defaults/amd64/Makefile.config

    r56fa418 r0175246  
    5858# Default framebuffer depth
    5959CONFIG_VESA_BPP = 16
    60 
    61 # Keyboard layout
    62 KBD_LAYOUT = us_qwerty
  • defaults/arm32/Makefile.config

    r56fa418 r0175246  
    3131# What is your output device?
    3232CONFIG_HID_OUT = generic
    33 
    34 # Keyboard layout
    35 KBD_LAYOUT = us_qwerty
  • defaults/ia32/Makefile.config

    r56fa418 r0175246  
    6464# Default framebuffer depth
    6565CONFIG_VESA_BPP = 16
    66 
    67 # Keyboard layout
    68 KBD_LAYOUT = us_qwerty
  • defaults/ia64/Makefile.config

    r56fa418 r0175246  
    4343# Output device class
    4444CONFIG_HID_OUT = generic
    45 
    46 # Keyboard layout
    47 KBD_LAYOUT = us_qwerty
  • defaults/mips32/Makefile.config

    r56fa418 r0175246  
    3737# Output device class
    3838CONFIG_HID_OUT = generic
    39 
    40 # Keyboard layout
    41 KBD_LAYOUT = us_qwerty
  • defaults/ppc32/Makefile.config

    r56fa418 r0175246  
    3434# Use Block Address Translation by the loader
    3535CONFIG_BAT = y
    36 
    37 # Keyboard layout
    38 KBD_LAYOUT = us_qwerty
  • defaults/sparc64/Makefile.config

    r56fa418 r0175246  
    5555# External ramdisk
    5656CONFIG_RD_EXTERNAL = y
    57 
    58 # Keyboard layout
    59 KBD_LAYOUT = us_qwerty
  • uspace/srv/console/console.c

    r56fa418 r0175246  
    437437
    438438                        if ((ev.key >= KC_F1) && (ev.key < KC_F1 +
    439                             CONSOLE_COUNT)) {
     439                            CONSOLE_COUNT) && ((ev.mods & KM_CTRL) == 0)) {
    440440                                if (ev.key == KC_F12)
    441441                                        change_console(KERNEL_CONSOLE);
  • uspace/srv/kbd/Makefile

    r56fa418 r0175246  
    5050
    5151ARCH_SOURCES =
    52 GENARCH_SOURCES =
    53 
    54 ifeq ($(KBD_LAYOUT), cz)
    55         GENARCH_SOURCES += layout/cz.c
    56 endif
    57 ifeq ($(KBD_LAYOUT), us_qwerty)
    58         GENARCH_SOURCES += layout/us_qwerty.c
    59 endif
    60 ifeq ($(KBD_LAYOUT), us_dvorak)
    61         GENARCH_SOURCES += layout/us_dvorak.c
    62 endif
     52GENARCH_SOURCES = \
     53        layout/cz.c \
     54        layout/us_qwerty.c \
     55        layout/us_dvorak.c
    6356
    6457ifeq ($(UARCH), amd64)
  • 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);
  • uspace/srv/kbd/include/layout.h

    r56fa418 r0175246  
    4141#include <sys/types.h>
    4242
    43 extern wchar_t layout_parse_ev(kbd_event_t *);
     43typedef struct {
     44        wchar_t (*parse_ev)(kbd_event_t *);
     45} layout_op_t;
     46
     47extern layout_op_t us_qwerty_op;
     48extern layout_op_t us_dvorak_op;
     49extern layout_op_t cz_op;
    4450
    4551#endif
  • uspace/srv/kbd/layout/cz.c

    r56fa418 r0175246  
    3737#include <layout.h>
    3838
     39static wchar_t layout_parse_ev(kbd_event_t *ev);
     40
     41layout_op_t cz_op = {
     42        layout_parse_ev
     43};
     44
    3945static wchar_t map_lcase[] = {
    4046        [KC_2] = L'ě',
     
    202208}
    203209
    204 wchar_t layout_parse_ev(kbd_event_t *ev)
     210static wchar_t layout_parse_ev(kbd_event_t *ev)
    205211{
    206212        wchar_t c;
  • uspace/srv/kbd/layout/us_dvorak.c

    r56fa418 r0175246  
    3737#include <layout.h>
    3838
     39static wchar_t layout_parse_ev(kbd_event_t *ev);
     40
     41layout_op_t us_dvorak_op = {
     42        layout_parse_ev
     43};
     44
    3945static wchar_t map_lcase[] = {
    4046        [KC_R] = 'p',
     
    198204}
    199205
    200 wchar_t layout_parse_ev(kbd_event_t *ev)
     206static wchar_t layout_parse_ev(kbd_event_t *ev)
    201207{
    202208        wchar_t c;
  • uspace/srv/kbd/layout/us_qwerty.c

    r56fa418 r0175246  
    3737#include <layout.h>
    3838
     39static wchar_t layout_parse_ev(kbd_event_t *ev);
     40
     41layout_op_t us_qwerty_op = {
     42        layout_parse_ev
     43};
     44
    3945static wchar_t map_lcase[] = {
    4046        [KC_Q] = 'q',
     
    192198}
    193199
    194 wchar_t layout_parse_ev(kbd_event_t *ev)
     200static wchar_t layout_parse_ev(kbd_event_t *ev)
    195201{
    196202        wchar_t c;
Note: See TracChangeset for help on using the changeset viewer.