diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-12-06 10:04:43 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-12-06 10:04:43 +0000 |
commit | 7dc18f68e3dd016d381bef43b943c0c482057e57 (patch) | |
tree | 39e3ad8d1ff8dbebde3188ac8541a53b01a5ddbc /window-scroll.c | |
parent | 103748d6adfe1b2d706cb0a1e1a128be5366d655 (diff) |
set/reset mode window functions.
Diffstat (limited to 'window-scroll.c')
-rw-r--r-- | window-scroll.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/window-scroll.c b/window-scroll.c index 60d3d9cd..dee8d094 100644 --- a/window-scroll.c +++ b/window-scroll.c @@ -1,4 +1,4 @@ -/* $Id: window-scroll.c,v 1.15 2007-12-06 09:46:23 nicm Exp $ */ +/* $Id: window-scroll.c,v 1.16 2007-12-06 10:04:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -22,7 +22,7 @@ #include "tmux.h" -void window_scroll_init(struct window *); +struct screen *window_scroll_init(struct window *); void window_scroll_free(struct window *); void window_scroll_resize(struct window *, u_int, u_int); void window_scroll_key(struct window *, int); @@ -52,7 +52,7 @@ struct window_scroll_mode_data { u_int oy; }; -void +struct screen * window_scroll_init(struct window *w) { struct window_scroll_mode_data *data; @@ -67,12 +67,13 @@ window_scroll_init(struct window *w) s = &data->screen; screen_create(s, screen_size_x(&w->base), screen_size_y(&w->base)); s->mode = 0; - w->screen = s; screen_write_start(&ctx, s, NULL, NULL); for (i = 0; i < screen_size_y(s); i++) window_scroll_write_line(w, &ctx, i); screen_write_stop(&ctx); + + return (s); } void @@ -80,11 +81,8 @@ window_scroll_free(struct window *w) { struct window_scroll_mode_data *data = w->modedata; - w->screen = &w->base; screen_destroy(&data->screen); - - w->mode = NULL; - xfree(w->modedata); + xfree(data); } void @@ -107,8 +105,7 @@ window_scroll_key(struct window *w, int key) switch (key) { case 'Q': case 'q': - window_scroll_free(w); - server_redraw_window(w); + window_reset_mode(w); break; case 'h': case KEYC_LEFT: |