diff options
author | frsfnrrg <frsfnrrg@users.noreply.github.com> | 2018-07-23 21:38:29 -0400 |
---|---|---|
committer | frsfnrrg <frsfnrrg@users.noreply.github.com> | 2018-07-23 21:38:29 -0400 |
commit | 94dd8823a0081f7983dce368d5d093d1d3eeaefe (patch) | |
tree | f2147f1ef4871edb4d989d26cd9b1104797d27bc /sway/commands/bind.c | |
parent | Parse mouse binding options (diff) | |
download | sway-94dd8823a0081f7983dce368d5d093d1d3eeaefe.tar.gz sway-94dd8823a0081f7983dce368d5d093d1d3eeaefe.tar.zst sway-94dd8823a0081f7983dce368d5d093d1d3eeaefe.zip |
Invoke mouse bindings
The mouse binding logic is inspired/copied from the
keyboard binding logic; we store a sorted list of the
currently pressed buttons, and trigger a binding when
the currently pressed (or just recently pressed, in
the case of a release binding) buttons, as well as
modifiers/container region, match those of a given
binding.
As the code to execute a binding is not very keyboard
specific, keyboard_execute_command is renamed to
seat_execute_command and moved to where the other
binding handling functions are. The call to
transaction_commit_dirty has been lifted out.
Diffstat (limited to 'sway/commands/bind.c')
-rw-r--r-- | sway/commands/bind.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 6910237f..133fd089 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c | |||
@@ -267,3 +267,19 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) { | |||
267 | struct cmd_results *cmd_bindcode(int argc, char **argv) { | 267 | struct cmd_results *cmd_bindcode(int argc, char **argv) { |
268 | return cmd_bindsym_or_bindcode(argc, argv, true); | 268 | return cmd_bindsym_or_bindcode(argc, argv, true); |
269 | } | 269 | } |
270 | |||
271 | |||
272 | /** | ||
273 | * Execute the command associated to a binding | ||
274 | */ | ||
275 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) { | ||
276 | wlr_log(WLR_DEBUG, "running command for binding: %s", | ||
277 | binding->command); | ||
278 | config->handler_context.seat = seat; | ||
279 | struct cmd_results *results = execute_command(binding->command, NULL); | ||
280 | if (results->status != CMD_SUCCESS) { | ||
281 | wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)", | ||
282 | binding->command, results->error); | ||
283 | } | ||
284 | free_cmd_results(results); | ||
285 | } | ||