aboutsummaryrefslogtreecommitdiff
path: root/terminal.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-06-19 12:17:43 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-06-19 12:17:43 +0000
commit304f15d696ad544bbd90a1e54e547e4e2fbe42c5 (patch)
treedea6898d9f7e7940eb30488777582f90d052f554 /terminal.h
parentcsi: dummy implementation of bright foreground/background colors (diff)
Use a 'damage' list to communicate what needs to be updated
Instead of having each cell in the grid track it's own dirtiness, grid operations now append "damage" to a list. This list is consumed every time we render the grid. This allows us to special case some operations, like erase (and in the future, scroll).
Diffstat (limited to 'terminal.h')
-rw-r--r--terminal.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/terminal.h b/terminal.h
index 51c5af3d..ad40dc3e 100644
--- a/terminal.h
+++ b/terminal.h
@@ -9,6 +9,8 @@
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-keysyms.h>
+#include "tllist.h"
+
struct attributes {
bool bold;
bool italic;
@@ -22,11 +24,22 @@ struct attributes {
};
struct cell {
- bool dirty;
char c[5];
struct attributes attrs;
};
+enum damage_type {DAMAGE_UPDATE, DAMAGE_ERASE, DAMAGE_SCROLL};
+struct damage {
+ enum damage_type type;
+ union {
+ struct {
+ int start;
+ int length;
+ } range; /* DAMAGE_UPDATE, DAMAGE_ERASE */
+ int lines; /* DAMAGE_SCROLL */
+ };
+};
+
struct grid {
int cols;
int rows;
@@ -45,8 +58,7 @@ struct grid {
uint32_t foreground;
uint32_t background;
- bool dirty;
- bool all_dirty;
+ tll(struct damage) damage;
};
struct vt {