Stéphane Marchesin | ae37e6c | 2014-08-08 18:19:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 The Chromium OS Authors. All rights reserved. |
| 3 | * Use of this source code is governed by a BSD-style license that can be |
| 4 | * found in the LICENSE file. |
| 5 | */ |
| 6 | |
| 7 | #ifndef TERM_H |
| 8 | #define TERM_H |
| 9 | |
Dominik Behr | 83010f8 | 2016-03-18 18:43:08 -0700 | [diff] [blame] | 10 | #include "fb.h" |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 11 | #include "image.h" |
Stéphane Marchesin | ae37e6c | 2014-08-08 18:19:40 -0700 | [diff] [blame] | 12 | |
Stéphane Marchesin | 08c08e7 | 2016-01-07 16:44:08 -0800 | [diff] [blame] | 13 | #define MAX_STD_TERMINALS (3) |
| 14 | #define NUM_SPLASH_TERMINAL (1) |
| 15 | #define MAX_TERMINALS (MAX_STD_TERMINALS + NUM_SPLASH_TERMINAL) |
| 16 | #define SPLASH_TERMINAL (MAX_TERMINALS - 1) |
| 17 | |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 18 | typedef struct _terminal_t terminal_t; |
Dominik Behr | 83010f8 | 2016-03-18 18:43:08 -0700 | [diff] [blame] | 19 | terminal_t* term_init(bool interactive); |
David Sodman | bbcb052 | 2014-09-19 10:34:07 -0700 | [diff] [blame] | 20 | void term_close(terminal_t* terminal); |
David Sodman | bbcb052 | 2014-09-19 10:34:07 -0700 | [diff] [blame] | 21 | void term_close(terminal_t* terminal); |
David Sodman | bf3f284 | 2014-11-12 08:26:58 -0800 | [diff] [blame] | 22 | void term_key_event(terminal_t* terminal, uint32_t keysym, int32_t unicode); |
| 23 | bool term_is_child_done(terminal_t* terminal); |
| 24 | |
| 25 | void term_page_up(terminal_t* terminal); |
| 26 | void term_page_down(terminal_t* terminal); |
| 27 | void term_line_up(terminal_t* terminal); |
| 28 | void term_line_down(terminal_t* terminal); |
| 29 | |
| 30 | bool term_is_valid(terminal_t* terminal); |
| 31 | int term_fd(terminal_t* terminal); |
| 32 | void term_dispatch_io(terminal_t* terminal, fd_set* read_set); |
| 33 | bool term_exception(terminal_t*, fd_set* exception_set); |
| 34 | bool term_is_active(terminal_t*); |
David Sodman | 8ef2006 | 2015-01-06 09:23:40 -0800 | [diff] [blame] | 35 | void term_activate(terminal_t*); |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 36 | void term_deactivate(terminal_t* terminal); |
Dominik Behr | b1abcba | 2016-04-14 14:57:21 -0700 | [diff] [blame] | 37 | void term_add_fds(terminal_t* terminal, fd_set* read_set, fd_set* exception_set, int* maxfd); |
David Sodman | 8ef2006 | 2015-01-06 09:23:40 -0800 | [diff] [blame] | 38 | const char* term_get_ptsname(terminal_t* terminal); |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 39 | void term_set_background(terminal_t* term, uint32_t bg); |
| 40 | int term_show_image(terminal_t* terminal, image_t* image); |
| 41 | void term_write_message(terminal_t* terminal, char* message); |
Dominik Behr | 83010f8 | 2016-03-18 18:43:08 -0700 | [diff] [blame] | 42 | fb_t* term_getfb(terminal_t* terminal); |
Stéphane Marchesin | 08c08e7 | 2016-01-07 16:44:08 -0800 | [diff] [blame] | 43 | terminal_t* term_get_terminal(int num); |
| 44 | void term_set_terminal(int num, terminal_t* terminal); |
Stéphane Marchesin | 0a7ce42 | 2016-01-07 20:45:47 -0800 | [diff] [blame] | 45 | terminal_t* term_create_term(int vt); |
Dominik Behr | 83010f8 | 2016-03-18 18:43:08 -0700 | [diff] [blame] | 46 | terminal_t* term_create_splash_term(); |
Stéphane Marchesin | f75c851 | 2016-01-07 16:53:21 -0800 | [diff] [blame] | 47 | void term_destroy_splash_term(); |
Stéphane Marchesin | 92a297d | 2016-01-07 20:24:55 -0800 | [diff] [blame] | 48 | unsigned int term_get_max_terminals(); |
Dominik Behr | 4defb36 | 2016-01-13 12:36:14 -0800 | [diff] [blame] | 49 | void term_set_current(uint32_t t); |
| 50 | uint32_t term_get_current(void); |
| 51 | terminal_t *term_get_current_terminal(void); |
Dominik Behr | b1abcba | 2016-04-14 14:57:21 -0700 | [diff] [blame] | 52 | void term_set_current_terminal(terminal_t* terminal); |
Dominik Behr | 4defb36 | 2016-01-13 12:36:14 -0800 | [diff] [blame] | 53 | void term_set_current_to(terminal_t* terminal); |
Dominik Behr | 01a7a58 | 2016-01-28 17:02:21 -0800 | [diff] [blame] | 54 | void term_monitor_hotplug(void); |
Dominik Behr | b1abcba | 2016-04-14 14:57:21 -0700 | [diff] [blame] | 55 | void term_redrm(terminal_t* terminal); |
| 56 | void term_clear(terminal_t* terminal); |
Dominik Behr | 83864df | 2016-04-21 12:35:08 -0700 | [diff] [blame^] | 57 | void term_background(void); |
| 58 | void term_foreground(void); |
Stéphane Marchesin | ae37e6c | 2014-08-08 18:19:40 -0700 | [diff] [blame] | 59 | #endif |