aboutsummaryrefslogtreecommitdiff
path: root/st.h
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2018-02-23 14:16:52 -0600
committerDevin J. Pohly <djpohly@gmail.com>2018-02-25 21:56:26 -0600
commit05c66cb37d9ff278a3e0c45682c4b5e7945deb42 (patch)
tree273ee88089e86784a261c5564dd51e9489bcd09e /st.h
parent33201ac65f74e45b4fa60822ba9a538c3cfa9b25 (diff)
downloadst-patched-05c66cb37d9ff278a3e0c45682c4b5e7945deb42.tar.bz2
st-patched-05c66cb37d9ff278a3e0c45682c4b5e7945deb42.tar.xz
st-patched-05c66cb37d9ff278a3e0c45682c4b5e7945deb42.zip
Split mode bits between Term and TermWindow
Moves the mode bits used by x.c from Term to TermWindow, absorbing UI/input-related mode bits (visible/focused/numlock) along the way. This is gradually reducing external references to Term. Since TermWindow is already internal to x.c, we add xsetmode() to allow st to modify window bits in accordance with escape sequences. IS_SET() is redefined accordingly (term.mode in st.c, win.mode in x.c). Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Diffstat (limited to 'st.h')
-rw-r--r--st.h33
1 files changed, 1 insertions, 32 deletions
diff --git a/st.h b/st.h
index d7738a0..3382d61 100644
--- a/st.h
+++ b/st.h
@@ -13,7 +13,6 @@
13#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) 13#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
14#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ 14#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \
15 (a).bg != (b).bg) 15 (a).bg != (b).bg)
16#define IS_SET(flag) ((term.mode & (flag)) != 0)
17#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ 16#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \
18 (t1.tv_nsec-t2.tv_nsec)/1E6) 17 (t1.tv_nsec-t2.tv_nsec)/1E6)
19#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) 18#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
@@ -37,34 +36,6 @@ enum glyph_attribute {
37 ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, 36 ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
38}; 37};
39 38
40enum term_mode {
41 MODE_WRAP = 1 << 0,
42 MODE_INSERT = 1 << 1,
43 MODE_APPKEYPAD = 1 << 2,
44 MODE_ALTSCREEN = 1 << 3,
45 MODE_CRLF = 1 << 4,
46 MODE_MOUSEBTN = 1 << 5,
47 MODE_MOUSEMOTION = 1 << 6,
48 MODE_REVERSE = 1 << 7,
49 MODE_KBDLOCK = 1 << 8,
50 MODE_HIDE = 1 << 9,
51 MODE_ECHO = 1 << 10,
52 MODE_APPCURSOR = 1 << 11,
53 MODE_MOUSESGR = 1 << 12,
54 MODE_8BIT = 1 << 13,
55 MODE_BLINK = 1 << 14,
56 MODE_FBLINK = 1 << 15,
57 MODE_FOCUS = 1 << 16,
58 MODE_MOUSEX10 = 1 << 17,
59 MODE_MOUSEMANY = 1 << 18,
60 MODE_BRCKTPASTE = 1 << 19,
61 MODE_PRINT = 1 << 20,
62 MODE_UTF8 = 1 << 21,
63 MODE_SIXEL = 1 << 22,
64 MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
65 |MODE_MOUSEMANY,
66};
67
68enum selection_mode { 39enum selection_mode {
69 SEL_IDLE = 0, 40 SEL_IDLE = 0,
70 SEL_EMPTY = 1, 41 SEL_EMPTY = 1,
@@ -120,7 +91,6 @@ typedef struct {
120 char trantbl[4]; /* charset table translation */ 91 char trantbl[4]; /* charset table translation */
121 int charset; /* current charset */ 92 int charset; /* current charset */
122 int icharset; /* selected charset for sequence */ 93 int icharset; /* selected charset for sequence */
123 int numlock; /* lock numbers in keyboard */
124 int *tabs; 94 int *tabs;
125} Term; 95} Term;
126 96
@@ -130,7 +100,7 @@ typedef struct {
130 int w, h; /* window width and height */ 100 int w, h; /* window width and height */
131 int ch; /* char height */ 101 int ch; /* char height */
132 int cw; /* char width */ 102 int cw; /* char width */
133 char state; /* focus, redraw, visible */ 103 int mode; /* window state/mode flags */
134 int cursor; /* cursor style */ 104 int cursor; /* cursor style */
135} TermWindow; 105} TermWindow;
136 106
@@ -163,7 +133,6 @@ void die(const char *, ...);
163void redraw(void); 133void redraw(void);
164 134
165void iso14755(const Arg *); 135void iso14755(const Arg *);
166void numlock(const Arg *);
167void printscreen(const Arg *); 136void printscreen(const Arg *);
168void printsel(const Arg *); 137void printsel(const Arg *);
169void sendbreak(const Arg *); 138void sendbreak(const Arg *);