summaryrefslogtreecommitdiffstats
path: root/sway/handlers.c
diff options
context:
space:
mode:
authorLibravatar Josip Janzic <josip@jjanzic.com>2017-05-04 22:42:50 +0200
committerLibravatar Josip Janzic <josip@jjanzic.com>2017-05-04 23:00:03 +0200
commit400998d6d2bf311f3402faf092154ee8ceac2bf9 (patch)
tree9d157c846bb7081c657e683284ae7510a9db9ccb /sway/handlers.c
parentMerge pull request #1206 from zandrmartin/document-font-command (diff)
downloadsway-400998d6d2bf311f3402faf092154ee8ceac2bf9.tar.gz
sway-400998d6d2bf311f3402faf092154ee8ceac2bf9.tar.zst
sway-400998d6d2bf311f3402faf092154ee8ceac2bf9.zip
Add mouse button bindings
Adds support for bindings like: bindsym button3 floating toggle bindsym $mod+button3 floating toggle
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c20
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
917 // Update view pointer is on 917 // Update view pointer is on
918 pointer_state.view = container_under_pointer(); 918 pointer_state.view = container_under_pointer();
919 919
920 struct sway_mode *mode = config->current_mode;
921 // handle bindings
922 for (int i = 0; i < mode->bindings->length; ++i) {
923 struct sway_binding *binding = mode->bindings->items[i];
924 if ((modifiers->mods ^ binding->modifiers) == 0) {
925 switch (state) {
926 case WLC_BUTTON_STATE_PRESSED: {
927 if (!binding->release && handle_bindsym(binding, button, 0)) {
928 return EVENT_HANDLED;
929 }
930 }
931 case WLC_BUTTON_STATE_RELEASED:
932 if (binding->release && handle_bindsym(binding, button, 0)) {
933 return EVENT_HANDLED;
934 }
935 break;
936 }
937 }
938 }
939
920 // Update pointer_state 940 // Update pointer_state
921 switch (button) { 941 switch (button) {
922 case M_LEFT_CLICK: 942 case M_LEFT_CLICK: