diff options
author | Tiago Cunha <tcunha@gmx.com> | 2012-07-11 19:37:32 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2012-07-11 19:37:32 +0000 |
commit | 1f5e6e35d5046693f0ef5ec76535f517757b7122 (patch) | |
tree | e53808c90f3a53279554f8580d2b96df606baec3 /cmd-select-layout.c | |
parent | a432fcd30617610b46d65f49b7513bf5da5694de (diff) |
Sync OpenBSD patchset 1151:
Make command exec functions return an enum rather than -1/0/1 values and
add a new value to mean "leave client running but don't attach" to fix
problems with using some commands in a command sequence. Most of the
work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
Diffstat (limited to 'cmd-select-layout.c')
-rw-r--r-- | cmd-select-layout.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cmd-select-layout.c b/cmd-select-layout.c index fe728980..5b234abf 100644 --- a/cmd-select-layout.c +++ b/cmd-select-layout.c @@ -24,8 +24,8 @@ * Switch window to selected layout. */ -void cmd_select_layout_key_binding(struct cmd *, int); -int cmd_select_layout_exec(struct cmd *, struct cmd_ctx *); +void cmd_select_layout_key_binding(struct cmd *, int); +enum cmd_retval cmd_select_layout_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_select_layout_entry = { "select-layout", "selectl", @@ -90,7 +90,7 @@ cmd_select_layout_key_binding(struct cmd *self, int key) } } -int +enum cmd_retval cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; @@ -100,7 +100,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) int next, previous, layout; if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) - return (-1); + return (CMD_RETURN_ERROR); w = wl->window; next = self->entry == &cmd_next_layout_entry; @@ -114,13 +114,13 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(self->args, 'U')) { if ((layoutname = layout_list_redo(w)) == NULL) { ctx->info(ctx, "no more layout history"); - return (-1); + return (CMD_RETURN_ERROR); } goto set_layout; } else if (args_has(self->args, 'u')) { if ((layoutname = layout_list_undo(w)) == NULL) { ctx->info(ctx, "no more layout history"); - return (-1); + return (CMD_RETURN_ERROR); } goto set_layout; } @@ -132,7 +132,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) layout = layout_set_previous(wl->window); server_redraw_window(wl->window); ctx->info(ctx, "arranging in: %s", layout_set_name(layout)); - return (0); + return (CMD_RETURN_NORMAL); } if (args->argc == 0) @@ -143,19 +143,19 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) layout = layout_set_select(wl->window, layout); server_redraw_window(wl->window); ctx->info(ctx, "arranging in: %s", layout_set_name(layout)); - return (0); + return (CMD_RETURN_NORMAL); } if (args->argc == 0) - return (0); + return (CMD_RETURN_NORMAL); layoutname = args->argv[0]; set_layout: if (layout_parse(wl->window, layoutname) == -1) { ctx->error(ctx, "can't set layout: %s", layoutname); - return (-1); + return (CMD_RETURN_ERROR); } server_redraw_window(wl->window); ctx->info(ctx, "arranging in: %s", layoutname); - return (0); + return (CMD_RETURN_NORMAL); } |