|
|
@ -23,9 +23,7 @@ void free_sway_binding(struct sway_binding *binding) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (binding->keys) {
|
|
|
|
list_free_items_and_destroy(binding->keys);
|
|
|
|
free_flat_list(binding->keys);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(binding->input);
|
|
|
|
free(binding->input);
|
|
|
|
free(binding->command);
|
|
|
|
free(binding->command);
|
|
|
|
free(binding);
|
|
|
|
free(binding);
|
|
|
@ -80,7 +78,6 @@ static int key_qsort_cmp(const void *keyp_a, const void *keyp_b) {
|
|
|
|
return (key_a < key_b) ? -1 : ((key_a > key_b) ? 1 : 0);
|
|
|
|
return (key_a < key_b) ? -1 : ((key_a > key_b) ? 1 : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* From a keycode, bindcode, or bindsym name and the most likely binding type,
|
|
|
|
* From a keycode, bindcode, or bindsym name and the most likely binding type,
|
|
|
|
* identify the appropriate numeric value corresponding to the key. Return NULL
|
|
|
|
* identify the appropriate numeric value corresponding to the key. Return NULL
|
|
|
@ -223,14 +220,14 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
|
|
|
uint32_t *key = calloc(1, sizeof(uint32_t));
|
|
|
|
uint32_t *key = calloc(1, sizeof(uint32_t));
|
|
|
|
if (!key) {
|
|
|
|
if (!key) {
|
|
|
|
free_sway_binding(binding);
|
|
|
|
free_sway_binding(binding);
|
|
|
|
free_flat_list(split);
|
|
|
|
list_free_items_and_destroy(split);
|
|
|
|
return cmd_results_new(CMD_FAILURE, bindtype,
|
|
|
|
return cmd_results_new(CMD_FAILURE, bindtype,
|
|
|
|
"Unable to allocate binding key");
|
|
|
|
"Unable to allocate binding key");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*key = key_val;
|
|
|
|
*key = key_val;
|
|
|
|
list_add(binding->keys, key);
|
|
|
|
list_add(binding->keys, key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free_flat_list(split);
|
|
|
|
list_free_items_and_destroy(split);
|
|
|
|
binding->order = binding_order++;
|
|
|
|
binding->order = binding_order++;
|
|
|
|
|
|
|
|
|
|
|
|
// refine region of interest for mouse binding once we are certain
|
|
|
|
// refine region of interest for mouse binding once we are certain
|
|
|
@ -280,7 +277,6 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
|
|
|
wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'",
|
|
|
|
wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'",
|
|
|
|
bindtype, argv[0], binding->command, binding->input);
|
|
|
|
bindtype, argv[0], binding->command, binding->input);
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct cmd_results *cmd_bindsym(int argc, char **argv) {
|
|
|
|
struct cmd_results *cmd_bindsym(int argc, char **argv) {
|
|
|
@ -291,7 +287,6 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
|
|
|
|
return cmd_bindsym_or_bindcode(argc, argv, true);
|
|
|
|
return cmd_bindsym_or_bindcode(argc, argv, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Execute the command associated to a binding
|
|
|
|
* Execute the command associated to a binding
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -301,15 +296,14 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding)
|
|
|
|
config->handler_context.seat = seat;
|
|
|
|
config->handler_context.seat = seat;
|
|
|
|
list_t *res_list = execute_command(binding->command, NULL, NULL);
|
|
|
|
list_t *res_list = execute_command(binding->command, NULL, NULL);
|
|
|
|
bool success = true;
|
|
|
|
bool success = true;
|
|
|
|
while (res_list->length) {
|
|
|
|
for (int i = 0; i < res_list->length; ++i) {
|
|
|
|
struct cmd_results *results = res_list->items[0];
|
|
|
|
struct cmd_results *results = res_list->items[i];
|
|
|
|
if (results->status != CMD_SUCCESS) {
|
|
|
|
if (results->status != CMD_SUCCESS) {
|
|
|
|
wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
|
|
|
|
wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
|
|
|
|
binding->command, results->error);
|
|
|
|
binding->command, results->error);
|
|
|
|
success = false;
|
|
|
|
success = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free_cmd_results(results);
|
|
|
|
free_cmd_results(results);
|
|
|
|
list_del(res_list, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
list_free(res_list);
|
|
|
|
list_free(res_list);
|
|
|
|
if (success) {
|
|
|
|
if (success) {
|
|
|
|