diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-04 11:00:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-04 11:00:12 -0400 |
commit | 309fcf23007a7c1b5c1c6da6b5ff7101312488cc (patch) | |
tree | 9e581c403ef8b99df78bddb7e54be856ada4514e /sway/commands | |
parent | 6dd3e0caf574ab9c328025489d3ea605fcdd7fc8 (diff) | |
parent | 7797490e9e285589f501e46202df36b6bf8afcfd (diff) | |
download | sway-309fcf23007a7c1b5c1c6da6b5ff7101312488cc.tar.xz |
Merge pull request #2569 from RyanDwyer/deny-reload-repeat
Deny repeating reload by holding key
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/bind.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c index b134c92f..5b56ba30 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -214,6 +214,9 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, } binding->command = join_args(argv + 1, argc - 1); + if (strcasestr(binding->command, "reload")) { + binding->flags |= BINDING_RELOAD; + } list_t *split = split_string(argv[0], "+"); for (int i = 0; i < split->length; ++i) { @@ -307,11 +310,9 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) binding->command); struct sway_binding *binding_copy = binding; - bool reload = false; // if this is a reload command we need to make a duplicate of the // binding since it will be gone after the reload has completed. - if (strcasestr(binding->command, "reload")) { - reload = true; + if (binding->flags & BINDING_RELOAD) { binding_copy = sway_binding_dup(binding); if (!binding_copy) { wlr_log(WLR_ERROR, "Failed to duplicate binding during reload"); @@ -328,7 +329,7 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) binding->command, results->error); } - if (reload) { // free the binding if we made a copy + if (binding->flags & BINDING_RELOAD) { // free the binding if we made a copy free_sway_binding(binding_copy); } free_cmd_results(results); |