diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2018-02-24 14:58:54 -0600 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2018-02-25 21:56:26 -0600 |
commit | a5dc1b46976b2252f9d7bb68f126c4b0f351dd1a (patch) | |
tree | a9ce0c1a4dd254ccb71a61a08dc3df54dc4f2814 /st.c | |
parent | 88d8293fb4ba150a5f19d58d133b5db93d9dcfa5 (diff) | |
download | st-a5dc1b46976b2252f9d7bb68f126c4b0f351dd1a.tar.gz st-a5dc1b46976b2252f9d7bb68f126c4b0f351dd1a.zip |
Pull term references out of xdrawcursor
Gradually reducing x.c dependency on Term object. Old and new cursor
glyph/position are passed to xdrawcursor. (There may be an opportunity
to refactor further if we can unify "clear old cursor" and "draw new
cursor" functionality.)
Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -2544,10 +2544,23 @@ drawregion(int x1, int y1, int x2, int y2) | |||
2544 | void | 2544 | void |
2545 | draw(void) | 2545 | draw(void) |
2546 | { | 2546 | { |
2547 | int cx = term.c.x; | ||
2548 | |||
2547 | if (!xstartdraw()) | 2549 | if (!xstartdraw()) |
2548 | return; | 2550 | return; |
2551 | |||
2552 | /* adjust cursor position */ | ||
2553 | LIMIT(term.ocx, 0, term.col-1); | ||
2554 | LIMIT(term.ocy, 0, term.row-1); | ||
2555 | if (term.line[term.ocy][term.ocx].mode & ATTR_WDUMMY) | ||
2556 | term.ocx--; | ||
2557 | if (term.line[term.c.y][cx].mode & ATTR_WDUMMY) | ||
2558 | cx--; | ||
2559 | |||
2549 | drawregion(0, 0, term.col, term.row); | 2560 | drawregion(0, 0, term.col, term.row); |
2550 | xdrawcursor(); | 2561 | xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], |
2562 | term.ocx, term.ocy, term.line[term.ocy][term.ocx]); | ||
2563 | term.ocx = cx, term.ocy = term.c.y; | ||
2551 | xfinishdraw(); | 2564 | xfinishdraw(); |
2552 | } | 2565 | } |
2553 | 2566 | ||