diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-04-01 16:12:02 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2012-04-01 16:12:02 +0200 |
commit | 9c2b83805435b3219e8e0f4d102c8ec25220ec13 (patch) | |
tree | ea39704e725c234951542ab59cbdd0a60e828b44 | |
parent | 4897b4ce68fc5681e400821dd27552a44882920f (diff) |
console: remove mtop cache
We can directly access the buffer now so no need to cache the value.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
-rw-r--r-- | src/console.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/console.c b/src/console.c index fd2cdc0..d709be5 100644 --- a/src/console.c +++ b/src/console.c @@ -104,7 +104,6 @@ struct kmscon_console { /* console cells */ struct kmscon_buffer *cells; - unsigned int margin_top; /* idx of first scroll line */ unsigned int margin_bottom; /* idx of last scroll line */ bool rel_addr; /* is relative addressing used? */ bool auto_wrap; /* auto wrap on end of line? */ @@ -723,14 +722,6 @@ static int kmscon_buffer_set_margins(struct kmscon_buffer *buf, } } -static unsigned int kmscon_buffer_get_mtop(struct kmscon_buffer *buf) -{ - if (!buf) - return 0; - - return buf->mtop_y; -} - static unsigned int kmscon_buffer_get_mbottom(struct kmscon_buffer *buf) { if (!buf) @@ -1006,7 +997,7 @@ static inline unsigned int to_abs_y(struct kmscon_console *con, unsigned int y) if (!con->rel_addr) return y; - return con->margin_top + y; + return con->cells->mtop_y + y; } int kmscon_console_new(struct kmscon_console **out, @@ -1032,7 +1023,6 @@ int kmscon_console_new(struct kmscon_console **out, if (ret) goto err_free; - con->margin_top = kmscon_buffer_get_mtop(con->cells); num = kmscon_buffer_get_mbottom(con->cells); con->margin_bottom = con->cells->size_y - 1 - num; @@ -1136,7 +1126,6 @@ int kmscon_console_resize(struct kmscon_console *con, unsigned int x, if (ret) return ret; - con->margin_top = kmscon_buffer_get_mtop(con->cells); num = kmscon_buffer_get_mbottom(con->cells); con->margin_bottom = con->cells->size_y - 1 - num; @@ -1254,12 +1243,12 @@ void kmscon_console_move_up(struct kmscon_console *con, unsigned int num, num = con->cells->size_y; if (con->rel_addr) { - diff = con->cursor_y - con->margin_top; + diff = con->cursor_y - con->cells->mtop_y; if (num > diff) { num -= diff; if (scroll) kmscon_buffer_scroll_down(con->cells, num); - con->cursor_y = con->margin_top; + con->cursor_y = con->cells->mtop_y; } else { con->cursor_y -= num; } |