aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bind.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/bind.c')
-rw-r--r--sway/commands/bind.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 59116d67..172e6b8a 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -1,10 +1,11 @@
1#define _POSIX_C_SOURCE 200809L 1#define _POSIX_C_SOURCE 200809L
2#include <libevdev/libevdev.h> 2#include <libevdev/libevdev.h>
3#include <linux/input-event-codes.h> 3#include <linux/input-event-codes.h>
4#include <xkbcommon/xkbcommon.h>
5#include <xkbcommon/xkbcommon-names.h>
6#include <string.h> 4#include <string.h>
7#include <strings.h> 5#include <strings.h>
6#include <xkbcommon/xkbcommon.h>
7#include <xkbcommon/xkbcommon-names.h>
8#include <wlr/types/wlr_cursor.h>
8#include "sway/commands.h" 9#include "sway/commands.h"
9#include "sway/config.h" 10#include "sway/config.h"
10#include "sway/input/cursor.h" 11#include "sway/input/cursor.h"
@@ -330,7 +331,20 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
330void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) { 331void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) {
331 sway_log(SWAY_DEBUG, "running command for binding: %s", binding->command); 332 sway_log(SWAY_DEBUG, "running command for binding: %s", binding->command);
332 333
333 list_t *res_list = execute_command(binding->command, seat, NULL); 334 struct sway_container *con = NULL;
335 if (binding->type == BINDING_MOUSESYM
336 || binding->type == BINDING_MOUSECODE) {
337 struct wlr_surface *surface = NULL;
338 double sx, sy;
339 struct sway_node *node = node_at_coords(seat,
340 seat->cursor->cursor->x, seat->cursor->cursor->y,
341 &surface, &sx, &sy);
342 if (node && node->type == N_CONTAINER) {
343 con = node->sway_container;
344 }
345 }
346
347 list_t *res_list = execute_command(binding->command, seat, con);
334 bool success = true; 348 bool success = true;
335 for (int i = 0; i < res_list->length; ++i) { 349 for (int i = 0; i < res_list->length; ++i) {
336 struct cmd_results *results = res_list->items[i]; 350 struct cmd_results *results = res_list->items[i];