diff options
| author | Devin J. Pohly <djpohly@gmail.com> | 2018-02-24 14:53:23 -0600 |
|---|---|---|
| committer | Devin J. Pohly <djpohly@gmail.com> | 2018-02-25 21:56:26 -0600 |
| commit | 88d8293fb4ba150a5f19d58d133b5db93d9dcfa5 (patch) | |
| tree | f9e3cce2feda5565049c5d99012e8bd84144b8a2 /st.c | |
| parent | Split mode bits between Term and TermWindow (diff) | |
| download | st-88d8293fb4ba150a5f19d58d133b5db93d9dcfa5.tar.gz st-88d8293fb4ba150a5f19d58d133b5db93d9dcfa5.zip | |
Move win-agnostic parts of draw/drawregion to st.c
Introduces three functions to encapsulate X-specific behavior:
* xdrawline: draws a portion of a single line (used by drawregion)
* xbegindraw: called to prepare for drawing (will be useful for e.g.
Wayland) and returns true if drawing should happen
* xfinishdraw: called to finish drawing (used by draw)
Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Diffstat (limited to '')
| -rw-r--r-- | st.c | 25 |
1 files changed, 25 insertions, 0 deletions
| @@ -166,6 +166,8 @@ static int32_t tdefcolor(int *, int *, int); | |||
| 166 | static void tdeftran(char); | 166 | static void tdeftran(char); |
| 167 | static void tstrsequence(uchar); | 167 | static void tstrsequence(uchar); |
| 168 | 168 | ||
| 169 | static void drawregion(int, int, int, int); | ||
| 170 | |||
| 169 | static void selscroll(int, int); | 171 | static void selscroll(int, int); |
| 170 | static void selsnap(int *, int *, int); | 172 | static void selsnap(int *, int *, int); |
| 171 | 173 | ||
| @@ -2527,6 +2529,29 @@ resettitle(void) | |||
| 2527 | } | 2529 | } |
| 2528 | 2530 | ||
| 2529 | void | 2531 | void |
| 2532 | drawregion(int x1, int y1, int x2, int y2) | ||
| 2533 | { | ||
| 2534 | int y; | ||
| 2535 | for (y = y1; y < y2; y++) { | ||
| 2536 | if (!term.dirty[y]) | ||
| 2537 | continue; | ||
| 2538 | |||
| 2539 | term.dirty[y] = 0; | ||
| 2540 | xdrawline(term.line[y], x1, y, x2); | ||
| 2541 | } | ||
| 2542 | } | ||
| 2543 | |||
| 2544 | void | ||
| 2545 | draw(void) | ||
| 2546 | { | ||
| 2547 | if (!xstartdraw()) | ||
| 2548 | return; | ||
| 2549 | drawregion(0, 0, term.col, term.row); | ||
| 2550 | xdrawcursor(); | ||
| 2551 | xfinishdraw(); | ||
| 2552 | } | ||
| 2553 | |||
| 2554 | void | ||
| 2530 | redraw(void) | 2555 | redraw(void) |
| 2531 | { | 2556 | { |
| 2532 | tfulldirt(); | 2557 | tfulldirt(); |
