diff options
author | Drew DeVault <[email protected]> | 2017-05-04 17:17:13 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2017-05-04 17:17:13 -0400 |
commit | 781fc604b4626249fa5be1c1629183bca23fe49c (patch) | |
tree | 9d157c846bb7081c657e683284ae7510a9db9ccb /sway/handlers.c | |
parent | 02d1ae7e27e1183abbf3d16acd87fcd5ec370e26 (diff) | |
parent | 400998d6d2bf311f3402faf092154ee8ceac2bf9 (diff) |
Merge pull request #1209 from janza/mouse-bindings
Add mouse button bindings
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index da765d6d..e1b90a07 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -917,6 +917,26 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w // Update view pointer is on pointer_state.view = container_under_pointer(); + struct sway_mode *mode = config->current_mode; + // handle bindings + for (int i = 0; i < mode->bindings->length; ++i) { + struct sway_binding *binding = mode->bindings->items[i]; + if ((modifiers->mods ^ binding->modifiers) == 0) { + switch (state) { + case WLC_BUTTON_STATE_PRESSED: { + if (!binding->release && handle_bindsym(binding, button, 0)) { + return EVENT_HANDLED; + } + } + case WLC_BUTTON_STATE_RELEASED: + if (binding->release && handle_bindsym(binding, button, 0)) { + return EVENT_HANDLED; + } + break; + } + } + } + // Update pointer_state switch (button) { case M_LEFT_CLICK: |