wvkbd

git clone https://git.tarina.org/wvkbd
Log | Files | Refs | README | LICENSE

commit e5648bcfaceacd428e5b72fdacbc33083d93d939
parent aa65896fbfde70c020fabd00c789544fa1c07d61
Author: John Sullivan <jsullivan@csumb.edu>
Date:   Sun,  9 Jan 2022 21:25:58 -0800

project: rerun clang-format

TODO make a commit or PR hook for this

Diffstat:
Mconfig.def.h | 2+-
Mdrw.c | 1-
Mkeyboard.c | 26++++++++++++++------------
Mkeymap.mobintl.h | 2+-
Mlayout.mobintl.h | 25+++++++++++++------------
Mmain.c | 6+++---
6 files changed, 32 insertions(+), 30 deletions(-)

diff --git 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 @@ -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 @@ -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/keymap.mobintl.h b/keymap.mobintl.h @@ -4393,7 +4393,7 @@ xkb_symbols \"(unnamed)\" {\ };\ ", // GEORGIAN - "xkb_keymap {\ + "xkb_keymap {\ xkb_keycodes \"(unnamed)\" {\ minimum = 8;\ maximum = 255;\ diff --git a/layout.mobintl.h b/layout.mobintl.h @@ -67,18 +67,19 @@ enum layout_id { }; static struct key keys_full[], keys_special[], keys_simple[], keys_simplegrid[], - keys_cyrillic[], keys_arabic[], keys_georgian[], keys_emoji[], keys_nav[], keys_landscape[], - keys_compose_a[], keys_compose_e[], keys_compose_y[], keys_compose_u[], - keys_compose_i[], keys_compose_o[], keys_compose_w[], keys_compose_r[], - keys_compose_t[], keys_compose_p[], keys_compose_s[], keys_compose_d[], - keys_compose_f[], keys_compose_g[], keys_compose_h[], keys_compose_j[], - keys_compose_k[], keys_compose_l[], keys_compose_z[], keys_compose_x[], - keys_compose_c[], keys_compose_v[], keys_compose_b[], keys_compose_n[], - keys_compose_m[], keys_compose_math[], keys_compose_punctuation[], - keys_compose_bracket[], keys_compose_cyr_i[], keys_compose_cyr_j[], - keys_compose_cyr_e[], keys_compose_cyr_u[], keys_compose_cyr_l[], - keys_compose_cyr_n[], keys_compose_cyr_tse[], keys_compose_cyr_che[], - keys_compose_cyr_g[], keys_compose_cyr_k[], keys_dialer[]; + keys_cyrillic[], keys_arabic[], keys_georgian[], keys_emoji[], keys_nav[], + keys_landscape[], keys_compose_a[], keys_compose_e[], keys_compose_y[], + keys_compose_u[], keys_compose_i[], keys_compose_o[], keys_compose_w[], + keys_compose_r[], keys_compose_t[], keys_compose_p[], keys_compose_s[], + keys_compose_d[], keys_compose_f[], keys_compose_g[], keys_compose_h[], + keys_compose_j[], keys_compose_k[], keys_compose_l[], keys_compose_z[], + keys_compose_x[], keys_compose_c[], keys_compose_v[], keys_compose_b[], + keys_compose_n[], keys_compose_m[], keys_compose_math[], + keys_compose_punctuation[], keys_compose_bracket[], keys_compose_cyr_i[], + keys_compose_cyr_j[], keys_compose_cyr_e[], keys_compose_cyr_u[], + keys_compose_cyr_l[], keys_compose_cyr_n[], keys_compose_cyr_tse[], + keys_compose_cyr_che[], keys_compose_cyr_g[], keys_compose_cyr_k[], + keys_dialer[]; static struct layout layouts[NumLayouts] = { [Full] = {keys_full, "latin", "full"}, // second parameter is the keymap name diff --git 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);