aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-01-08 09:48:24 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-01-08 09:48:24 -0500
commite2d49afb4a9cf1c333cbb1e18360026508b79a60 (patch)
tree37391772505203dd0ac0b533e89359b0d5d6e040 /common/util.c
parentMerge pull request #439 from mikkeloscar/bindsym-release (diff)
parentMake IPC binding event support a compile time opt. (diff)
downloadsway-e2d49afb4a9cf1c333cbb1e18360026508b79a60.tar.gz
sway-e2d49afb4a9cf1c333cbb1e18360026508b79a60.tar.zst
sway-e2d49afb4a9cf1c333cbb1e18360026508b79a60.zip
Merge pull request #438 from mikkeloscar/binding-event
Implement IPC binding event (keyboard)
Diffstat (limited to 'common/util.c')
-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) {
51 51
52 return NULL; 52 return NULL;
53} 53}
54
55int get_modifier_names(const char **names, uint32_t modifier_masks) {
56 int length = 0;
57 int i;
58 for (i = 0; i < (int)(sizeof(modifiers) / sizeof(struct modifier_key)); ++i) {
59 if ((modifier_masks & modifiers[i].mod) != 0) {
60 names[length] = modifiers[i].name;
61 ++length;
62 modifier_masks ^= modifiers[i].mod;
63 }
64 }
65
66 return length;
67}