mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-08-29 23:32:01 +02:00
Add landscape layers
This commit is contained in:
committed by
John Sullivan
parent
450d43ff44
commit
e100aafb05
26
keyboard.c
26
keyboard.c
@@ -97,7 +97,14 @@ void kbd_init(struct kbd *kb, struct layout * layouts, char * layer_names_list)
|
||||
}
|
||||
fprintf(stderr, "Found %d layers\n",i);
|
||||
|
||||
kb->layout = &kb->layouts[kb->layers[kb->layer_index]];
|
||||
enum layout_id layer;
|
||||
if (kb->landscape) {
|
||||
layer = kb->landscape_layers[kb->layer_index];
|
||||
} else {
|
||||
layer = kb->layers[kb->layer_index];
|
||||
}
|
||||
|
||||
kb->layout = &kb->layouts[layer];
|
||||
kb->prevlayout = kb->layout;
|
||||
|
||||
/* upload keymap */
|
||||
@@ -236,10 +243,21 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) {
|
||||
case NextLayer:
|
||||
//switch to the next layout in the layer sequence
|
||||
kb->layer_index++;
|
||||
if (kb->layers[kb->layer_index] == NumLayouts) {
|
||||
kb->layer_index = 0;
|
||||
enum layout_id layer;
|
||||
if (kb->landscape) {
|
||||
layer = kb->landscape_layers[kb->layer_index];
|
||||
} else {
|
||||
layer = kb->layers[kb->layer_index];
|
||||
}
|
||||
kbd_switch_layout(kb, &kb->layouts[kb->layers[kb->layer_index]]);
|
||||
if (layer == NumLayouts) {
|
||||
kb->layer_index = 0;
|
||||
if (kb->landscape) {
|
||||
layer = kb->landscape_layers[kb->layer_index];
|
||||
} else {
|
||||
layer = kb->layers[kb->layer_index];
|
||||
}
|
||||
}
|
||||
kbd_switch_layout(kb, &kb->layouts[layer]);
|
||||
break;
|
||||
case BackLayer:
|
||||
//switch to the previously active layout
|
||||
|
Reference in New Issue
Block a user