From 61df526acf4687b6b393b1e6c435e613a5dc7db3 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 27 Apr 2016 04:07:58 -0400 Subject: add most of the rest of the basic screen accessors --- src/ffi.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/ffi.rs | 8 ++++++++ src/screen.rs | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) 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 #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 { -- cgit v1.2.3