diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-02-17 20:33:37 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-02-18 15:11:48 -0500 |
commit | a1b9aa11d12a5b0a2a521d6b9b89d487be2eedd3 (patch) | |
tree | 1c48e91df9a0cbc0b8459685a0c592441f2960c4 /sway/commands/bind.c | |
parent | seat_cmd_cursor: fix typo in expected syntax (diff) | |
download | sway-a1b9aa11d12a5b0a2a521d6b9b89d487be2eedd3.tar.gz sway-a1b9aa11d12a5b0a2a521d6b9b89d487be2eedd3.tar.zst sway-a1b9aa11d12a5b0a2a521d6b9b89d487be2eedd3.zip |
Use container under cursor for mouse bindings1.0-rc3
This matches i3's behavior of executing mouse bindings in regards to the
container under the cursor instead of what is focused.
Diffstat (limited to 'sway/commands/bind.c')
-rw-r--r-- | sway/commands/bind.c | 20 |
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) { | |||
330 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) { | 331 | void 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]; |