commit c6ca5832d4330a14baef85765233008bfb2e3e22
parent 879522a76ef03586e53e0f9161255b25eaf33798
Author: Maarten van Gompel <proycon@anaproy.nl>
Date: Tue, 24 Aug 2021 00:43:01 +0200
Also release shift after key release
Diffstat:
M | keyboard.h | | | 9 | +++++++-- |
M | layout.mobile.h | | | 86 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
2 files changed, 50 insertions(+), 45 deletions(-)
diff --git a/keyboard.h b/keyboard.h
@@ -57,8 +57,8 @@ struct key {
struct layout {
struct key *keys;
- uint32_t keyheight; //absolute height (pixels)
const char * keymap_name;
+ uint32_t keyheight; //absolute height (pixels)
};
struct kbd {
@@ -167,14 +167,19 @@ kbd_unpress_key(struct kbd *kb, uint32_t time) {
}
kb->last_press = NULL;
+
if (compose >= 2) {
compose = 0;
if ((!kb->prevlayout) || (strcmp(kb->prevlayout->keymap_name, kb->layout->keymap_name) != 0)) {
create_and_upload_keymap(kb->layout->keymap_name, 0, 0);
}
kb->layout = kb->prevlayout;
+ if (kb->mods & Shift == Shift) kb->mods ^= Shift;
+ kbd_draw_layout(kb);
+ } else if (kb->mods & Shift == Shift) {
+ kb->mods ^= Shift;
kbd_draw_layout(kb);
- }
+ }
}
}
diff --git a/layout.mobile.h b/layout.mobile.h
@@ -106,49 +106,49 @@ static struct key keys_full[], keys_special[], keys_simple[], keys_cyrillic[],
keys_compose_cyr_k[];
static struct layout layouts[NumLayouts] = {
- [Full] = {keys_full, 0, "latin"}, //third parameter is the keymap name
- [Special] = {keys_special, 0, "latin"},
- [Simple] = {keys_simple, 0, "latin"},
- [Cyrillic] = {keys_cyrillic,0, "cyrillic"},
- [ComposeA] = {keys_compose_a, 0, "latin"},
- [ComposeE] = {keys_compose_e, 0, "latin"},
- [ComposeY] = {keys_compose_y, 0, "latin"},
- [ComposeU] = {keys_compose_u, 0, "latin"},
- [ComposeI] = {keys_compose_i, 0, "latin"},
- [ComposeO] = {keys_compose_o, 0, "latin"},
- [ComposeQ] = {keys_compose_q, 0, "latin"},
- [ComposeW] = {keys_compose_w, 0, "latin"},
- [ComposeR] = {keys_compose_r, 0, "latin"},
- [ComposeT] = {keys_compose_t, 0, "latin"},
- [ComposeP] = {keys_compose_p, 0, "latin"},
- [ComposeS] = {keys_compose_s, 0, "latin"},
- [ComposeD] = {keys_compose_d, 0, "latin"},
- [ComposeF] = {keys_compose_f, 0, "latin"},
- [ComposeG] = {keys_compose_g, 0, "latin"},
- [ComposeH] = {keys_compose_h, 0, "latin"},
- [ComposeJ] = {keys_compose_j, 0, "latin"},
- [ComposeK] = {keys_compose_k, 0, "latin"},
- [ComposeL] = {keys_compose_l, 0, "latin"},
- [ComposeZ] = {keys_compose_z, 0, "latin"},
- [ComposeX] = {keys_compose_x, 0, "latin"},
- [ComposeC] = {keys_compose_c, 0, "latin"},
- [ComposeV] = {keys_compose_v, 0, "latin"},
- [ComposeB] = {keys_compose_b, 0, "latin"},
- [ComposeN] = {keys_compose_n, 0, "latin"},
- [ComposeM] = {keys_compose_m, 0, "latin"},
- [ComposeMath] = {keys_compose_math, 0, "latin"},
- [ComposePunctuation] = {keys_compose_punctuation, 0, "latin"},
- [ComposeBracket] = {keys_compose_bracket, 0, "latin"},
- [ComposeCyrI] = {keys_compose_cyr_i, 0, "cyrillic"},
- [ComposeCyrJ] = {keys_compose_cyr_j, 0, "cyrillic"},
- [ComposeCyrE] = {keys_compose_cyr_e, 0, "cyrillic"},
- [ComposeCyrU] = {keys_compose_cyr_u, 0, "cyrillic"},
- [ComposeCyrL] = {keys_compose_cyr_l, 0, "cyrillic"},
- [ComposeCyrN] = {keys_compose_cyr_n, 0, "cyrillic"},
- [ComposeCyrTse] = {keys_compose_cyr_tse, 0, "cyrillic"},
- [ComposeCyrChe] = {keys_compose_cyr_che, 0, "cyrillic"},
- [ComposeCyrG] = {keys_compose_cyr_g, 0, "cyrillic"},
- [ComposeCyrK] = {keys_compose_cyr_k, 0, "cyrillic"},
+ [Full] = {keys_full, "latin"}, //third parameter is the keymap name
+ [Special] = {keys_special, "latin"},
+ [Simple] = {keys_simple, "latin"},
+ [Cyrillic] = {keys_cyrillic, "cyrillic"},
+ [ComposeA] = {keys_compose_a, "latin"},
+ [ComposeE] = {keys_compose_e, "latin"},
+ [ComposeY] = {keys_compose_y, "latin"},
+ [ComposeU] = {keys_compose_u, "latin"},
+ [ComposeI] = {keys_compose_i, "latin"},
+ [ComposeO] = {keys_compose_o, "latin"},
+ [ComposeQ] = {keys_compose_q, "latin"},
+ [ComposeW] = {keys_compose_w, "latin"},
+ [ComposeR] = {keys_compose_r, "latin"},
+ [ComposeT] = {keys_compose_t, "latin"},
+ [ComposeP] = {keys_compose_p, "latin"},
+ [ComposeS] = {keys_compose_s, "latin"},
+ [ComposeD] = {keys_compose_d, "latin"},
+ [ComposeF] = {keys_compose_f, "latin"},
+ [ComposeG] = {keys_compose_g, "latin"},
+ [ComposeH] = {keys_compose_h, "latin"},
+ [ComposeJ] = {keys_compose_j, "latin"},
+ [ComposeK] = {keys_compose_k, "latin"},
+ [ComposeL] = {keys_compose_l, "latin"},
+ [ComposeZ] = {keys_compose_z, "latin"},
+ [ComposeX] = {keys_compose_x, "latin"},
+ [ComposeC] = {keys_compose_c, "latin"},
+ [ComposeV] = {keys_compose_v, "latin"},
+ [ComposeB] = {keys_compose_b, "latin"},
+ [ComposeN] = {keys_compose_n, "latin"},
+ [ComposeM] = {keys_compose_m, "latin"},
+ [ComposeMath] = {keys_compose_math, "latin"},
+ [ComposePunctuation] = {keys_compose_punctuation, "latin"},
+ [ComposeBracket] = {keys_compose_bracket, "latin"},
+ [ComposeCyrI] = {keys_compose_cyr_i, "cyrillic"},
+ [ComposeCyrJ] = {keys_compose_cyr_j, "cyrillic"},
+ [ComposeCyrE] = {keys_compose_cyr_e, "cyrillic"},
+ [ComposeCyrU] = {keys_compose_cyr_u, "cyrillic"},
+ [ComposeCyrL] = {keys_compose_cyr_l, "cyrillic"},
+ [ComposeCyrN] = {keys_compose_cyr_n, "cyrillic"},
+ [ComposeCyrTse] = {keys_compose_cyr_tse, "cyrillic"},
+ [ComposeCyrChe] = {keys_compose_cyr_che, "cyrillic"},
+ [ComposeCyrG] = {keys_compose_cyr_g, "cyrillic"},
+ [ComposeCyrK] = {keys_compose_cyr_k, "cyrillic"},
};
const enum layout_names DefaultLayout = Full;