Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4239 → Rev 4240

/trunk/uspace/srv/kbd/include/layout.h
40,8 → 40,14
#include <kbd/kbd.h>
#include <sys/types.h>
 
extern wchar_t layout_parse_ev(kbd_event_t *);
typedef struct {
wchar_t (*parse_ev)(kbd_event_t *);
} layout_op_t;
 
extern layout_op_t us_qwerty_op;
extern layout_op_t us_dvorak_op;
extern layout_op_t cz_op;
 
#endif
 
/**
/trunk/uspace/srv/kbd/generic/kbd.c
70,6 → 70,16
int cir_service = 0;
int cir_phone = -1;
 
#define NUM_LAYOUTS 3
 
static layout_op_t *layout[NUM_LAYOUTS] = {
&us_qwerty_op,
&us_dvorak_op,
&cz_op
};
 
static int active_layout = 0;
 
void kbd_push_scancode(int scancode)
{
/* printf("scancode: 0x%x\n", scancode);*/
123,11 → 133,29
printf("mods: 0x%x\n", mods);
printf("keycode: %u\n", key);
*/
if (type == KE_PRESS && (mods & KM_LCTRL) &&
key == KC_F1) {
active_layout = 0;
return;
}
 
if (type == KE_PRESS && (mods & KM_LCTRL) &&
key == KC_F2) {
active_layout = 1;
return;
}
 
if (type == KE_PRESS && (mods & KM_LCTRL) &&
key == KC_F3) {
active_layout = 2;
return;
}
 
ev.type = type;
ev.key = key;
ev.mods = mods;
 
ev.c = layout_parse_ev(&ev);
ev.c = layout[active_layout]->parse_ev(&ev);
 
async_msg_4(phone2cons, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
}
/trunk/uspace/srv/kbd/Makefile
49,18 → 49,11
generic/key_buffer.c
 
ARCH_SOURCES =
GENARCH_SOURCES =
GENARCH_SOURCES = \
layout/cz.c \
layout/us_qwerty.c \
layout/us_dvorak.c
 
ifeq ($(KBD_LAYOUT), cz)
GENARCH_SOURCES += layout/cz.c
endif
ifeq ($(KBD_LAYOUT), us_qwerty)
GENARCH_SOURCES += layout/us_qwerty.c
endif
ifeq ($(KBD_LAYOUT), us_dvorak)
GENARCH_SOURCES += layout/us_dvorak.c
endif
 
ifeq ($(UARCH), amd64)
GENARCH_SOURCES += \
port/i8042.c \
/trunk/uspace/srv/kbd/layout/us_qwerty.c
36,6 → 36,12
#include <kbd/keycode.h>
#include <layout.h>
 
static wchar_t layout_parse_ev(kbd_event_t *ev);
 
layout_op_t us_qwerty_op = {
layout_parse_ev
};
 
static wchar_t map_lcase[] = {
[KC_Q] = 'q',
[KC_W] = 'w',
191,7 → 197,7
return map[key];
}
 
wchar_t layout_parse_ev(kbd_event_t *ev)
static wchar_t layout_parse_ev(kbd_event_t *ev)
{
wchar_t c;
 
/trunk/uspace/srv/kbd/layout/cz.c
36,6 → 36,12
#include <kbd/keycode.h>
#include <layout.h>
 
static wchar_t layout_parse_ev(kbd_event_t *ev);
 
layout_op_t cz_op = {
layout_parse_ev
};
 
static wchar_t map_lcase[] = {
[KC_2] = L'ě',
[KC_3] = L'š',
201,7 → 207,7
return map[key];
}
 
wchar_t layout_parse_ev(kbd_event_t *ev)
static wchar_t layout_parse_ev(kbd_event_t *ev)
{
wchar_t c;
 
/trunk/uspace/srv/kbd/layout/us_dvorak.c
36,6 → 36,12
#include <kbd/keycode.h>
#include <layout.h>
 
static wchar_t layout_parse_ev(kbd_event_t *ev);
 
layout_op_t us_dvorak_op = {
layout_parse_ev
};
 
static wchar_t map_lcase[] = {
[KC_R] = 'p',
[KC_T] = 'y',
197,7 → 203,7
return map[key];
}
 
wchar_t layout_parse_ev(kbd_event_t *ev)
static wchar_t layout_parse_ev(kbd_event_t *ev)
{
wchar_t c;
 
/trunk/uspace/srv/console/console.c
436,7 → 436,7
conn = &connections[active_console];
 
if ((ev.key >= KC_F1) && (ev.key < KC_F1 +
CONSOLE_COUNT)) {
CONSOLE_COUNT) && ((ev.mods & KM_CTRL) == 0)) {
if (ev.key == KC_F12)
change_console(KERNEL_CONSOLE);
else
/trunk/HelenOS.config
456,9 → 456,3
 
% External ramdisk
! [PLATFORM=sparc64] CONFIG_RD_EXTERNAL (y/n)
 
% Keyboard layout
@ "cz" Czech
@ "us_qwerty" US QWERTY
@ "us_dvorak" US Dvorak
! KBD_LAYOUT (choice)
/trunk/defaults/sparc64/Makefile.config
54,6 → 54,3
 
# External ramdisk
CONFIG_RD_EXTERNAL = y
 
# Keyboard layout
KBD_LAYOUT = us_qwerty
/trunk/defaults/ia64/Makefile.config
42,6 → 42,3
 
# Output device class
CONFIG_HID_OUT = generic
 
# Keyboard layout
KBD_LAYOUT = us_qwerty
/trunk/defaults/arm32/Makefile.config
30,6 → 30,3
 
# What is your output device?
CONFIG_HID_OUT = generic
 
# Keyboard layout
KBD_LAYOUT = us_qwerty
/trunk/defaults/ppc32/Makefile.config
33,6 → 33,3
 
# Use Block Address Translation by the loader
CONFIG_BAT = y
 
# Keyboard layout
KBD_LAYOUT = us_qwerty
/trunk/defaults/amd64/Makefile.config
57,6 → 57,3
 
# Default framebuffer depth
CONFIG_VESA_BPP = 16
 
# Keyboard layout
KBD_LAYOUT = us_qwerty
/trunk/defaults/mips32/Makefile.config
36,6 → 36,3
 
# Output device class
CONFIG_HID_OUT = generic
 
# Keyboard layout
KBD_LAYOUT = us_qwerty
/trunk/defaults/ia32/Makefile.config
63,6 → 63,3
 
# Default framebuffer depth
CONFIG_VESA_BPP = 16
 
# Keyboard layout
KBD_LAYOUT = us_qwerty