aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-06-05 01:42:37 -0400
committerJesse Luehrs <doy@tozt.net>2016-06-05 02:08:49 -0400
commit1cf6da28fc5f02af178dfe6dcbe4fd19c20dbc8e (patch)
tree1ecd34907e8fe53fb8e3a60d62edf9f8d54292f8
parent4813cd322b86488eee3ecb0e6f7cfe2d998b4115 (diff)
downloadvt100-rust-dirty-cells-take-2.tar.gz
vt100-rust-dirty-cells-take-2.zip
move dirty checking to individual cellsdirty-cells-take-2
m---------libvt1000
-rw-r--r--src/cell.rs11
-rw-r--r--src/ffi.c20
-rw-r--r--src/ffi.rs4
-rw-r--r--src/screen.rs9
5 files changed, 23 insertions, 21 deletions
diff --git a/libvt100 b/libvt100
-Subproject bd9fc2ba0396f04df399c1f685aacced8412851
+Subproject 4c7f37b890d4201423987bedb7b9b42b033f360
diff --git a/src/cell.rs b/src/cell.rs
index abec58f..9156299 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -95,4 +95,15 @@ impl Cell {
ffi::vt100_wrapper_cell_attrs_inverse(&mut (*prefix).attrs) != 0
}
}
+
+ pub fn check_dirty(&self) -> bool {
+ let Cell(cell_impl) = *self;
+ let ret = unsafe {
+ ffi::vt100_wrapper_cell_was_drawn(cell_impl) == 0
+ };
+ unsafe {
+ ffi::vt100_wrapper_cell_set_was_drawn(cell_impl)
+ };
+ ret
+ }
}
diff --git a/src/ffi.c b/src/ffi.c
index 61a4a20..d455524 100644
--- a/src/ffi.c
+++ b/src/ffi.c
@@ -61,11 +61,6 @@ int vt100_wrapper_screen_update_icon_name(struct vt100_screen *screen)
return screen->update_icon_name;
}
-int vt100_wrapper_screen_dirty(struct vt100_screen *screen)
-{
- return screen->dirty;
-}
-
void vt100_wrapper_screen_clear_visual_bell(struct vt100_screen *screen)
{
screen->visual_bell = 0;
@@ -86,11 +81,6 @@ void vt100_wrapper_screen_clear_update_icon_name(struct vt100_screen *screen)
screen->update_icon_name = 0;
}
-void vt100_wrapper_screen_clear_dirty(struct vt100_screen *screen)
-{
- screen->dirty = 0;
-}
-
int vt100_wrapper_cell_is_wide(struct vt100_cell *cell)
{
return cell->is_wide;
@@ -115,3 +105,13 @@ int vt100_wrapper_cell_attrs_inverse(struct vt100_cell_attrs *attrs)
{
return attrs->inverse;
}
+
+int vt100_wrapper_cell_was_drawn(struct vt100_cell *cell)
+{
+ return cell->was_drawn;
+}
+
+void vt100_wrapper_cell_set_was_drawn(struct vt100_cell *cell)
+{
+ cell->was_drawn = 1;
+}
diff --git a/src/ffi.rs b/src/ffi.rs
index 284a98c..7715acd 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -59,17 +59,17 @@ extern "C" {
pub fn vt100_wrapper_screen_audible_bell(screen: *mut types::ScreenImpl) -> libc::c_int;
pub fn vt100_wrapper_screen_update_title(screen: *mut types::ScreenImpl) -> libc::c_int;
pub fn vt100_wrapper_screen_update_icon_name(screen: *mut types::ScreenImpl) -> libc::c_int;
- pub fn vt100_wrapper_screen_dirty(screen: *mut types::ScreenImpl) -> libc::c_int;
pub fn vt100_wrapper_screen_clear_visual_bell(screen: *mut types::ScreenImpl);
pub fn vt100_wrapper_screen_clear_audible_bell(screen: *mut types::ScreenImpl);
pub fn vt100_wrapper_screen_clear_update_title(screen: *mut types::ScreenImpl);
pub fn vt100_wrapper_screen_clear_update_icon_name(screen: *mut types::ScreenImpl);
- pub fn vt100_wrapper_screen_clear_dirty(screen: *mut types::ScreenImpl);
pub fn vt100_wrapper_cell_is_wide(cell: *mut types::CellImpl) -> libc::c_int;
pub fn vt100_wrapper_cell_attrs_bold(cell: *mut types::CellAttrs) -> libc::c_int;
pub fn vt100_wrapper_cell_attrs_italic(cell: *mut types::CellAttrs) -> libc::c_int;
pub fn vt100_wrapper_cell_attrs_underline(cell: *mut types::CellAttrs) -> libc::c_int;
pub fn vt100_wrapper_cell_attrs_inverse(cell: *mut types::CellAttrs) -> libc::c_int;
+ pub fn vt100_wrapper_cell_was_drawn(cell: *mut types::CellImpl) -> libc::c_int;
+ pub fn vt100_wrapper_cell_set_was_drawn(cell: *mut types::CellImpl);
}
#[cfg(test)]
diff --git a/src/screen.rs b/src/screen.rs
index fd143d7..04c87ad 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -382,15 +382,6 @@ impl Screen {
state
}
}
-
- pub fn check_dirty(&self) -> bool {
- let Screen(screen_impl) = *self;
- unsafe {
- let state = ffi::vt100_wrapper_screen_dirty(screen_impl) != 0;
- ffi::vt100_wrapper_screen_clear_dirty(screen_impl);
- state
- }
- }
}
impl Drop for Screen {