diff options
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 4398f518..e370443c 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -391,8 +391,6 @@ static bool view_has_executed_criteria(struct sway_view *view, | |||
391 | } | 391 | } |
392 | 392 | ||
393 | void view_execute_criteria(struct sway_view *view) { | 393 | void view_execute_criteria(struct sway_view *view) { |
394 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
395 | struct sway_node *prior_focus = seat_get_focus(seat); | ||
396 | list_t *criterias = criteria_for_view(view, CT_COMMAND); | 394 | list_t *criterias = criteria_for_view(view, CT_COMMAND); |
397 | for (int i = 0; i < criterias->length; i++) { | 395 | for (int i = 0; i < criterias->length; i++) { |
398 | struct criteria *criteria = criterias->items[i]; | 396 | struct criteria *criteria = criterias->items[i]; |
@@ -403,16 +401,12 @@ void view_execute_criteria(struct sway_view *view) { | |||
403 | } | 401 | } |
404 | wlr_log(WLR_DEBUG, "for_window '%s' matches view %p, cmd: '%s'", | 402 | wlr_log(WLR_DEBUG, "for_window '%s' matches view %p, cmd: '%s'", |
405 | criteria->raw, view, criteria->cmdlist); | 403 | criteria->raw, view, criteria->cmdlist); |
406 | seat_set_focus_container(seat, view->container); | ||
407 | list_add(view->executed_criteria, criteria); | 404 | list_add(view->executed_criteria, criteria); |
408 | struct cmd_results *res = execute_command(criteria->cmdlist, NULL); | 405 | struct cmd_results *res = execute_command( |
409 | if (res->status != CMD_SUCCESS) { | 406 | criteria->cmdlist, NULL, view->container); |
410 | wlr_log(WLR_ERROR, "Command '%s' failed: %s", res->input, res->error); | ||
411 | } | ||
412 | free_cmd_results(res); | 407 | free_cmd_results(res); |
413 | } | 408 | } |
414 | list_free(criterias); | 409 | list_free(criterias); |
415 | seat_set_focus(seat, prior_focus); | ||
416 | } | 410 | } |
417 | 411 | ||
418 | static struct sway_workspace *select_workspace(struct sway_view *view) { | 412 | static struct sway_workspace *select_workspace(struct sway_view *view) { |
@@ -785,14 +779,9 @@ static size_t parse_title_format(struct sway_view *view, char *buffer) { | |||
785 | } | 779 | } |
786 | 780 | ||
787 | static char *escape_title(char *buffer) { | 781 | static char *escape_title(char *buffer) { |
788 | int length = escape_markup_text(buffer, NULL, 0); | 782 | size_t length = escape_markup_text(buffer, NULL); |
789 | char *escaped_title = calloc(length + 1, sizeof(char)); | 783 | char *escaped_title = calloc(length + 1, sizeof(char)); |
790 | int result = escape_markup_text(buffer, escaped_title, length); | 784 | escape_markup_text(buffer, escaped_title); |
791 | if (result != length) { | ||
792 | wlr_log(WLR_ERROR, "Could not escape title: %s", buffer); | ||
793 | free(escaped_title); | ||
794 | return buffer; | ||
795 | } | ||
796 | free(buffer); | 785 | free(buffer); |
797 | return escaped_title; | 786 | return escaped_title; |
798 | } | 787 | } |