aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2018-02-24 15:32:48 -0600
committerDevin J. Pohly <djpohly@gmail.com>2018-02-25 21:56:26 -0600
commita3beb626d2dae9d4d0883c7c8cb6ba58b0609105 (patch)
tree2b375342df7c33c98ab070ee38b40bbb0da4acf1 /st.c
parenta5dc1b46976b2252f9d7bb68f126c4b0f351dd1a (diff)
downloadst-a3beb626d2dae9d4d0883c7c8cb6ba58b0609105.tar.gz
st-a3beb626d2dae9d4d0883c7c8cb6ba58b0609105.zip
Remove x.c dependency on term
The xinit function only needs to the rows/cols, so pass those in rather than accessing term directly. With a bit of arithmetic, we are able to avoid the need for term.row and term.col in x2col, y2row, and xdrawglyphfontspecs as well, completing the removal. Term is now fully internal to st.c. Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Diffstat (limited to 'st.c')
-rw-r--r--st.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/st.c b/st.c
index 4bf6378..da832ed 100644
--- a/st.c
+++ b/st.c
@@ -95,6 +95,26 @@ enum escape_state {
95 ESC_DCS =128, 95 ESC_DCS =128,
96}; 96};
97 97
98/* Internal representation of the screen */
99typedef struct {
100 int row; /* nb row */
101 int col; /* nb col */
102 Line *line; /* screen */
103 Line *alt; /* alternate screen */
104 int *dirty; /* dirtyness of lines */
105 TCursor c; /* cursor */
106 int ocx; /* old cursor col */
107 int ocy; /* old cursor row */
108 int top; /* top scroll limit */
109 int bot; /* bottom scroll limit */
110 int mode; /* terminal mode flags */
111 int esc; /* escape state flags */
112 char trantbl[4]; /* charset table translation */
113 int charset; /* current charset */
114 int icharset; /* selected charset for sequence */
115 int *tabs;
116} Term;
117
98/* CSI Escape sequence structs */ 118/* CSI Escape sequence structs */
99/* ESC '[' [[ [<priv>] <arg> [;]] <mode> [<mode>]] */ 119/* ESC '[' [[ [<priv>] <arg> [;]] <mode> [<mode>]] */
100typedef struct { 120typedef struct {
@@ -181,11 +201,11 @@ static char *base64dec(const char *);
181static ssize_t xwrite(int, const char *, size_t); 201static ssize_t xwrite(int, const char *, size_t);
182 202
183/* Globals */ 203/* Globals */
184Term term;
185int cmdfd; 204int cmdfd;
186pid_t pid; 205pid_t pid;
187int oldbutton = 3; /* button event on startup: 3 = release */ 206int oldbutton = 3; /* button event on startup: 3 = release */
188 207
208static Term term;
189static Selection sel; 209static Selection sel;
190static CSIEscape csiescseq; 210static CSIEscape csiescseq;
191static STREscape strescseq; 211static STREscape strescseq;