Behave properly when resize not supported.

This commit is contained in:
Nicholas Marriott 2009-05-18 21:16:09 +00:00
parent b233616853
commit d601c42ea2
3 changed files with 18 additions and 10 deletions

View File

@ -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);

View File

@ -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

4
tmux.h
View File

@ -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 *);