The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
keyboard_layout.h
Go to the documentation of this file.
1/**
2 * @file keyboard_layout.h
3 * @brief Keyboard layout definitions.
4 *
5 * This file defines the structure for keyboard layouts, which map PS/2 scan codes to characters. It includes support for normal, shift, and AltGr (Right Alt / Option) mappings, as well as a combined AltGr + Shift mapping.
6 */
7
8#pragma once
9
10/**
11 * a keyboard layout maps PS/2 scan codes to characters.
12 * three maps: normal, shift, and altgr (Option on Mac).
13 * a fourth map (altgr+shift) is also provided for { and }.
14 */
15typedef struct
16{
17 const char *name;
18 const char normal[128];
19 const char shift[128];
20 const char altgr[128]; // AltGr / Right Alt / Option
21 const char altgr_shift[128]; // AltGr + Shift
23
24#include "common/stdint.h"
25
26/**
27 * get the active keyboard layout.
28 * @return pointer to the active layout.
29 */
31
32/**
33 * a built-in layout by its index (layouts.c has the list).
34 * @return the layout, or NULL past the last one.
35 */
37
38/**
39 * the index of the active layout.
40 */
42
43/**
44 * make a built-in layout the active one. the next key press uses it.
45 * @return false if there is no layout with this index.
46 */
48
49/**
50 * the layouts (each in its own file).
51 */
53const keyboard_layout_t *layout_us(void);
uint32_t keyboard_layout_index(void)
the index of the active layout.
Definition layouts.c:35
const keyboard_layout_t * keyboard_layout_at(uint32_t index)
a built-in layout by its index (layouts.c has the list).
Definition layouts.c:30
bool keyboard_set_layout(uint32_t index)
make a built-in layout the active one.
Definition layouts.c:40
const keyboard_layout_t * layout_us(void)
Definition layout_us.c:42
const keyboard_layout_t * keyboard_get_layout(void)
get the active keyboard layout.
Definition layouts.c:25
const keyboard_layout_t * layout_dk_mac(void)
the layouts (each in its own file).
Definition layout_dk_mac.c:170
unsigned int uint32_t
Definition fb.h:17
a keyboard layout maps PS/2 scan codes to characters.
Definition keyboard_layout.h:16
const char shift[128]
Definition keyboard_layout.h:19
const char altgr_shift[128]
Definition keyboard_layout.h:21
const char altgr[128]
Definition keyboard_layout.h:20
const char normal[128]
Definition keyboard_layout.h:18
const char * name
Definition keyboard_layout.h:17