diff --git a/.gitignore b/.gitignore index 96ef6c0..35e6e2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target Cargo.lock +.cargo diff --git a/Cargo.toml b/Cargo.toml index fad416b..bed20b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,17 @@ [package] name = "innerput" -version = "0.0.0" +description = "Simulate keyboard input on Windows" authors = ["Kenneth Loeffler "] +version = "0.0.1" +homepage = "https://github.com/kennethloeffler/innerput" +repository = "https://github.com/kennethloeffler/innerput.git" +documentation = "https://docs.rs/innerput" +readme = "README.md" +license = "MIT" edition = "2018" [dependencies] thiserror = "1.0.24" + +[target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", features = [ "impl-default", "winuser", "processthreadsapi" ]} \ No newline at end of file diff --git a/README.md b/README.md index 0fd25f4..dd4db9c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Innerput -Innerput is a library that sends keyboard input to a desired application. It was [purpose-built for a program the rbx-dom crate](https://github.com/rojo-rbx/rbx-dom/pull/181#issuecomment-855307470). As such, it lacks many, many features, its documentation is sparse to non-existent, and it only supports Windows. +Innerput is a library that sends keyboard input to a desired application. It was [purpose-built for a program in rbx-dom](https://github.com/rojo-rbx/rbx-dom/pull/181#issuecomment-855307470). As such, it lacks many, many features, its documentation is sparse to non-existent, and it only supports Windows. diff --git a/src/lib.rs b/src/lib.rs index b017013..c97bf1c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,6 +26,12 @@ pub enum Key { Super, } -pub trait Keyboard { +mod private { + pub trait Sealed {} + + impl Sealed for super::Innerput {} +} + +pub trait Keyboard: private::Sealed { fn send_chord(&self, keys: &[Key], process: &process::Child) -> Result<(), ErrorType>; } diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 643598a..4dd4b8b 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -33,6 +33,8 @@ impl Innerput { } impl Keyboard for Innerput { + /// Sends a key chord to the child process. All the keys are pressed before + /// being released. fn send_chord(&self, keys: &[Key], process: &process::Child) -> Result<(), Error> { window::activate_top_level_window(process)?;