suggestion picker: a persistent layer to complement virtual keyboards like wvkbd
-rw-r--r--config.def.h2
-rw-r--r--drw.c1
-rw-r--r--keyboard.c26
-rw-r--r--main.c6
4 files changed, 18 insertions, 17 deletions
diff --git a/config.def.h b/config.def.h
index 947a75e..2c2ea33 100644
--- a/config.def.h
+++ b/config.def.h
@@ -23,7 +23,7 @@ struct clr_scheme scheme1 = {
/* layers is an ordered list of layouts, used to cycle through */
static enum layout_id layers[] = {
Full, // First layout is the default layout on startup
- Special, Emoji, Simple, SimpleGrid, Nav, Dialer, Cyrillic, Arabic, Georgian,
+ Special, Emoji, Simple, SimpleGrid, Nav, Dialer, Cyrillic, Arabic, Georgian,
NumLayouts // signals the last item, may not be omitted
};
diff --git a/drw.c b/drw.c
index 89cb100..a7cfd20 100644
--- a/drw.c
+++ b/drw.c
@@ -85,7 +85,6 @@ drw_do_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
color.bgra[0] / (double)255, color.bgra[3] / (double)255);
cairo_fill(d->cairo);
-
cairo_restore(d->cairo);
wl_surface_damage(d->surf, x, y, w, h);
diff --git a/keyboard.c b/keyboard.c
index 36cff78..3c77a4b 100644
--- a/keyboard.c
+++ b/keyboard.c
@@ -166,17 +166,17 @@ kbd_get_key(struct kbd *kb, uint32_t x, uint32_t y) {
void
kbd_unpress_key(struct kbd *kb, uint32_t time) {
- bool unlatch_shift = false;
+ bool unlatch_shift = false;
if (kb->last_press) {
- unlatch_shift = (kb->mods & Shift) == Shift;
+ unlatch_shift = (kb->mods & Shift) == Shift;
- if (unlatch_shift) {
- kb->mods ^= Shift;
- zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0);
- }
+ if (unlatch_shift) {
+ kb->mods ^= Shift;
+ zwp_virtual_keyboard_v1_modifiers(kb->vkbd, kb->mods, 0, 0, 0);
+ }
- if (kb->last_press->type == Copy) {
+ if (kb->last_press->type == Copy) {
zwp_virtual_keyboard_v1_key(kb->vkbd, time, 127, // COMP key
WL_KEYBOARD_KEY_STATE_RELEASED);
} else {
@@ -190,14 +190,15 @@ kbd_unpress_key(struct kbd *kb, uint32_t time) {
} else if (unlatch_shift) {
kbd_draw_layout(kb);
} else {
- kbd_draw_key(kb, kb->last_press, Unpress);
- }
+ kbd_draw_key(kb, kb->last_press, Unpress);
+ }
kb->last_press = NULL;
}
}
-void kbd_release_key(struct kbd *kb, uint32_t time) {
+void
+kbd_release_key(struct kbd *kb, uint32_t time) {
kbd_unpress_key(kb, time);
if (kb->print_intersect && kb->last_swipe) {
printf("\n");
@@ -208,7 +209,8 @@ void kbd_release_key(struct kbd *kb, uint32_t time) {
}
}
-void kbd_motion_key(struct kbd *kb, uint32_t time, uint32_t x, uint32_t y) {
+void
+kbd_motion_key(struct kbd *kb, uint32_t time, uint32_t x, uint32_t y) {
// Output intersecting keys
// (for external 'swiping'-based accelerators).
if (kb->print_intersect) {
@@ -220,7 +222,7 @@ void kbd_motion_key(struct kbd *kb, uint32_t time, uint32_t x, uint32_t y) {
struct key *intersect_key;
intersect_key = kbd_get_key(kb, x, y);
if (intersect_key &&
- (! kb->last_swipe || intersect_key->label != kb->last_swipe->label)) {
+ (!kb->last_swipe || intersect_key->label != kb->last_swipe->label)) {
kbd_print_key_stdout(kb, intersect_key);
kb->last_swipe = intersect_key;
kbd_draw_key(kb, kb->last_swipe, Swipe);
diff --git a/main.c b/main.c
index f8a1042..5eab410 100644
--- a/main.c
+++ b/main.c
@@ -460,7 +460,8 @@ main(int argc, char **argv) {
keyboard.print = true;
} else if (!strcmp(argv[i], "-O")) {
keyboard.print_intersect = true;
- } else if ((!strcmp(argv[i], "-hidden")) || (!strcmp(argv[i], "--hidden"))) {
+ } else if ((!strcmp(argv[i], "-hidden")) ||
+ (!strcmp(argv[i], "--hidden"))) {
starthidden = true;
} else {
fprintf(stderr, "Invalid argument: %s\n", argv[i]);
@@ -509,7 +510,6 @@ main(int argc, char **argv) {
draw_ctx.font_description =
pango_font_description_from_string(fc_font_pattern);
-
if (!starthidden) {
draw_surf.surf = wl_compositor_create_surface(compositor);
@@ -521,7 +521,7 @@ main(int argc, char **argv) {
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, height);
zwlr_layer_surface_v1_set_keyboard_interactivity(layer_surface, false);
zwlr_layer_surface_v1_add_listener(layer_surface, &layer_surface_listener,
- NULL);
+ NULL);
wl_surface_commit(draw_surf.surf);
wl_display_roundtrip(display);