Add kmscon_console_write() function
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 27 Nov 2011 18:31:26 +0000 (19:31 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 27 Nov 2011 18:31:26 +0000 (19:31 +0100)
This function can be used to change the content of the current cell. It
automatically moves the cursor to the next cell.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/console.c
src/console.h

index 40950b9..d3f4c31 100644 (file)
@@ -428,3 +428,23 @@ void kmscon_console_cursor_goto(struct kmscon_console *con, uint32_t x,
 
        con->cells_dirty = true;
 }
+
+int kmscon_console_write(struct kmscon_console *con,
+                                               const struct kmscon_char *ch)
+{
+       int ret;
+       uint32_t pos;
+
+       if (!con || !ch)
+               return -EINVAL;
+
+       pos = con->cursor_y * con->lines_x + con->cursor_x;
+       ret = kmscon_char_set(con->cells[pos].ch, ch);
+       if (ret)
+               return ret;
+
+       kmscon_console_cursor_move(con, 1, 0);
+       con->cells_dirty = true;
+
+       return 0;
+}
index db0cf0a..6982081 100644 (file)
@@ -61,3 +61,6 @@ void kmscon_console_cursor_move(struct kmscon_console *con, int32_t x,
                                                                int32_t y);
 void kmscon_console_cursor_goto(struct kmscon_console *con, uint32_t x,
                                                                uint32_t y);
+
+int kmscon_console_write(struct kmscon_console *con,
+                                               const struct kmscon_char *ch);