diff options
Diffstat (limited to 'sys/dev/vt/vt.h')
-rw-r--r-- | sys/dev/vt/vt.h | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index 2a7b5e0..a667e1c 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -110,6 +110,10 @@ typedef unsigned int vt_axis_t; * Per-device datastructure. */ +#ifndef SC_NO_CUTPASTE +struct vt_mouse_cursor; +#endif + struct vt_device { struct vt_window *vd_windows[VT_MAXWINDOWS]; /* (c) Windows. */ struct vt_window *vd_curwindow; /* (d) Current window. */ @@ -117,12 +121,17 @@ struct vt_device { struct vt_window *vd_markedwin; /* (?) Copy/paste buf owner. */ const struct vt_driver *vd_driver; /* (c) Graphics driver. */ void *vd_softc; /* (u) Driver data. */ +#ifndef SC_NO_CUTPASTE + struct vt_mouse_cursor *vd_mcursor; /* (?) Cursor bitmap. */ + term_color_t vd_mcursor_fg; /* (?) Cursor fg color. */ + term_color_t vd_mcursor_bg; /* (?) Cursor bg color. */ + vt_axis_t vd_mx_drawn; /* (?) Mouse X and Y */ + vt_axis_t vd_my_drawn; /* as of last redraw. */ + int vd_mshown; /* (?) Mouse shown during */ +#endif /* last redrawn. */ uint16_t vd_mx; /* (?) Current mouse X. */ uint16_t vd_my; /* (?) current mouse Y. */ - vt_axis_t vd_moldx; /* (?) Mouse X as of last redraw. */ - vt_axis_t vd_moldy; /* (?) Mouse Y as of last redraw. */ uint32_t vd_mstate; /* (?) Mouse state. */ - term_pos_t vd_offset; /* (?) Pixel offset. */ vt_axis_t vd_width; /* (?) Screen width. */ vt_axis_t vd_height; /* (?) Screen height. */ struct mtx vd_lock; /* Per-device lock. */ @@ -168,7 +177,7 @@ struct vt_buf { #define VBF_MTX_INIT 0x4 /* Mutex initialized. */ #define VBF_SCROLL 0x8 /* scroll locked mode. */ #define VBF_HISTORY_FULL 0x10 /* All rows filled. */ - int vb_history_size; + unsigned int vb_history_size; #define VBF_DEFAULT_HISTORY_SIZE 500 int vb_roffset; /* (b) History rows offset. */ int vb_curroffset; /* (b) Saved rows offset. */ @@ -186,16 +195,16 @@ void vtbuf_copy(struct vt_buf *, const term_rect_t *, const term_pos_t *); void vtbuf_fill_locked(struct vt_buf *, const term_rect_t *, term_char_t); void vtbuf_init_early(struct vt_buf *); void vtbuf_init(struct vt_buf *, const term_pos_t *); -void vtbuf_grow(struct vt_buf *, const term_pos_t *, int); +void vtbuf_grow(struct vt_buf *, const term_pos_t *, unsigned int); void vtbuf_putchar(struct vt_buf *, const term_pos_t *, term_char_t); void vtbuf_cursor_position(struct vt_buf *, const term_pos_t *); void vtbuf_scroll_mode(struct vt_buf *vb, int yes); +void vtbuf_dirty(struct vt_buf *vb, const term_rect_t *area); void vtbuf_undirty(struct vt_buf *, term_rect_t *, struct vt_bufmask *); void vtbuf_sethistory_size(struct vt_buf *, int); int vtbuf_iscursor(const struct vt_buf *vb, int row, int col); void vtbuf_cursor_visibility(struct vt_buf *, int); #ifndef SC_NO_CUTPASTE -void vtbuf_mouse_cursor_position(struct vt_buf *vb, int col, int row); int vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row); int vtbuf_get_marked_len(struct vt_buf *vb); void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz); @@ -244,6 +253,7 @@ struct vt_window { struct terminal *vw_terminal; /* (c) Terminal. */ struct vt_buf vw_buf; /* (u) Screen buffer. */ struct vt_font *vw_font; /* (d) Graphical font. */ + term_rect_t vw_draw_area; /* (?) Drawable area. */ unsigned int vw_number; /* (c) Window number. */ int vw_kbdmode; /* (?) Keyboard mode. */ char *vw_kbdsq; /* Escape sequence queue*/ @@ -256,6 +266,7 @@ struct vt_window { #define VWF_VTYLOCK 0x10 /* Prevent window switch. */ #define VWF_MOUSE_HIDE 0x20 /* Disable mouse events processing. */ #define VWF_READY 0x40 /* Window fully initialized. */ +#define VWF_GRAPHICS 0x80 /* Window in graphics mode (KDSETMODE). */ #define VWF_SWWAIT_REL 0x10000 /* Program wait for VT acquire is done. */ #define VWF_SWWAIT_ACQ 0x20000 /* Program wait for VT release is done. */ pid_t vw_pid; /* Terminal holding process */ @@ -273,21 +284,18 @@ struct vt_window { /* * Per-device driver routines. - * - * vd_bitbltchr is used when the driver operates in graphics mode, while - * vd_putchar is used when the driver operates in text mode - * (VDF_TEXTMODE). */ typedef int vd_init_t(struct vt_device *vd); typedef int vd_probe_t(struct vt_device *vd); typedef void vd_postswitch_t(struct vt_device *vd); typedef void vd_blank_t(struct vt_device *vd, term_color_t color); -typedef void vd_bitbltchr_t(struct vt_device *vd, const uint8_t *src, - const uint8_t *mask, int bpl, vt_axis_t top, vt_axis_t left, - unsigned int width, unsigned int height, term_color_t fg, term_color_t bg); -typedef void vd_putchar_t(struct vt_device *vd, term_char_t, - vt_axis_t top, vt_axis_t left, term_color_t fg, term_color_t bg); +typedef void vd_bitblt_text_t(struct vt_device *vd, const struct vt_window *vw, + const term_rect_t *area); +typedef void vd_bitblt_bmp_t(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *pattern, const uint8_t *mask, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y, term_color_t fg, term_color_t bg); typedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread *); typedef int vd_fb_mmap_t(struct vt_device *, vm_ooffset_t, vm_paddr_t *, int, vm_memattr_t *); @@ -303,9 +311,10 @@ struct vt_driver { /* Drawing. */ vd_blank_t *vd_blank; - vd_bitbltchr_t *vd_bitbltchr; vd_drawrect_t *vd_drawrect; vd_setpixel_t *vd_setpixel; + vd_bitblt_text_t *vd_bitblt_text; + vd_bitblt_bmp_t *vd_bitblt_bmp; /* Framebuffer ioctls, if present. */ vd_fb_ioctl_t *vd_fb_ioctl; @@ -313,9 +322,6 @@ struct vt_driver { /* Framebuffer mmap, if present. */ vd_fb_mmap_t *vd_fb_mmap; - /* Text mode operation. */ - vd_putchar_t *vd_putchar; - /* Update display setting on vt switch. */ vd_postswitch_t *vd_postswitch; @@ -373,11 +379,11 @@ struct vt_font { }; #ifndef SC_NO_CUTPASTE -struct mouse_cursor { +struct vt_mouse_cursor { uint8_t map[64 * 64 / 8]; uint8_t mask[64 * 64 / 8]; - uint8_t w; - uint8_t h; + uint8_t width; + uint8_t height; }; #endif @@ -395,5 +401,11 @@ void vt_mouse_state(int show); #define VT_MOUSE_SHOW 1 #define VT_MOUSE_HIDE 0 +/* Utilities. */ +void vt_determine_colors(term_char_t c, int cursor, + term_color_t *fg, term_color_t *bg); +int vt_is_cursor_in_area(const struct vt_device *vd, + const term_rect_t *area); + #endif /* !_DEV_VT_VT_H_ */ |