aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-01-08 09:48:24 -0500
committerDrew DeVault <sir@cmpwn.com>2016-01-08 09:48:24 -0500
commite2d49afb4a9cf1c333cbb1e18360026508b79a60 (patch)
tree37391772505203dd0ac0b533e89359b0d5d6e040 /common
parent320c2915b0aeb4bbecb753bf00091e24905c5652 (diff)
parent15cbc53a771f35e5510b643193c4ba99e9f820a2 (diff)
Merge pull request #438 from mikkeloscar/binding-event
Implement IPC binding event (keyboard)
Diffstat (limited to 'common')
-rw-r--r--common/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c
index b5037d35..243f90a8 100644
--- a/common/util.c
+++ b/common/util.c
@@ -51,3 +51,17 @@ const char *get_modifier_name_by_mask(uint32_t modifier) {
return NULL;
}
+
+int get_modifier_names(const char **names, uint32_t modifier_masks) {
+ int length = 0;
+ int i;
+ for (i = 0; i < (int)(sizeof(modifiers) / sizeof(struct modifier_key)); ++i) {
+ if ((modifier_masks & modifiers[i].mod) != 0) {
+ names[length] = modifiers[i].name;
+ ++length;
+ modifier_masks ^= modifiers[i].mod;
+ }
+ }
+
+ return length;
+}