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.
This commit is contained in:
Brian Ashworth 2019-01-06 13:16:54 -05:00
parent 6f6a9af60e
commit eefa6b1ad3
4 changed files with 86 additions and 57 deletions

View file

@ -445,8 +445,12 @@ void ipc_event_binding(struct sway_binding *binding) {
json_object_object_add(json_binding, "input_code", json_object_new_int(input_code));
json_object_object_add(json_binding, "symbols", symbols);
json_object_object_add(json_binding, "symbol", symbol);
json_object_object_add(json_binding, "input_type", binding->type == BINDING_MOUSE ?
json_object_new_string("mouse") : json_object_new_string("keyboard"));
bool mouse = binding->type == BINDING_MOUSECODE ||
binding->type == BINDING_MOUSESYM;
json_object_object_add(json_binding, "input_type", mouse
? json_object_new_string("mouse")
: json_object_new_string("keyboard"));
json_object *json = json_object_new_object();
json_object_object_add(json, "change", json_object_new_string("run"));