summaryrefslogtreecommitdiffstats
path: root/cmd-rotate-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-rotate-window.c')
-rw-r--r--cmd-rotate-window.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c
index fbfba099..1d752e74 100644
--- a/cmd-rotate-window.c
+++ b/cmd-rotate-window.c
@@ -24,47 +24,42 @@
* Rotate the panes in a window.
*/
-void cmd_rotate_window_init(struct cmd *, int);
+void cmd_rotate_window_key_binding(struct cmd *, int);
int cmd_rotate_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_rotate_window_entry = {
"rotate-window", "rotatew",
+ "Dt:U", 0, 0,
"[-DU] " CMD_TARGET_WINDOW_USAGE,
- 0, "DU",
- cmd_rotate_window_init,
- cmd_target_parse,
- cmd_rotate_window_exec,
- cmd_target_free,
- cmd_target_print
+ 0,
+ cmd_rotate_window_key_binding,
+ NULL,
+ cmd_rotate_window_exec
};
void
-cmd_rotate_window_init(struct cmd *self, int key)
+cmd_rotate_window_key_binding(struct cmd *self, int key)
{
- struct cmd_target_data *data;
-
- cmd_target_init(self, key);
- data = self->data;
-
+ self->args = args_create(0);
if (key == ('o' | KEYC_ESCAPE))
- cmd_set_flag(&data->chflags, 'D');
+ args_set(self->args, 'D', NULL);
}
int
cmd_rotate_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
- struct cmd_target_data *data = self->data;
+ struct args *args = self->args;
struct winlink *wl;
struct window *w;
struct window_pane *wp, *wp2;
struct layout_cell *lc;
u_int sx, sy, xoff, yoff;
- if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
return (-1);
w = wl->window;
- if (cmd_check_flag(data->chflags, 'D')) {
+ if (args_has(self->args, 'D')) {
wp = TAILQ_LAST(&w->panes, window_panes);
TAILQ_REMOVE(&w->panes, wp, entry);
TAILQ_INSERT_HEAD(&w->panes, wp, entry);