diff options
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r-- | sway/ipc-server.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index da3d52e3..a6598b84 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "commands.h" | 19 | #include "commands.h" |
20 | #include "list.h" | 20 | #include "list.h" |
21 | #include "stringop.h" | 21 | #include "stringop.h" |
22 | #include "util.h" | ||
22 | 23 | ||
23 | static int ipc_socket = -1; | 24 | static int ipc_socket = -1; |
24 | static struct wlc_event_source *ipc_event_source = NULL; | 25 | static struct wlc_event_source *ipc_event_source = NULL; |
@@ -35,22 +36,6 @@ struct ipc_client { | |||
35 | enum ipc_command_type subscribed_events; | 36 | enum ipc_command_type subscribed_events; |
36 | }; | 37 | }; |
37 | 38 | ||
38 | static struct modifier_key { | ||
39 | char *name; | ||
40 | uint32_t mod; | ||
41 | } modifiers[] = { | ||
42 | { XKB_MOD_NAME_SHIFT, WLC_BIT_MOD_SHIFT }, | ||
43 | { XKB_MOD_NAME_CAPS, WLC_BIT_MOD_CAPS }, | ||
44 | { XKB_MOD_NAME_CTRL, WLC_BIT_MOD_CTRL }, | ||
45 | { "Ctrl", WLC_BIT_MOD_CTRL }, | ||
46 | { XKB_MOD_NAME_ALT, WLC_BIT_MOD_ALT }, | ||
47 | { "Alt", WLC_BIT_MOD_ALT }, | ||
48 | { XKB_MOD_NAME_NUM, WLC_BIT_MOD_MOD2 }, | ||
49 | { "Mod3", WLC_BIT_MOD_MOD3 }, | ||
50 | { XKB_MOD_NAME_LOGO, WLC_BIT_MOD_LOGO }, | ||
51 | { "Mod5", WLC_BIT_MOD_MOD5 }, | ||
52 | }; | ||
53 | |||
54 | struct sockaddr_un *ipc_user_sockaddr(void); | 39 | struct sockaddr_un *ipc_user_sockaddr(void); |
55 | int ipc_handle_connection(int fd, uint32_t mask, void *data); | 40 | int ipc_handle_connection(int fd, uint32_t mask, void *data); |
56 | int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data); | 41 | int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data); |
@@ -640,15 +625,7 @@ void ipc_event_modifier(uint32_t modifier, const char *state) { | |||
640 | json_object *obj = json_object_new_object(); | 625 | json_object *obj = json_object_new_object(); |
641 | json_object_object_add(obj, "change", json_object_new_string(state)); | 626 | json_object_object_add(obj, "change", json_object_new_string(state)); |
642 | 627 | ||
643 | const char *modifier_name = NULL; | 628 | const char *modifier_name = get_modifier_name_by_mask(modifier); |
644 | int i; | ||
645 | for (i = 0; i < (int)(sizeof(modifiers) / sizeof(struct modifier_key)); ++i) { | ||
646 | if (modifiers[i].mod == modifier) { | ||
647 | modifier_name = modifiers[i].name; | ||
648 | break; | ||
649 | } | ||
650 | } | ||
651 | |||
652 | json_object_object_add(obj, "modifier", json_object_new_string(modifier_name)); | 629 | json_object_object_add(obj, "modifier", json_object_new_string(modifier_name)); |
653 | 630 | ||
654 | const char *json_string = json_object_to_json_string(obj); | 631 | const char *json_string = json_object_to_json_string(obj); |