From 400998d6d2bf311f3402faf092154ee8ceac2bf9 Mon Sep 17 00:00:00 2001 From: Josip Janzic Date: Thu, 4 May 2017 22:42:50 +0200 Subject: Add mouse button bindings Adds support for bindings like: bindsym button3 floating toggle bindsym $mod+button3 floating toggle --- sway/handlers.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sway/handlers.c') 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: -- cgit v1.2.3 From d158e18308e91f0c4ae81ac86976b0540e5efd84 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 14 Jun 2017 18:09:05 -0400 Subject: Fix Firefox address bar thing And probably some other stuff too --- sway/handlers.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sway/handlers.c') diff --git a/sway/handlers.c b/sway/handlers.c index e1b90a07..a912b991 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -599,6 +599,8 @@ static void handle_view_geometry_request(wlc_handle handle, const struct wlc_geo view->y = geometry->origin.y; update_geometry(view); } + } else { + wlc_view_set_geometry(handle, 0, geometry); } } -- cgit v1.2.3