diff options
-rw-r--r-- | cmd-resize-pane.c | 13 | ||||
-rw-r--r-- | layout.c | 11 | ||||
-rw-r--r-- | tmux.h | 4 |
3 files changed, 18 insertions, 10 deletions
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index 63b18dcb..ece4aa4e 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -1,4 +1,4 @@ -/* $Id: cmd-resize-pane.c,v 1.5 2009-05-18 21:01:38 nicm Exp $ */ +/* $Id: cmd-resize-pane.c,v 1.6 2009-05-18 21:16:09 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -92,10 +92,13 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_ctx *ctx) } } - if (data->flags & CMD_UPPERDFLAG) - layout_resize(wp, adjust); - else - layout_resize(wp, -adjust); + if (!(data->flags & CMD_UPPERDFLAG)) + adjust = -adjust; + if (layout_resize(wp, adjust) != 0) { + ctx->error(ctx, "layout %s " + "does not support resizing", layout_name(wp->window)); + return (-1); + } server_redraw_window(wl->window); return (0); @@ -1,4 +1,4 @@ -/* $Id: layout.c,v 1.9 2009-05-18 21:06:16 nicm Exp $ */ +/* $Id: layout.c,v 1.10 2009-05-18 21:16:09 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -109,10 +109,15 @@ layout_refresh(struct window *w, int active_only) server_redraw_window(w); } -void +int layout_resize(struct window_pane *wp, int adjust) { - layouts[wp->window->layout].resize(wp, adjust); + struct window *w = wp->window; + + if (layouts[w->layout].resize == NULL) + return (-1); + layouts[w->layout].resize(wp, adjust); + return (0); } void @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.320 2009-05-18 21:06:16 nicm Exp $ */ +/* $Id: tmux.h,v 1.321 2009-05-18 21:16:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1569,7 +1569,7 @@ void window_pane_mouse(struct window_pane *, const char * layout_name(struct window *); int layout_lookup(const char *); void layout_refresh(struct window *, int); -void layout_resize(struct window_pane *, int); +int layout_resize(struct window_pane *, int); int layout_select(struct window *, u_int); void layout_next(struct window *); void layout_previous(struct window *); |