Skip to content

Commit

Permalink
Get ready for packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethloeffler committed Jun 8, 2021
1 parent c7e8297 commit 9044c7a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
Cargo.lock
.cargo
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
[package]
name = "innerput"
version = "0.0.0"
description = "Simulate keyboard input on Windows"
authors = ["Kenneth Loeffler <[email protected]>"]
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" ]}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 7 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ pub enum Key {
Super,
}

pub trait Keyboard<ErrorType> {
mod private {
pub trait Sealed {}

impl Sealed for super::Innerput {}
}

pub trait Keyboard<ErrorType>: private::Sealed {
fn send_chord(&self, keys: &[Key], process: &process::Child) -> Result<(), ErrorType>;
}
2 changes: 2 additions & 0 deletions src/win32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ impl Innerput {
}

impl Keyboard<Error> 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)?;

Expand Down

0 comments on commit 9044c7a

Please sign in to comment.