From c320322dffd8f4648cc24ab731ac64dda6eec77d Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 6 Jun 2020 13:15:14 -0700 Subject: changed all caps --- sys/cmd/term/term.h | 108 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 30 deletions(-) (limited to 'sys/cmd/term/term.h') diff --git a/sys/cmd/term/term.h b/sys/cmd/term/term.h index 0272f25..62c407f 100644 --- a/sys/cmd/term/term.h +++ b/sys/cmd/term/term.h @@ -11,12 +11,14 @@ #include #include -/* macros */ +// ----------------------------------------------------------------------- +// macros + #define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) #define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d)) #define DEFAULT(a, b) (a) = (a) ? (a) : (b) #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) -#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ +#define GLYPHCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ (a).bg != (b).bg) #define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ (t1.tv_nsec-t2.tv_nsec)/1E6) @@ -25,47 +27,78 @@ #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) #define IS_TRUECOL(x) (1 << 24 & (x)) -enum glyph_attribute { - ATTR_NULL = 0, - ATTR_BOLD = 1 << 0, - ATTR_FAINT = 1 << 1, - ATTR_ITALIC = 1 << 2, - ATTR_UNDERLINE = 1 << 3, - ATTR_BLINK = 1 << 4, - ATTR_REVERSE = 1 << 5, - ATTR_INVISIBLE = 1 << 6, - ATTR_STRUCK = 1 << 7, - ATTR_WRAP = 1 << 8, - ATTR_WIDE = 1 << 9, - ATTR_WDUMMY = 1 << 10, - ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, +#define iota(x) 1 << (x) + +// ----------------------------------------------------------------------- +// constants + +enum { + Gnil, + Gbold = iota(0), + Gfaint = iota(1), + Gitalic = iota(2), + Gunline = iota(3), + Gblink = iota(4), + Greverse = iota(5), + Ginvisible = iota(6), + Gstruck = iota(7), + Gwrap = iota(8), + Gwide = iota(9), + Gwdummy = iota(10), + Gboldfaint = Gbold | Gfaint, +}; + +enum { + SelIdle = 0, + SelEmpty = 1, + SelReady = 2 }; -enum selection_mode { - SEL_IDLE = 0, - SEL_EMPTY = 1, - SEL_READY = 2 +enum { + SelRegular = 1, + SelRectangular = 2 }; -enum selection_type { - SEL_REGULAR = 1, - SEL_RECTANGULAR = 2 +enum { + SnapWord = 1, + SnapLine = 2 }; -enum selection_snap { - SNAP_WORD = 1, - SNAP_LINE = 2 +enum win_mode { + Wvisible = 1 << 0, + Wfocused = 1 << 1, + Wappkeypad = 1 << 2, + Wmousebtn = 1 << 3, + Wmousemotion = 1 << 4, + Wreverse = 1 << 5, + Wkbdblock = 1 << 6, + Whide = 1 << 7, + Wappcursor = 1 << 8, + Wmousesgr = 1 << 9, + W8bit = 1 << 10, + Wblink = 1 << 11, + Wbflink = 1 << 12, + Wfocus = 1 << 13, + Wmousex10 = 1 << 14, + Wmousemany = 1 << 15, + Wbrcktpaste = 1 << 16, + Wnumlock = 1 << 17, + Wmouse = Wmousebtn|Wmousemotion|Wmousex10|Wmousemany, }; -#define Glyph Glyph_ -typedef struct { + +// ----------------------------------------------------------------------- +// types +typedef struct Letter Letter; + +struct Letter { rune u; /* character code */ ushort mode; /* attribute flags */ uint32_t fg; /* foreground */ uint32_t bg; /* background */ -} Glyph; +}; -typedef Glyph *Line; +typedef Letter *Line; typedef union { int i; @@ -75,6 +108,21 @@ typedef union { char *s; } Arg; +void xbell(void); +void xclipcopy(void); +void xdrawcursor(int, int, Letter, int, int, Letter); +void xdrawline(Line, int, int, int); +void xfinishdraw(void); +void xloadcols(void); +int xsetcolorname(int, char *); +void xsettitle(char *); +int xsetcursor(int); +void xsetmode(int, uint); +void xsetpointermotion(int); +void xsetsel(char *); +int xstartdraw(void); +void xximspot(int, int); + void die( char *, ...); void redraw(void); void draw(void); -- cgit v1.2.1