aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bind.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-12-08 23:55:14 +0000
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-12-09 01:15:38 +0000
commitc8776fac4232f9faab0a78ef3e18dc4366496421 (patch)
tree028fbc584d233a7a934feb0b6807c9a988c8e7f1 /sway/commands/bind.c
parentlist.c: Remove list_foreach (diff)
downloadsway-c8776fac4232f9faab0a78ef3e18dc4366496421.tar.gz
sway-c8776fac4232f9faab0a78ef3e18dc4366496421.tar.zst
sway-c8776fac4232f9faab0a78ef3e18dc4366496421.zip
Cleanup list code
Diffstat (limited to 'sway/commands/bind.c')
-rw-r--r--sway/commands/bind.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 52a245fa..886a262c 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -78,7 +78,6 @@ static int key_qsort_cmp(const void *keyp_a, const void *keyp_b) {
78 return (key_a < key_b) ? -1 : ((key_a > key_b) ? 1 : 0); 78 return (key_a < key_b) ? -1 : ((key_a > key_b) ? 1 : 0);
79} 79}
80 80
81
82/** 81/**
83 * From a keycode, bindcode, or bindsym name and the most likely binding type, 82 * From a keycode, bindcode, or bindsym name and the most likely binding type,
84 * identify the appropriate numeric value corresponding to the key. Return NULL 83 * identify the appropriate numeric value corresponding to the key. Return NULL
@@ -278,7 +277,6 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
278 wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'", 277 wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'",
279 bindtype, argv[0], binding->command, binding->input); 278 bindtype, argv[0], binding->command, binding->input);
280 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 279 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
281
282} 280}
283 281
284struct cmd_results *cmd_bindsym(int argc, char **argv) { 282struct cmd_results *cmd_bindsym(int argc, char **argv) {
@@ -289,7 +287,6 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
289 return cmd_bindsym_or_bindcode(argc, argv, true); 287 return cmd_bindsym_or_bindcode(argc, argv, true);
290} 288}
291 289
292
293/** 290/**
294 * Execute the command associated to a binding 291 * Execute the command associated to a binding
295 */ 292 */
@@ -299,15 +296,14 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding)
299 config->handler_context.seat = seat; 296 config->handler_context.seat = seat;
300 list_t *res_list = execute_command(binding->command, NULL, NULL); 297 list_t *res_list = execute_command(binding->command, NULL, NULL);
301 bool success = true; 298 bool success = true;
302 while (res_list->length) { 299 for (int i = 0; i < res_list->length; ++i) {
303 struct cmd_results *results = res_list->items[0]; 300 struct cmd_results *results = res_list->items[i];
304 if (results->status != CMD_SUCCESS) { 301 if (results->status != CMD_SUCCESS) {
305 wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)", 302 wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
306 binding->command, results->error); 303 binding->command, results->error);
307 success = false; 304 success = false;
308 } 305 }
309 free_cmd_results(results); 306 free_cmd_results(results);
310 list_del(res_list, 0);
311 } 307 }
312 list_free(res_list); 308 list_free(res_list);
313 if (success) { 309 if (success) {