mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-03-12 18:32:48 +01:00
switch layers: fix crash
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
parent
24e354ce9e
commit
9e03e120c3
24
keyboard.c
24
keyboard.c
@ -66,20 +66,20 @@ kbd_next_layer(struct kbd *kb, struct key *k, bool invert) {
|
||||
} else {
|
||||
// normal behaviour: switch to the next layout in the layer sequence
|
||||
layer_index++;
|
||||
size_t layercount = 0;
|
||||
for (size_t i = 0; layercount == 0; i++) {
|
||||
if (kb->landscape) {
|
||||
if (kb->landscape_layers[i] == NumLayouts) layercount = i;
|
||||
} else {
|
||||
if (kb->layers[i] == NumLayouts) layercount = i;
|
||||
}
|
||||
}
|
||||
if (layer_index >= layercount) {
|
||||
if (kb->debug)
|
||||
fprintf(stderr, "wrapping layer_index back to start\n");
|
||||
layer_index = 0;
|
||||
}
|
||||
size_t layercount = 0;
|
||||
for (size_t i = 0; layercount == 0; i++) {
|
||||
if (kb->landscape) {
|
||||
if (kb->landscape_layers[i] == NumLayouts) layercount = i;
|
||||
} else {
|
||||
if (kb->layers[i] == NumLayouts) layercount = i;
|
||||
}
|
||||
}
|
||||
if (layer_index >= layercount) {
|
||||
if (kb->debug)
|
||||
fprintf(stderr, "wrapping layer_index back to start\n");
|
||||
layer_index = 0;
|
||||
}
|
||||
enum layout_id layer;
|
||||
if (kb->landscape) {
|
||||
layer = kb->landscape_layers[layer_index];
|
||||
|
Loading…
x
Reference in New Issue
Block a user