mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-17 10:31:30 +03:00
add cargo fmt + cargo clippy to rust workflow
This commit is contained in:
12
.github/workflows/rust.yml
vendored
12
.github/workflows/rust.yml
vendored
@@ -25,6 +25,10 @@ jobs:
|
|||||||
run: cargo build --verbose
|
run: cargo build --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
- name: Check Formatting
|
||||||
|
run: cargo fmt --check
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo clippy --all-features --all-targets -- --deny warnings
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
@@ -41,6 +45,10 @@ jobs:
|
|||||||
run: cargo build --verbose
|
run: cargo build --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
- name: Check Formatting
|
||||||
|
run: cargo fmt --check
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo clippy --all-features --all-targets -- --deny warnings
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
@@ -57,6 +65,10 @@ jobs:
|
|||||||
run: cargo build --verbose
|
run: cargo build --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
- name: Check Formatting
|
||||||
|
run: cargo fmt --check
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo clippy --all-features --all-targets -- --deny warnings
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct DummyConsumer;
|
pub struct DummyConsumer;
|
||||||
|
|
||||||
impl DummyConsumer {
|
impl DummyConsumer {
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
|
use crate::{
|
||||||
|
consumer::EventConsumer,
|
||||||
|
event::{KeyboardEvent, PointerEvent},
|
||||||
|
scancode,
|
||||||
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use crate::{consumer::EventConsumer, event::{KeyboardEvent, PointerEvent}, scancode};
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use winapi::um::winuser::{KEYEVENTF_EXTENDEDKEY, SendInput};
|
use winapi::um::winuser::{SendInput, KEYEVENTF_EXTENDEDKEY};
|
||||||
use winapi::{
|
use winapi::{
|
||||||
self,
|
self,
|
||||||
um::winuser::{
|
um::winuser::{
|
||||||
@@ -179,7 +183,7 @@ fn linux_keycode_to_windows_scancode(linux_keycode: u32) -> Option<u16> {
|
|||||||
Err(_) => {
|
Err(_) => {
|
||||||
log::warn!("unknown keycode: {linux_keycode}");
|
log::warn!("unknown keycode: {linux_keycode}");
|
||||||
return None;
|
return None;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
log::trace!("linux code: {linux_scancode:?}");
|
log::trace!("linux code: {linux_scancode:?}");
|
||||||
let windows_scancode = match scancode::Windows::try_from(linux_scancode) {
|
let windows_scancode = match scancode::Windows::try_from(linux_scancode) {
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ impl X11Consumer {
|
|||||||
BTN_MIDDLE => 2,
|
BTN_MIDDLE => 2,
|
||||||
BTN_BACK => 8,
|
BTN_BACK => 8,
|
||||||
BTN_FORWARD => 9,
|
BTN_FORWARD => 9,
|
||||||
BTN_LEFT | _ => 1,
|
BTN_LEFT => 1,
|
||||||
|
_ => 1,
|
||||||
};
|
};
|
||||||
xtest::XTestFakeButtonEvent(self.display, x11_button, state as i32, 0);
|
xtest::XTestFakeButtonEvent(self.display, x11_button, state as i32, 0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub struct X11Producer {}
|
|||||||
|
|
||||||
impl X11Producer {
|
impl X11Producer {
|
||||||
pub fn new() -> Result<Self> {
|
pub fn new() -> Result<Self> {
|
||||||
return Err(anyhow!("not implemented"));
|
Err(anyhow!("not implemented"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ pub enum Linux {
|
|||||||
KeyBrightnessAuto = 244, /* Set Auto Brightness: manual, brightness control is off, rely on ambient */
|
KeyBrightnessAuto = 244, /* Set Auto Brightness: manual, brightness control is off, rely on ambient */
|
||||||
// KEY_BRIGHTNESS_ZERO=KeyBrightnessAuto,
|
// KEY_BRIGHTNESS_ZERO=KeyBrightnessAuto,
|
||||||
KeyDisplayOff = 245, /* display device to off state */
|
KeyDisplayOff = 245, /* display device to off state */
|
||||||
KeyWwan = 246, /* Wireless WAN (LTE, UMTS, GSM, etc.) */
|
KeyWwan = 246, /* Wireless WAN (LTE, UMTS, GSM, etc.) */
|
||||||
// KEY_WIMAX = KeyWwan,
|
// KEY_WIMAX = KeyWwan,
|
||||||
KeyRfkill = 247, /* Key that controls all radios */
|
KeyRfkill = 247, /* Key that controls all radios */
|
||||||
KeyMicmute = 248, /* Mute / unmute the microphone */
|
KeyMicmute = 248, /* Mute / unmute the microphone */
|
||||||
@@ -528,13 +528,13 @@ impl TryFrom<Linux> for Windows {
|
|||||||
Linux::KeyKp0 => Ok(Self::Keypad0Insert),
|
Linux::KeyKp0 => Ok(Self::Keypad0Insert),
|
||||||
Linux::KeyKpDot => Ok(Self::KeypadDot),
|
Linux::KeyKpDot => Ok(Self::KeypadDot),
|
||||||
Linux::KeyZenkakuhankaku => Ok(Self::KeyLANG1), // TODO unsure
|
Linux::KeyZenkakuhankaku => Ok(Self::KeyLANG1), // TODO unsure
|
||||||
Linux::Key102nd => Ok(Self::KeyNonUSSlashBar), // TODO unsure
|
Linux::Key102nd => Ok(Self::KeyNonUSSlashBar), // TODO unsure
|
||||||
Linux::KeyF11 => Ok(Self::KeyF11),
|
Linux::KeyF11 => Ok(Self::KeyF11),
|
||||||
Linux::KeyF12 => Ok(Self::KeyF12),
|
Linux::KeyF12 => Ok(Self::KeyF12),
|
||||||
Linux::KeyRo => Ok(Self::ErrorRollOver), // TODO unsure
|
Linux::KeyRo => Ok(Self::ErrorRollOver), // TODO unsure
|
||||||
Linux::KeyKatakana => Ok(Self::KeyLANG1), // TODO unsure
|
Linux::KeyKatakana => Ok(Self::KeyLANG1), // TODO unsure
|
||||||
Linux::KeyHiragana => Ok(Self::KeyLANG2), // TODO unsure
|
Linux::KeyHiragana => Ok(Self::KeyLANG2), // TODO unsure
|
||||||
Linux::KeyHenkan => Ok(Self::KeyLANG3), // TODO unsure
|
Linux::KeyHenkan => Ok(Self::KeyLANG3), // TODO unsure
|
||||||
Linux::KeyKatakanahiragana => Ok(Self::KeyLANG4), // TODO unsure
|
Linux::KeyKatakanahiragana => Ok(Self::KeyLANG4), // TODO unsure
|
||||||
Linux::KeyMuhenkan => Ok(Self::KeyLANG4), // TODO unsure
|
Linux::KeyMuhenkan => Ok(Self::KeyLANG4), // TODO unsure
|
||||||
Linux::KeyKpJpComma => Ok(Self::KeypadComma),
|
Linux::KeyKpJpComma => Ok(Self::KeypadComma),
|
||||||
@@ -565,8 +565,8 @@ impl TryFrom<Linux> for Windows {
|
|||||||
Linux::KeyScale => Err(()), // TODO
|
Linux::KeyScale => Err(()), // TODO
|
||||||
Linux::KeyKpcomma => Ok(Self::KeypadComma),
|
Linux::KeyKpcomma => Ok(Self::KeypadComma),
|
||||||
Linux::KeyHangeul => Ok(Self::KeyInternational1), // TODO unsure
|
Linux::KeyHangeul => Ok(Self::KeyInternational1), // TODO unsure
|
||||||
Linux::KeyHanja => Ok(Self::KeyInternational2), // TODO unsure
|
Linux::KeyHanja => Ok(Self::KeyInternational2), // TODO unsure
|
||||||
Linux::KeyYen => Ok(Self::KeyInternational3), // TODO unsure
|
Linux::KeyYen => Ok(Self::KeyInternational3), // TODO unsure
|
||||||
Linux::KeyLeftmeta => Ok(Self::KeyLeftGUI),
|
Linux::KeyLeftmeta => Ok(Self::KeyLeftGUI),
|
||||||
Linux::KeyRightmeta => Ok(Self::KeyRightGUI),
|
Linux::KeyRightmeta => Ok(Self::KeyRightGUI),
|
||||||
Linux::KeyCompose => Ok(Self::KeyApplication),
|
Linux::KeyCompose => Ok(Self::KeyApplication),
|
||||||
@@ -695,4 +695,4 @@ impl TryFrom<Linux> for Windows {
|
|||||||
Linux::Invalid5 => Err(()),
|
Linux::Invalid5 => Err(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user