From cce9a5df15521f70930f258e141eb8f669566ea0 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 30 May 2012 17:54:31 +0200 Subject: [PATCH] console: allow setting/resetting flags Instead of writing a function for each mode we now accept flags for the console object. For now the flags are unused but other flags will be added. Signed-off-by: David Herrmann --- src/console.c | 17 +++++++++++++++++ src/console.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/console.c b/src/console.c index d21f2ff..cedb4fd 100644 --- a/src/console.c +++ b/src/console.c @@ -75,6 +75,7 @@ struct kmscon_buffer { * the sb seems to scroll-up while staying on the line */ bool fixed_position; + unsigned int flags; /* current cell/row count of the main screen */ unsigned int size_x; /* cell count */ @@ -1045,6 +1046,22 @@ void kmscon_console_reset(struct kmscon_console *con) /* TODO: reset console */ } +void kmscon_console_set_flags(struct kmscon_console *con, unsigned int flags) +{ + if (!con || !flags) + return; + + con->cells->flags |= flags; +} + +void kmscon_console_reset_flags(struct kmscon_console *con, unsigned int flags) +{ + if (!con || !flags) + return; + + con->cells->flags &= ~flags; +} + void kmscon_console_draw(struct kmscon_console *con, struct font_screen *fscr) { if (!con) diff --git a/src/console.h b/src/console.h index fe65eb9..ba4197a 100644 --- a/src/console.h +++ b/src/console.h @@ -56,6 +56,8 @@ unsigned int kmscon_console_get_height(struct kmscon_console *con); int kmscon_console_resize(struct kmscon_console *con, unsigned int x, unsigned int y, unsigned int height); void kmscon_console_reset(struct kmscon_console *con); +void kmscon_console_set_flags(struct kmscon_console *con, unsigned int flags); +void kmscon_console_reset_flags(struct kmscon_console *con, unsigned int flags); void kmscon_console_draw(struct kmscon_console *con, struct font_screen *fscr);