Add key logging facility

This commit is contained in:
daa
2017-04-03 14:17:06 +03:00
parent 48e2287773
commit e6c3b01cc9
5 changed files with 116 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ pub fn keyval_to_input_string(in_str: &str, in_state: gdk::ModifierType) -> Stri
let mut state = in_state;
let mut input = String::new();
debug!("keyval -> {}", in_str);
// CTRL-^ and CTRL-@ don't work in the normal way.
if state.contains(gdk::CONTROL_MASK) && !state.contains(gdk::SHIFT_MASK) &&
!state.contains(gdk::MOD1_MASK) {

View File

@@ -9,6 +9,9 @@ extern crate pango;
extern crate pangocairo;
extern crate neovim_lib;
extern crate phf;
#[macro_use]
extern crate log;
extern crate env_logger;
mod ui_model;
#[macro_use]
@@ -30,6 +33,8 @@ use ui::SH;
const BIN_PATH_ARG: &'static str = "--nvim-bin-path";
fn main() {
env_logger::init().expect("Can't initialize env_logger");
let app = gtk::Application::new(Some("org.daa.NeovimGtk"), gio::ApplicationFlags::empty())
.expect("Failed to initialize GTK application");

View File

@@ -246,6 +246,7 @@ fn gtk_motion_notify(_: &DrawingArea, ev: &EventMotion) -> Inhibit {
fn gtk_key_press(_: &DrawingArea, ev: &EventKey) -> Inhibit {
if let Some(input) = convert_key(ev) {
SHELL!(shell = {
debug!("nvim_input -> {}", input);
shell.nvim().input(&input).expect("Error run input command to nvim");
shell.cursor.reset_state();
});