aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-06 13:16:54 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-09 11:29:04 -0500
commiteefa6b1ad3f7e6fcbcf52595a833ae28364c18ea (patch)
treeb65eda998dbfc67d338253516441ad227c38cb1e /sway/ipc-server.c
parentAdd helpers for improved mouse button parsing (diff)
downloadsway-eefa6b1ad3f7e6fcbcf52595a833ae28364c18ea.tar.gz
sway-eefa6b1ad3f7e6fcbcf52595a833ae28364c18ea.tar.zst
sway-eefa6b1ad3f7e6fcbcf52595a833ae28364c18ea.zip
bind{code,sym}: utilize mouse button helpers
This modifies `bindcode` and `bindsym` to use `get_mouse_bindcode` and `get_mouse_bindsym`, respectively, to parse mouse buttons. Additionally, the `BINDING_MOUSE` type has been split into `BINDING_MOUSECODE` and `BINDING_MOUSESYM` to match keys and allow for mouse bindcodes to be used. Between the two commands, all button syms and codes should be supported, including x11 axis buttons.
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 456db866..ff1bc89f 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -445,8 +445,12 @@ void ipc_event_binding(struct sway_binding *binding) {
445 json_object_object_add(json_binding, "input_code", json_object_new_int(input_code)); 445 json_object_object_add(json_binding, "input_code", json_object_new_int(input_code));
446 json_object_object_add(json_binding, "symbols", symbols); 446 json_object_object_add(json_binding, "symbols", symbols);
447 json_object_object_add(json_binding, "symbol", symbol); 447 json_object_object_add(json_binding, "symbol", symbol);
448 json_object_object_add(json_binding, "input_type", binding->type == BINDING_MOUSE ? 448
449 json_object_new_string("mouse") : json_object_new_string("keyboard")); 449 bool mouse = binding->type == BINDING_MOUSECODE ||
450 binding->type == BINDING_MOUSESYM;
451 json_object_object_add(json_binding, "input_type", mouse
452 ? json_object_new_string("mouse")
453 : json_object_new_string("keyboard"));
450 454
451 json_object *json = json_object_new_object(); 455 json_object *json = json_object_new_object();
452 json_object_object_add(json, "change", json_object_new_string("run")); 456 json_object_object_add(json, "change", json_object_new_string("run"));