aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-04-27 04:07:58 -0400
committerJesse Luehrs <doy@tozt.net>2016-04-27 04:07:58 -0400
commit61df526acf4687b6b393b1e6c435e613a5dc7db3 (patch)
tree55d71e5f160bb03129cd948f2cb2434f2ed65cfb
parentcf1692f0950329279b8b4d9d3d8cc46f974c496e (diff)
downloadvt100-rust-61df526acf4687b6b393b1e6c435e613a5dc7db3.tar.gz
vt100-rust-61df526acf4687b6b393b1e6c435e613a5dc7db3.zip
add most of the rest of the basic screen accessors
-rw-r--r--src/ffi.c40
-rw-r--r--src/ffi.rs8
-rw-r--r--src/screen.rs56
3 files changed, 104 insertions, 0 deletions
diff --git a/src/ffi.c b/src/ffi.c
index ac52f92..455d84f 100644
--- a/src/ffi.c
+++ b/src/ffi.c
@@ -1,6 +1,46 @@
#include <stdlib.h>
#include "../libvt100/src/vt100.h"
+int vt100_wrapper_screen_hide_cursor(struct vt100_screen *screen)
+{
+ return screen->hide_cursor;
+}
+
+int vt100_wrapper_screen_application_keypad(struct vt100_screen *screen)
+{
+ return screen->application_keypad;
+}
+
+int vt100_wrapper_screen_application_cursor(struct vt100_screen *screen)
+{
+ return screen->application_cursor;
+}
+
+int vt100_wrapper_screen_mouse_reporting_press(struct vt100_screen *screen)
+{
+ return screen->mouse_reporting_press;
+}
+
+int vt100_wrapper_screen_mouse_reporting_press_release(struct vt100_screen *screen)
+{
+ return screen->mouse_reporting_press_release;
+}
+
+int vt100_wrapper_screen_mouse_reporting_button_motion(struct vt100_screen *screen)
+{
+ return screen->mouse_reporting_button_motion;
+}
+
+int vt100_wrapper_screen_mouse_reporting_sgr_mode(struct vt100_screen *screen)
+{
+ return screen->mouse_reporting_sgr_mode;
+}
+
+int vt100_wrapper_screen_bracketed_paste(struct vt100_screen *screen)
+{
+ return screen->bracketed_paste;
+}
+
int vt100_wrapper_cell_is_wide(struct vt100_cell *cell)
{
return cell->is_wide;
diff --git a/src/ffi.rs b/src/ffi.rs
index daab278..a939c0d 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -38,6 +38,14 @@ extern "C" {
col: libc::c_int,
) -> *mut types::CellImpl;
+ pub fn vt100_wrapper_screen_hide_cursor(screen: *mut types::ScreenImpl) -> libc::c_int;
+ pub fn vt100_wrapper_screen_application_keypad(screen: *mut types::ScreenImpl) -> libc::c_int;
+ pub fn vt100_wrapper_screen_application_cursor(screen: *mut types::ScreenImpl) -> libc::c_int;
+ pub fn vt100_wrapper_screen_mouse_reporting_press(screen: *mut types::ScreenImpl) -> libc::c_int;
+ pub fn vt100_wrapper_screen_mouse_reporting_press_release(screen: *mut types::ScreenImpl) -> libc::c_int;
+ pub fn vt100_wrapper_screen_mouse_reporting_button_motion(screen: *mut types::ScreenImpl) -> libc::c_int;
+ pub fn vt100_wrapper_screen_mouse_reporting_sgr_mode(screen: *mut types::ScreenImpl) -> libc::c_int;
+ pub fn vt100_wrapper_screen_bracketed_paste(screen: *mut types::ScreenImpl) -> libc::c_int;
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;
diff --git a/src/screen.rs b/src/screen.rs
index 4205451..2251506 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -235,6 +235,62 @@ impl Screen {
ffi::vt100_wrapper_cell_attrs_inverse(&mut (*prefix).attrs) != 0
}
}
+
+ pub fn hide_cursor(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_hide_cursor(screen_impl) != 0
+ }
+ }
+
+ pub fn application_keypad(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_application_keypad(screen_impl) != 0
+ }
+ }
+
+ pub fn application_cursor(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_application_cursor(screen_impl) != 0
+ }
+ }
+
+ pub fn mouse_reporting_press(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_mouse_reporting_press(screen_impl) != 0
+ }
+ }
+
+ pub fn mouse_reporting_press_release(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_mouse_reporting_press_release(screen_impl) != 0
+ }
+ }
+
+ pub fn mouse_reporting_button_motion(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_mouse_reporting_button_motion(screen_impl) != 0
+ }
+ }
+
+ pub fn mouse_reporting_sgr_mode(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_mouse_reporting_sgr_mode(screen_impl) != 0
+ }
+ }
+
+ pub fn bracketed_paste(&self) -> bool {
+ let Screen(screen_impl) = *self;
+ unsafe {
+ ffi::vt100_wrapper_screen_bracketed_paste(screen_impl) != 0
+ }
+ }
}
impl Drop for Screen {