diff options
author | Benji Dial <benji6283@gmail.com> | 2021-03-08 14:46:19 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-03-08 14:46:19 -0500 |
commit | 8221fd5451f094defa9866f98026b74a969f7693 (patch) | |
tree | 9f0e9595fd15bdecbe667f823deded7428547b44 /src/user/knob | |
parent | 1a5ece4f52ef17c7c868e95eb26e98137d5cab6f (diff) | |
download | portland-os-8221fd5451f094defa9866f98026b74a969f7693.tar.gz |
resizable widgets, default widget implementation for some functions, reimplementing meminfo in raleigh
Diffstat (limited to 'src/user/knob')
-rw-r--r-- | src/user/knob/key.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/user/knob/key.c b/src/user/knob/key.c index 1506f3b..b2e3f5e 100644 --- a/src/user/knob/key.c +++ b/src/user/knob/key.c @@ -1,4 +1,5 @@ #include <keypack.h> +#include <stdbool.h> static const char no_mod[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, '\t','\n', 0, 0, 0, 0, 0, @@ -48,7 +49,7 @@ static const char num[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '+', '\n', '-', '.', '/' }; -__attribute__ ((pure)) +__attribute__ ((const)) char key_to_char(struct key_packet kp) { if (kp.key_id < 0x80) { const char ch = (kp.modifiers & SHIFTS @@ -64,4 +65,13 @@ char key_to_char(struct key_packet kp) { else return 0; +} + +__attribute__ ((const)) +bool match_side_agnostic(struct key_packet a, struct key_packet b) { + return (a.key_id == b.key_id) && + ((bool)(a.modifiers & SHIFTS) == (bool)(b.modifiers & SHIFTS)) && + ((bool)(a.modifiers & CTRLS) == (bool)(b.modifiers & CTRLS)) && + ((bool)(a.modifiers & ALTS) == (bool)(b.modifiers & ALTS)) && + ((bool)(a.modifiers & WINS) == (bool)(b.modifiers & WINS)); }
\ No newline at end of file |