summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-09-17 11:47:15 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-09-17 11:47:15 +0000
commitdbe4c7712b652b7ad3126e94c47b00fa2bbb0a05 (patch)
treea42bb2ef70273394c238990d8182304f9ffd8317
parent43e87b8a95aa36ab5a7f78de3034e081bac2e8ad (diff)
2002-09-16 Marcus Brinkmann <marcus@gnu.org>
* cons.h: Add prototype for cons_vcons_clear. * file-changed.c (cons_S_file_changed): Prepare all areas we write to with cons_vcons_clear (unless we use cons_vcons_scroll already). * vcons-refresh.c (cons_vcons_refresh): Likewise. * vcons-scrollback.c (_cons_vcons_scrollback): Likewise.
-rw-r--r--libcons/ChangeLog7
-rw-r--r--libcons/cons.h17
-rw-r--r--libcons/file-changed.c8
-rw-r--r--libcons/vcons-refresh.c2
-rw-r--r--libcons/vcons-scrollback.c5
5 files changed, 35 insertions, 4 deletions
diff --git a/libcons/ChangeLog b/libcons/ChangeLog
index a6b30aff..b9aeef5d 100644
--- a/libcons/ChangeLog
+++ b/libcons/ChangeLog
@@ -1,5 +1,12 @@
2002-09-16 Marcus Brinkmann <marcus@gnu.org>
+ * cons.h: Add prototype for cons_vcons_clear.
+ * file-changed.c (cons_S_file_changed): Prepare all areas we write
+ to with cons_vcons_clear (unless we use cons_vcons_scroll
+ already).
+ * vcons-refresh.c (cons_vcons_refresh): Likewise.
+ * vcons-scrollback.c (_cons_vcons_scrollback): Likewise.
+
* opts-std-startup.c (parse_startup_opt): Use argp_error instead
argp_usage for error. Replace case for ARGP_KEY_END with case for
ARGP_KEY_NO_ARGS.
diff --git a/libcons/cons.h b/libcons/cons.h
index 67f4e45b..8105a723 100644
--- a/libcons/cons.h
+++ b/libcons/cons.h
@@ -136,6 +136,15 @@ extern const char *cons_client_version;
version specification that should be printed for --version. */
extern char *cons_extra_version;
+/* The user must define this function. Deallocate the scarce
+ resources (like font glyph slots, colors etc) in the LENGTH entries
+ of the screen matrix starting from position COL and ROW. This call
+ is immediately followed by calls to cons_vcons_write that cover the
+ same area. If there are no scarce resources, the caller might do
+ nothing. */
+void cons_vcons_clear (vcons_t vcons, size_t length,
+ uint32_t col, uint32_t row);
+
/* The user must define this function. Write LENGTH characters
starting from STR on the virtual console VCONS, which is locked,
starting from position COL and ROW. */
@@ -165,10 +174,10 @@ void cons_vcons_set_cursor_status (vcons_t vcons, uint32_t status);
prepare a full refresh of the screen. In the latter case the user
should not really perform any scrolling. Instead it might
deallocate limited resources (like display glyph slots and palette
- colors) if that helps to perform the subsequent write. It goes
- without saying that the same deallocation, if any, should be
- performed on the area that will be filled with the scrolled in
- content.
+ colors) if that helps to perform the subsequent write, just like
+ cons_vcons_clear. It goes without saying that the same
+ deallocation, if any, should be performed on the area that will be
+ filled with the scrolled in content.
XXX Possibly need a function to invalidate scrollback buffer, or in
general to signal a switch of the console so state can be reset.
diff --git a/libcons/file-changed.c b/libcons/file-changed.c
index 7b78a317..f65eb0b5 100644
--- a/libcons/file-changed.c
+++ b/libcons/file-changed.c
@@ -162,6 +162,10 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno,
scrolling = vcons->state.screen.height;
if (scrolling < vcons->state.screen.height)
cons_vcons_scroll (vcons, scrolling);
+ else
+ cons_vcons_clear (vcons, vcons->state.screen.width
+ * vcons->state.screen.height,
+ 0, 0);
vis_start = vcons->state.screen.width
* (cur_disp_line % vcons->state.screen.lines);
start = (((cur_disp_line % vcons->state.screen.lines)
@@ -299,6 +303,9 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno,
if (start != -1)
{
+ cons_vcons_clear (vcons, end - start + 1,
+ start_rel % vcons->state.screen.width,
+ start_rel / vcons->state.screen.width);
cons_vcons_write (vcons, vcons->state.screen.matrix + start,
end < size
? end - start + 1
@@ -314,6 +321,7 @@ cons_S_file_changed (cons_notify_t notify, natural_t tickno,
/ vcons->state.screen.width);
if (end2 != -1)
{
+ cons_vcons_clear (vcons, end2 - rotate + 1, 0, 0);
cons_vcons_write (vcons,
vcons->state.screen.matrix + rotate,
end2 < size
diff --git a/libcons/vcons-refresh.c b/libcons/vcons-refresh.c
index c2db2c57..7851618a 100644
--- a/libcons/vcons-refresh.c
+++ b/libcons/vcons-refresh.c
@@ -37,6 +37,8 @@ cons_vcons_refresh (vcons_t vcons)
vcons->state.flags = vcons->display->flags;
vcons->state.changes.written = vcons->display->changes.written;
+ cons_vcons_clear (vcons, vcons->state.screen.width
+ * vcons->state.screen.height, 0, 0);
cons_vcons_write (vcons, vcons->state.screen.matrix
+ (vcons->state.screen.cur_line % vcons->state.screen.lines)
* vcons->state.screen.width,
diff --git a/libcons/vcons-scrollback.c b/libcons/vcons-scrollback.c
index 84fef0b0..c54303e9 100644
--- a/libcons/vcons-scrollback.c
+++ b/libcons/vcons-scrollback.c
@@ -84,6 +84,11 @@ _cons_vcons_scrollback (vcons_t vcons, cons_scroll_t type, float value)
|| (scrolling < 0
&& (uint32_t) (-scrolling) < vcons->state.screen.height))
cons_vcons_scroll (vcons, scrolling);
+ else if ((scrolling > 0 && scrolling == vcons->state.screen.height)
+ || (scrolling < 0
+ && (uint32_t) (-scrolling) == vcons->state.screen.height))
+ cons_vcons_clear (vcons, vcons->state.screen.width
+ * vcons->state.screen.height, 0, 0);
vis_start = vcons->state.screen.width
* (new_cur_line % vcons->state.screen.lines);