version 1.8, 2012/10/15 21:53:30 |
version 1.9, 2013/03/24 09:54:10 |
|
|
* Swap one window with another. |
* Swap one window with another. |
*/ |
*/ |
|
|
enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmd_ctx *); |
enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmd_q *); |
|
|
const struct cmd_entry cmd_swap_window_entry = { |
const struct cmd_entry cmd_swap_window_entry = { |
"swap-window", "swapw", |
"swap-window", "swapw", |
|
|
}; |
}; |
|
|
enum cmd_retval |
enum cmd_retval |
cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_swap_window_exec(struct cmd *self, struct cmd_q *cmdq) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
const char *target_src, *target_dst; |
const char *target_src, *target_dst; |
|
|
struct window *w; |
struct window *w; |
|
|
target_src = args_get(args, 's'); |
target_src = args_get(args, 's'); |
if ((wl_src = cmd_find_window(ctx, target_src, &src)) == NULL) |
if ((wl_src = cmd_find_window(cmdq, target_src, &src)) == NULL) |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
target_dst = args_get(args, 't'); |
target_dst = args_get(args, 't'); |
if ((wl_dst = cmd_find_window(ctx, target_dst, &dst)) == NULL) |
if ((wl_dst = cmd_find_window(cmdq, target_dst, &dst)) == NULL) |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
|
|
sg_src = session_group_find(src); |
sg_src = session_group_find(src); |
sg_dst = session_group_find(dst); |
sg_dst = session_group_find(dst); |
if (src != dst && |
if (src != dst && |
sg_src != NULL && sg_dst != NULL && sg_src == sg_dst) { |
sg_src != NULL && sg_dst != NULL && sg_src == sg_dst) { |
ctx->error(ctx, "can't move window, sessions are grouped"); |
cmdq_error(cmdq, "can't move window, sessions are grouped"); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
|
|