2 * kmscon - Console Management
4 * Copyright (c) 2011 David Herrmann <dh.herrmann@googlemail.com>
5 * Copyright (c) 2011 University of Tuebingen
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files
9 * (the "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 * The console management uses OpenGL, cairo and pango to draw a console to a
30 * framebuffer. It is independent of the other subsystems and can also be used
31 * in other applications.
33 * This console does not emulate any terminal at all. This subsystem just
34 * provides functions to draw a console to a framebuffer and modifying the state
44 struct kmscon_console;
46 /* single printable characters */
48 int kmscon_char_new(struct kmscon_char **out);
49 int kmscon_char_new_u8(struct kmscon_char **out, const char *str, size_t len);
50 int kmscon_char_dup(struct kmscon_char **out, const struct kmscon_char *orig);
51 void kmscon_char_free(struct kmscon_char *ch);
53 int kmscon_char_set(struct kmscon_char *ch, const struct kmscon_char *orig);
54 int kmscon_char_set_u8(struct kmscon_char *ch, const char *str, size_t len);
55 const char *kmscon_char_get_u8(const struct kmscon_char *ch);
56 size_t kmscon_char_get_len(const struct kmscon_char *ch);
57 int kmscon_char_append_u8(struct kmscon_char *ch, const char *str, size_t len);
59 /* font objects with cached glyphs */
61 int kmscon_font_new(struct kmscon_font **out, uint32_t height);
62 void kmscon_font_ref(struct kmscon_font *font);
63 void kmscon_font_unref(struct kmscon_font *font);
65 int kmscon_font_draw(struct kmscon_font *font, const struct kmscon_char *ch,
66 cairo_t *cr, uint32_t x, uint32_t y);
70 int kmscon_console_new(struct kmscon_console **out);
71 void kmscon_console_ref(struct kmscon_console *con);
72 void kmscon_console_unref(struct kmscon_console *con);
74 int kmscon_console_set_res(struct kmscon_console *con, uint32_t x, uint32_t y);
75 void kmscon_console_draw(struct kmscon_console *con);
76 void kmscon_console_map(struct kmscon_console *con);
78 int kmscon_console_resize(struct kmscon_console *con, uint32_t x, uint32_t y);
80 void kmscon_console_cursor_get(struct kmscon_console *con, uint32_t *x,
82 void kmscon_console_cursor_move(struct kmscon_console *con, int32_t x,
84 void kmscon_console_cursor_goto(struct kmscon_console *con, uint32_t x,
87 int kmscon_console_write(struct kmscon_console *con,
88 const struct kmscon_char *ch);