Fix builds

This commit is contained in:
Willow Barraco 2023-09-08 23:22:56 +02:00
parent a152fd036f
commit 76b64f6a85
No known key found for this signature in database
GPG Key ID: EABA44759877E02A
3 changed files with 16 additions and 17 deletions

View File

@ -2,3 +2,4 @@ BasedOnStyle: LLVM
IndentWidth: 4 IndentWidth: 4
AlwaysBreakAfterDefinitionReturnType: All AlwaysBreakAfterDefinitionReturnType: All
BreakBeforeBraces: Linux BreakBeforeBraces: Linux
SortIncludes: false

View File

@ -1,11 +1,11 @@
#include "keyboard.h"
#include "drw.h"
#include "os-compatibility.h"
#include "proto/virtual-keyboard-unstable-v1-client-protocol.h" #include "proto/virtual-keyboard-unstable-v1-client-protocol.h"
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "keyboard.h"
#include "drw.h"
#include "os-compatibility.h"
#define MAX_LAYERS 25 #define MAX_LAYERS 25
@ -52,8 +52,8 @@ kbd_next_layer(struct kbd *kb, struct key *k, bool invert)
layer_index = 0; layer_index = 0;
kb->mods = 0; kb->mods = 0;
} else if ((kb->mods & Shift) || (kb->mods & CapsLock) || (invert)) { } else if ((kb->mods & Shift) || (kb->mods & CapsLock) || (invert)) {
// with modifiers shift/capslock or invert set: switch to the // with modifiers shift/capslock or invert set: switch to the previous
// previous layout in the layer sequence // layout in the layer sequence
if (layer_index > 0) { if (layer_index > 0) {
layer_index--; layer_index--;
} else { } else {
@ -72,8 +72,7 @@ kbd_next_layer(struct kbd *kb, struct key *k, bool invert)
if (!invert) if (!invert)
kb->mods ^= Shift; kb->mods ^= Shift;
} else { } else {
// normal behaviour: switch to the next layout in the layer // normal behaviour: switch to the next layout in the layer sequence
// sequence
layer_index++; layer_index++;
} }
size_t layercount = 0; size_t layercount = 0;
@ -443,8 +442,7 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time)
} }
break; break;
case Compose: case Compose:
// switch to the associated layout determined by the *next* // switch to the associated layout determined by the *next* keypress
// keypress
if (kb->compose == 0) { if (kb->compose == 0) {
kb->compose = 1; kb->compose = 1;
} else { } else {
@ -456,8 +454,8 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time)
kbd_draw_key(kb, k, Unpress); kbd_draw_key(kb, k, Unpress);
} }
break; break;
case NextLayer: //(also handles previous layer when shift modifier is case NextLayer: //(also handles previous layer when shift modifier is on, or
// on, or "first layer" with other modifiers) //"first layer" with other modifiers)
kbd_next_layer(kb, k, false); kbd_next_layer(kb, k, false);
break; break;
case BackLayer: // triggered when "Abc" keys are pressed case BackLayer: // triggered when "Abc" keys are pressed
@ -465,8 +463,8 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time)
if (kb->last_abc_layout) { if (kb->last_abc_layout) {
kb->compose = 0; kb->compose = 0;
kbd_switch_layout(kb, kb->last_abc_layout, kb->last_abc_index); kbd_switch_layout(kb, kb->last_abc_layout, kb->last_abc_index);
// reset previous layout to default/first so we don't get // reset previous layout to default/first so we don't get any weird
// any weird cycles // cycles
kb->last_abc_index = 0; kb->last_abc_index = 0;
if (kb->landscape) { if (kb->landscape) {
kb->last_abc_layout = &kb->layouts[kb->landscape_layers[0]]; kb->last_abc_layout = &kb->layouts[kb->landscape_layers[0]];

8
main.c
View File

@ -1,22 +1,22 @@
#include "proto/fractional-scale-v1-client-protocol.h"
#include "proto/viewporter-client-protocol.h"
#include "proto/virtual-keyboard-unstable-v1-client-protocol.h" #include "proto/virtual-keyboard-unstable-v1-client-protocol.h"
#include "proto/wlr-layer-shell-unstable-v1-client-protocol.h" #include "proto/wlr-layer-shell-unstable-v1-client-protocol.h"
#include "proto/xdg-shell-client-protocol.h" #include "proto/xdg-shell-client-protocol.h"
#include "proto/fractional-scale-v1-client-protocol.h"
#include "proto/viewporter-client-protocol.h"
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <poll.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/signalfd.h> #include <sys/signalfd.h>
#include <poll.h>
#include <unistd.h> #include <unistd.h>
#include <wayland-client-protocol.h> #include <wayland-client-protocol.h>
#include <wayland-client.h> #include <wayland-client.h>
#include <wchar.h> #include <wchar.h>
#include "config.h"
#include "keyboard.h" #include "keyboard.h"
#include "config.h"
/* lazy die macro */ /* lazy die macro */
#define die(...) \ #define die(...) \