vt.h revision 270702
179455Sobrien/*- 279455Sobrien * Copyright (c) 2009, 2013 The FreeBSD Foundation 379455Sobrien * All rights reserved. 479455Sobrien * 579455Sobrien * This software was developed by Ed Schouten under sponsorship from the 679455Sobrien * FreeBSD Foundation. 779455Sobrien * 879455Sobrien * Portions of this software were developed by Oleksandr Rybalko 979455Sobrien * under sponsorship from the FreeBSD Foundation. 1079455Sobrien * 1179455Sobrien * Redistribution and use in source and binary forms, with or without 1279455Sobrien * modification, are permitted provided that the following conditions 1379455Sobrien * are met: 1479455Sobrien * 1. Redistributions of source code must retain the above copyright 1579455Sobrien * notice, this list of conditions and the following disclaimer. 1679455Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1779455Sobrien * notice, this list of conditions and the following disclaimer in the 1879455Sobrien * documentation and/or other materials provided with the distribution. 1979455Sobrien * 2079455Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2179455Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2279455Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2379455Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2479455Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2579455Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2679455Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2779455Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2879455Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2979455Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3079455Sobrien * SUCH DAMAGE. 3179455Sobrien * 3279455Sobrien * $FreeBSD: head/sys/dev/vt/vt.h 270702 2014-08-27 09:34:41Z dumbbell $ 3379455Sobrien */ 3479455Sobrien 3579455Sobrien#ifndef _DEV_VT_VT_H_ 3679455Sobrien#define _DEV_VT_VT_H_ 3779455Sobrien 3879455Sobrien#include <sys/param.h> 3979455Sobrien#include <sys/_lock.h> 4079455Sobrien#include <sys/_mutex.h> 4179455Sobrien#include <sys/callout.h> 4279455Sobrien#include <sys/condvar.h> 43203872Skib#include <sys/conf.h> 44203872Skib#include <sys/consio.h> 4592839Simp#include <sys/kbio.h> 46203872Skib#include <sys/mouse.h> 4779455Sobrien#include <sys/terminal.h> 48125471Sbde#include <sys/sysctl.h> 49125471Sbde 50125471Sbde#include "opt_syscons.h" 51125471Sbde#include "opt_splash.h" 52125471Sbde 53125471Sbde#ifndef VT_MAXWINDOWS 54125471Sbde#ifdef MAXCONS 55125471Sbde#define VT_MAXWINDOWS MAXCONS 56125471Sbde#else 57125471Sbde#define VT_MAXWINDOWS 12 58125471Sbde#endif 59125471Sbde#endif 60125471Sbde 61125471Sbde#ifndef VT_ALT_TO_ESC_HACK 62125471Sbde#define VT_ALT_TO_ESC_HACK 1 63125471Sbde#endif 64125471Sbde 65125471Sbde#define VT_CONSWINDOW 0 66125469Sbde 67125469Sbde#if defined(SC_TWOBUTTON_MOUSE) || defined(VT_TWOBUTTON_MOUSE) 68125469Sbde#define VT_MOUSE_PASTEBUTTON MOUSE_BUTTON3DOWN /* right button */ 69125469Sbde#define VT_MOUSE_EXTENDBUTTON MOUSE_BUTTON2DOWN /* not really used */ 70125469Sbde#else 71125469Sbde#define VT_MOUSE_PASTEBUTTON MOUSE_BUTTON2DOWN /* middle button */ 72125469Sbde#define VT_MOUSE_EXTENDBUTTON MOUSE_BUTTON3DOWN /* right button */ 73125485Sbde#endif /* defined(SC_TWOBUTTON_MOUSE) || defined(VT_TWOBUTTON_MOUSE) */ 74125469Sbde 75125469Sbde#define SC_DRIVER_NAME "vt" 76125469Sbde#ifdef VT_DEBUG 77125469Sbde#define DPRINTF(_l, ...) if (vt_debug > (_l)) printf( __VA_ARGS__ ) 78125469Sbde#define VT_CONSOLECTL_DEBUG 79125469Sbde#define VT_SYSMOUSE_DEBUG 80125469Sbde#else 81125469Sbde#define DPRINTF(_l, ...) do {} while (0) 82125469Sbde#endif 83125469Sbde#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) 84125469Sbde 85125469Sbde#define VT_SYSCTL_INT(_name, _default, _descr) \ 86125469Sbdestatic int vt_##_name = _default; \ 87125469SbdeSYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, &vt_##_name, _default,\ 88125469Sbde _descr); 89125469Sbde 90125469Sbde/* Allow to disable some special keys by users. */ 91125469Sbde#define VT_DEBUG_KEY_ENABLED (1 << 0) 92125469Sbde#define VT_REBOOT_KEY_ENABLED (1 << 1) 93125469Sbde#define VT_HALT_KEY_ENABLED (1 << 2) 94125469Sbde#define VT_POWEROFF_KEY_ENABLED (1 << 3) 95125485Sbde 96125485Sbdestruct vt_driver; 97125485Sbde 98125485Sbdevoid vt_allocate(struct vt_driver *, void *); 99125485Sbdevoid vt_resume(void); 100125485Sbdevoid vt_suspend(void); 101125485Sbde 102125485Sbdetypedef unsigned int vt_axis_t; 103125485Sbde 104125485Sbde/* 105125485Sbde * List of locks 106125485Sbde * (d) locked by vd_lock 107125485Sbde * (b) locked by vb_lock 108125485Sbde * (G) locked by Giant 109125485Sbde * (u) unlocked, locked by higher levels 110125469Sbde * (c) const until freeing 111125485Sbde * (?) yet to be determined 112125485Sbde */ 113125485Sbde 114125485Sbde/* 115125485Sbde * Per-device datastructure. 116125485Sbde */ 117125485Sbde 118125485Sbde#ifndef SC_NO_CUTPASTE 119125485Sbdestruct vt_mouse_cursor; 120125485Sbde#endif 121125485Sbde 122125469Sbdestruct vt_device { 123125469Sbde struct vt_window *vd_windows[VT_MAXWINDOWS]; /* (c) Windows. */ 124125469Sbde struct vt_window *vd_curwindow; /* (d) Current window. */ 125125469Sbde struct vt_window *vd_savedwindow;/* (?) Saved for suspend. */ 126125469Sbde struct vt_window *vd_markedwin; /* (?) Copy/paste buf owner. */ 12779455Sobrien const struct vt_driver *vd_driver; /* (c) Graphics driver. */ 12879455Sobrien void *vd_softc; /* (u) Driver data. */ 12979455Sobrien#ifndef SC_NO_CUTPASTE 13079455Sobrien struct vt_mouse_cursor *vd_mcursor; /* (?) Cursor bitmap. */ 131203872Skib term_color_t vd_mcursor_fg; /* (?) Cursor fg color. */ 13279455Sobrien term_color_t vd_mcursor_bg; /* (?) Cursor bg color. */ 13379455Sobrien vt_axis_t vd_mx_drawn; /* (?) Mouse X and Y */ 13479455Sobrien vt_axis_t vd_my_drawn; /* as of last redraw. */ 13579455Sobrien int vd_mshown; /* (?) Mouse shown during */ 13679455Sobrien#endif /* last redrawn. */ 13779455Sobrien uint16_t vd_mx; /* (?) Current mouse X. */ 13879455Sobrien uint16_t vd_my; /* (?) current mouse Y. */ 13979455Sobrien uint32_t vd_mstate; /* (?) Mouse state. */ 14079455Sobrien vt_axis_t vd_width; /* (?) Screen width. */ 14179455Sobrien vt_axis_t vd_height; /* (?) Screen height. */ 14279455Sobrien struct mtx vd_lock; /* Per-device lock. */ 14379455Sobrien struct cv vd_winswitch; /* (d) Window switch notify. */ 14479455Sobrien struct callout vd_timer; /* (d) Display timer. */ 14579455Sobrien volatile unsigned int vd_timer_armed;/* (?) Display timer started.*/ 14679455Sobrien int vd_flags; /* (d) Device flags. */ 14779455Sobrien#define VDF_TEXTMODE 0x01 /* Do text mode rendering. */ 14879455Sobrien#define VDF_SPLASH 0x02 /* Splash screen active. */ 14979455Sobrien#define VDF_ASYNC 0x04 /* vt_timer() running. */ 15079455Sobrien#define VDF_INVALID 0x08 /* Entire screen should be re-rendered. */ 15179455Sobrien#define VDF_DEAD 0x10 /* Early probing found nothing. */ 15279455Sobrien#define VDF_INITIALIZED 0x20 /* vtterm_cnprobe already done. */ 15379455Sobrien#define VDF_MOUSECURSOR 0x40 /* Mouse cursor visible. */ 15479455Sobrien#define VDF_QUIET_BELL 0x80 /* Disable bell. */ 15579455Sobrien int vd_keyboard; /* (G) Keyboard index. */ 15679455Sobrien unsigned int vd_kbstate; /* (?) Device unit. */ 15779455Sobrien unsigned int vd_unit; /* (c) Device unit. */ 15879455Sobrien}; 15979455Sobrien 16079455Sobrien/* 16179455Sobrien * Per-window terminal screen buffer. 162203872Skib * 16379455Sobrien * Because redrawing is performed asynchronously, the buffer keeps track 16479455Sobrien * of a rectangle that needs to be redrawn (vb_dirtyrect). Because this 16579455Sobrien * approach seemed to cause suboptimal performance (when the top left 16679455Sobrien * and the bottom right of the screen are modified), it also uses a set 16779455Sobrien * of bitmasks to keep track of the rows and columns (mod 64) that have 16879455Sobrien * been modified. 16979455Sobrien */ 17079455Sobrien 17179455Sobrienstruct vt_bufmask { 17279455Sobrien uint64_t vbm_row, vbm_col; 17379455Sobrien#define VBM_DIRTY UINT64_MAX 17479455Sobrien}; 17579455Sobrien 17679455Sobrienstruct vt_buf { 17779455Sobrien struct mtx vb_lock; /* Buffer lock. */ 17879455Sobrien term_pos_t vb_scr_size; /* (b) Screen dimensions. */ 17979455Sobrien int vb_flags; /* (b) Flags. */ 180203872Skib#define VBF_CURSOR 0x1 /* Cursor visible. */ 18179455Sobrien#define VBF_STATIC 0x2 /* Buffer is statically allocated. */ 18279455Sobrien#define VBF_MTX_INIT 0x4 /* Mutex initialized. */ 18379455Sobrien#define VBF_SCROLL 0x8 /* scroll locked mode. */ 18479455Sobrien#define VBF_HISTORY_FULL 0x10 /* All rows filled. */ 18579455Sobrien int vb_history_size; 18679455Sobrien#define VBF_DEFAULT_HISTORY_SIZE 500 18779455Sobrien int vb_roffset; /* (b) History rows offset. */ 18879455Sobrien int vb_curroffset; /* (b) Saved rows offset. */ 18979455Sobrien term_pos_t vb_cursor; /* (u) Cursor position. */ 19079455Sobrien term_pos_t vb_mark_start; /* (b) Copy region start. */ 19179455Sobrien term_pos_t vb_mark_end; /* (b) Copy region end. */ 19279455Sobrien int vb_mark_last; /* Last mouse event. */ 19379455Sobrien term_rect_t vb_dirtyrect; /* (b) Dirty rectangle. */ 19479455Sobrien struct vt_bufmask vb_dirtymask; /* (b) Dirty bitmasks. */ 19579455Sobrien term_char_t *vb_buffer; /* (u) Data buffer. */ 19679455Sobrien term_char_t **vb_rows; /* (u) Array of rows */ 197203872Skib}; 19879455Sobrien 19979455Sobrienvoid vtbuf_copy(struct vt_buf *, const term_rect_t *, const term_pos_t *); 20079455Sobrienvoid vtbuf_fill_locked(struct vt_buf *, const term_rect_t *, term_char_t); 20179455Sobrienvoid vtbuf_init_early(struct vt_buf *); 20279455Sobrienvoid vtbuf_init(struct vt_buf *, const term_pos_t *); 203203872Skibvoid vtbuf_grow(struct vt_buf *, const term_pos_t *, int); 20479455Sobrienvoid vtbuf_putchar(struct vt_buf *, const term_pos_t *, term_char_t); 20579455Sobrienvoid vtbuf_cursor_position(struct vt_buf *, const term_pos_t *); 20679455Sobrienvoid vtbuf_scroll_mode(struct vt_buf *vb, int yes); 20779455Sobrienvoid vtbuf_dirty(struct vt_buf *vb, const term_rect_t *area); 20879455Sobrienvoid vtbuf_undirty(struct vt_buf *, term_rect_t *, struct vt_bufmask *); 20979455Sobrienvoid vtbuf_sethistory_size(struct vt_buf *, int); 210203872Skibint vtbuf_iscursor(const struct vt_buf *vb, int row, int col); 21179455Sobrienvoid vtbuf_cursor_visibility(struct vt_buf *, int); 21279455Sobrien#ifndef SC_NO_CUTPASTE 21379455Sobrienint vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row); 21479455Sobrienint vtbuf_get_marked_len(struct vt_buf *vb); 21579455Sobrienvoid vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz); 216203872Skib#endif 21779455Sobrien 21879455Sobrien#define VTB_MARK_NONE 0 21979455Sobrien#define VTB_MARK_END 1 22079455Sobrien#define VTB_MARK_START 2 22179455Sobrien#define VTB_MARK_WORD 3 22279455Sobrien#define VTB_MARK_ROW 4 22379455Sobrien#define VTB_MARK_EXTEND 5 22479455Sobrien#define VTB_MARK_MOVE 6 22579455Sobrien 22679455Sobrien#define VTBUF_SLCK_ENABLE(vb) vtbuf_scroll_mode((vb), 1) 22779455Sobrien#define VTBUF_SLCK_DISABLE(vb) vtbuf_scroll_mode((vb), 0) 22879455Sobrien 229102231Strhodes#define VTBUF_MAX_HEIGHT(vb) \ 23079455Sobrien ((vb)->vb_history_size) 23179455Sobrien#define VTBUF_GET_ROW(vb, r) \ 23279455Sobrien ((vb)->vb_rows[((vb)->vb_roffset + (r)) % VTBUF_MAX_HEIGHT(vb)]) 23379455Sobrien#define VTBUF_GET_FIELD(vb, r, c) \ 23479455Sobrien ((vb)->vb_rows[((vb)->vb_roffset + (r)) % VTBUF_MAX_HEIGHT(vb)][(c)]) 23579455Sobrien#define VTBUF_FIELD(vb, r, c) \ 23679455Sobrien ((vb)->vb_rows[((vb)->vb_curroffset + (r)) % VTBUF_MAX_HEIGHT(vb)][(c)]) 23779455Sobrien#define VTBUF_ISCURSOR(vb, r, c) \ 23879455Sobrien vtbuf_iscursor((vb), (r), (c)) 23979455Sobrien#define VTBUF_DIRTYROW(mask, row) \ 24079455Sobrien ((mask)->vbm_row & ((uint64_t)1 << ((row) % 64))) 24179455Sobrien#define VTBUF_DIRTYCOL(mask, col) \ 24279455Sobrien ((mask)->vbm_col & ((uint64_t)1 << ((col) % 64))) 24379455Sobrien#define VTBUF_SPACE_CHAR(attr) (' ' | (attr)) 24479455Sobrien 24579455Sobrien#define VHS_SET 0 24679455Sobrien#define VHS_CUR 1 24779455Sobrien#define VHS_END 2 24879455Sobrienint vthistory_seek(struct vt_buf *, int offset, int whence); 24979455Sobrienvoid vthistory_addlines(struct vt_buf *vb, int offset); 25079455Sobrienvoid vthistory_getpos(const struct vt_buf *, unsigned int *offset); 25179455Sobrien 25279455Sobrien/* 25379455Sobrien * Per-window datastructure. 25479455Sobrien */ 25579455Sobrien 25679455Sobrienstruct vt_window { 25779455Sobrien struct vt_device *vw_device; /* (c) Device. */ 25879455Sobrien struct terminal *vw_terminal; /* (c) Terminal. */ 25979455Sobrien struct vt_buf vw_buf; /* (u) Screen buffer. */ 26079455Sobrien struct vt_font *vw_font; /* (d) Graphical font. */ 26179455Sobrien term_rect_t vw_draw_area; /* (?) Drawable area. */ 26279455Sobrien unsigned int vw_number; /* (c) Window number. */ 26379455Sobrien int vw_kbdmode; /* (?) Keyboard mode. */ 26479455Sobrien char *vw_kbdsq; /* Escape sequence queue*/ 26579455Sobrien unsigned int vw_flags; /* (d) Per-window flags. */ 26679455Sobrien int vw_mouse_level;/* Mouse op mode. */ 26779455Sobrien#define VWF_BUSY 0x1 /* Busy reconfiguring device. */ 26879455Sobrien#define VWF_OPENED 0x2 /* TTY in use. */ 26979455Sobrien#define VWF_SCROLL 0x4 /* Keys influence scrollback. */ 27079455Sobrien#define VWF_CONSOLE 0x8 /* Kernel message console window. */ 27179455Sobrien#define VWF_VTYLOCK 0x10 /* Prevent window switch. */ 27279455Sobrien#define VWF_MOUSE_HIDE 0x20 /* Disable mouse events processing. */ 27379455Sobrien#define VWF_READY 0x40 /* Window fully initialized. */ 27479455Sobrien#define VWF_GRAPHICS 0x80 /* Window in graphics mode (KDSETMODE). */ 27579455Sobrien#define VWF_SWWAIT_REL 0x10000 /* Program wait for VT acquire is done. */ 27679455Sobrien#define VWF_SWWAIT_ACQ 0x20000 /* Program wait for VT release is done. */ 27779455Sobrien pid_t vw_pid; /* Terminal holding process */ 27879455Sobrien struct proc *vw_proc; 27979455Sobrien struct vt_mode vw_smode; /* switch mode */ 28079455Sobrien struct callout vw_proc_dead_timer; 28179455Sobrien struct vt_window *vw_switch_to; 28279455Sobrien}; 28379455Sobrien 28479455Sobrien#define VT_AUTO 0 /* switching is automatic */ 28579455Sobrien#define VT_PROCESS 1 /* switching controlled by prog */ 28679455Sobrien#define VT_KERNEL 255 /* switching controlled in kernel */ 28779455Sobrien 28879455Sobrien#define IS_VT_PROC_MODE(vw) ((vw)->vw_smode.mode == VT_PROCESS) 28979455Sobrien 29079455Sobrien/* 29179455Sobrien * Per-device driver routines. 29279455Sobrien */ 29379455Sobrien 29479455Sobrientypedef int vd_init_t(struct vt_device *vd); 29579455Sobrientypedef int vd_probe_t(struct vt_device *vd); 29679455Sobrientypedef void vd_postswitch_t(struct vt_device *vd); 29779455Sobrientypedef void vd_blank_t(struct vt_device *vd, term_color_t color); 29879455Sobrientypedef void vd_bitblt_text_t(struct vt_device *vd, const struct vt_window *vw, 29979455Sobrien const term_rect_t *area); 30079455Sobrientypedef void vd_bitblt_bmp_t(struct vt_device *vd, const struct vt_window *vw, 30179455Sobrien const uint8_t *pattern, const uint8_t *mask, 30279455Sobrien unsigned int width, unsigned int height, 30379455Sobrien unsigned int x, unsigned int y, term_color_t fg, term_color_t bg); 30479455Sobrientypedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread *); 30579455Sobrientypedef int vd_fb_mmap_t(struct vt_device *, vm_ooffset_t, vm_paddr_t *, int, 30679455Sobrien vm_memattr_t *); 30779455Sobrientypedef void vd_drawrect_t(struct vt_device *, int, int, int, int, int, 30879455Sobrien term_color_t); 309203872Skibtypedef void vd_setpixel_t(struct vt_device *, int, int, term_color_t); 310203872Skib 311203872Skibstruct vt_driver { 312203872Skib char vd_name[16]; 313203872Skib /* Console attachment. */ 31479455Sobrien vd_probe_t *vd_probe; 31579455Sobrien vd_init_t *vd_init; 31679455Sobrien 31779455Sobrien /* Drawing. */ 31879455Sobrien vd_blank_t *vd_blank; 31979455Sobrien vd_drawrect_t *vd_drawrect; 32079455Sobrien vd_setpixel_t *vd_setpixel; 32192839Simp vd_bitblt_text_t *vd_bitblt_text; 32279455Sobrien vd_bitblt_bmp_t *vd_bitblt_bmp; 32379455Sobrien 32479455Sobrien /* Framebuffer ioctls, if present. */ 32579455Sobrien vd_fb_ioctl_t *vd_fb_ioctl; 32679455Sobrien 32779455Sobrien /* Framebuffer mmap, if present. */ 32879455Sobrien vd_fb_mmap_t *vd_fb_mmap; 32979455Sobrien 33079455Sobrien /* Update display setting on vt switch. */ 33179455Sobrien vd_postswitch_t *vd_postswitch; 33279455Sobrien 333203872Skib /* Priority to know which one can override */ 33479455Sobrien int vd_priority; 33579455Sobrien#define VD_PRIORITY_DUMB 10 33679455Sobrien#define VD_PRIORITY_GENERIC 100 33779455Sobrien#define VD_PRIORITY_SPECIFIC 1000 33879455Sobrien}; 33979455Sobrien 340175853Syar/* 34179455Sobrien * Console device madness. 342175853Syar * 34379455Sobrien * Utility macro to make early vt(4) instances work. 34479455Sobrien */ 34579455Sobrien 34679455Sobrienextern const struct terminal_class vt_termclass; 34779455Sobrienvoid vt_upgrade(struct vt_device *vd); 348203872Skib 34979455Sobrien#define PIXEL_WIDTH(w) ((w) / 8) 350175854Syar#define PIXEL_HEIGHT(h) ((h) / 16) 35179455Sobrien 35279455Sobrien#ifndef VT_FB_DEFAULT_WIDTH 35379455Sobrien#define VT_FB_DEFAULT_WIDTH 2048 354203872Skib#endif 35579455Sobrien#ifndef VT_FB_DEFAULT_HEIGHT 35679455Sobrien#define VT_FB_DEFAULT_HEIGHT 1200 35779455Sobrien#endif 35879455Sobrien 35979455Sobrien/* name argument is not used yet. */ 36079455Sobrien#define VT_DRIVER_DECLARE(name, drv) DATA_SET(vt_drv_set, drv) 36179455Sobrien 362203872Skib/* 36379455Sobrien * Fonts. 36479455Sobrien * 36579455Sobrien * Remapping tables are used to map Unicode points to glyphs. They need 36679455Sobrien * to be sorted, because vtfont_lookup() performs a binary search. Each 36779455Sobrien * font has two remapping tables, for normal and bold. When a character 36879455Sobrien * is not present in bold, it uses a normal glyph. When no glyph is 36979455Sobrien * available, it uses glyph 0, which is normally equal to U+FFFD. 37079455Sobrien */ 37179455Sobrien 37279455Sobrienstruct vt_font_map { 373203872Skib uint32_t vfm_src; 37479455Sobrien uint16_t vfm_dst; 37579455Sobrien uint16_t vfm_len; 37679455Sobrien}; 37779455Sobrien 37879455Sobrienstruct vt_font { 37979455Sobrien struct vt_font_map *vf_map[VFNT_MAPS]; 38079455Sobrien uint8_t *vf_bytes; 38179455Sobrien unsigned int vf_height, vf_width; 38279455Sobrien unsigned int vf_map_count[VFNT_MAPS]; 38379455Sobrien unsigned int vf_refcount; 38479455Sobrien}; 385203872Skib 38679455Sobrien#ifndef SC_NO_CUTPASTE 38779455Sobrienstruct vt_mouse_cursor { 38879455Sobrien uint8_t map[64 * 64 / 8]; 38979455Sobrien uint8_t mask[64 * 64 / 8]; 39079455Sobrien uint8_t width; 391203872Skib uint8_t height; 39279455Sobrien}; 39379455Sobrien#endif 39479455Sobrien 39579455Sobrienconst uint8_t *vtfont_lookup(const struct vt_font *vf, term_char_t c); 39679455Sobrienstruct vt_font *vtfont_ref(struct vt_font *vf); 39779455Sobrienvoid vtfont_unref(struct vt_font *vf); 39879455Sobrienint vtfont_load(vfnt_t *f, struct vt_font **ret); 39979455Sobrien 40079455Sobrien/* Sysmouse. */ 40179455Sobrienvoid sysmouse_process_event(mouse_info_t *mi); 40279455Sobrien#ifndef SC_NO_CUTPASTE 403203872Skibvoid vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel); 404203872Skibvoid vt_mouse_state(int show); 40579455Sobrien#endif 40679455Sobrien#define VT_MOUSE_SHOW 1 40779455Sobrien#define VT_MOUSE_HIDE 0 40879455Sobrien 40979455Sobrien/* Utilities. */ 41079455Sobrienvoid vt_determine_colors(term_char_t c, int cursor, 41179455Sobrien term_color_t *fg, term_color_t *bg); 41279455Sobrienint vt_is_cursor_in_area(const struct vt_device *vd, 41379455Sobrien const term_rect_t *area); 41479455Sobrien 41579455Sobrien#endif /* !_DEV_VT_VT_H_ */ 41692839Simp 41779455Sobrien