|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From ce04e2335ab80eda5674de3399aa16b5aea2657f Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: David Herrmann <dh.herrmann@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Fri, 3 Oct 2014 15:27:25 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] terminal/screen: adjust screen age only on update
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Instead of increasing the screen-age on redraw, we now increase it only on
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
real updates. This is effectively the same, but avoids increased age
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
counters on backbuffer rendering. Therefore, we can now check age counters
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
against fronbuffers safely, while rendering frames in background.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/libsystemd-terminal/term-screen.c | 10 +++++++++-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/libsystemd-terminal/term.h | 1 +
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
2 files changed, 10 insertions(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/libsystemd-terminal/term-screen.c b/src/libsystemd-terminal/term-screen.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 3f7ef1cf3c..145dcdaee5 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/libsystemd-terminal/term-screen.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/libsystemd-terminal/term-screen.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3735,6 +3735,12 @@ unsigned int term_screen_get_height(term_screen *screen) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return screen->page->height;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+uint64_t term_screen_get_age(term_screen *screen) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_return(screen, 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return screen->age;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
uint32_t *ucs4_str;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
size_t i, j, ucs4_len;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -3743,6 +3749,8 @@ int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert_return(screen, -EINVAL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ ++screen->age;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* Feed bytes into utf8 decoder and handle parsed ucs4 chars. We always
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* treat data as UTF-8, but the parser makes sure to fall back to raw
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* 8bit mode if the stream is not valid UTF-8. This should be more than
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -4258,7 +4266,7 @@ int term_screen_draw(term_screen *screen,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (fb_age)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- *fb_age = screen->age++;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ *fb_age = screen->age;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/libsystemd-terminal/term.h b/src/libsystemd-terminal/term.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 8efd48b263..eae6c6352f 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/libsystemd-terminal/term.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/libsystemd-terminal/term.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -156,6 +156,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(term_screen*, term_screen_unref);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int term_screen_get_width(term_screen *screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned int term_screen_get_height(term_screen *screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+uint64_t term_screen_get_age(term_screen *screen);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int term_screen_feed_keyboard(term_screen *screen,
|