From 8221fd5451f094defa9866f98026b74a969f7693 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 8 Mar 2021 14:46:19 -0500 Subject: resizable widgets, default widget implementation for some functions, reimplementing meminfo in raleigh --- src/user/knob/key.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/user/knob/key.c') 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 +#include 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 -- cgit v1.2.3