Fix Keycodes in X11

Keycodes are now correctly offset for X11
This commit is contained in:
Ferdinand Schober
2023-12-18 09:52:18 +01:00
parent a6ab109fae
commit 6766886377
2 changed files with 3 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ input capture (to send events *to* other clients) on different operating systems
| Wayland (wlroots) | :heavy_check_mark: | :heavy_check_mark: |
| Wayland (KDE) | :heavy_check_mark: | :heavy_check_mark: |
| Wayland (Gnome) | :heavy_check_mark: | WIP |
| X11 | ( :heavy_check_mark: ) | WIP |
| X11 | :heavy_check_mark: | WIP |
| Windows | ( :heavy_check_mark: ) | WIP |
| MacOS | ( :heavy_check_mark: ) | WIP |

View File

@@ -62,8 +62,7 @@ impl X11Consumer {
#[allow(dead_code)]
fn emulate_key(&self, key: u32, state: u8) {
let _ = key;
let _ = state;
let key = key + 8; // xorg keycodes are shifted by 8
unsafe {
xtest::XTestFakeKeyEvent(self.display, key, state as i32, 0);
}
@@ -99,9 +98,7 @@ impl EventConsumer for X11Consumer {
PointerEvent::Frame {} => {}
},
Event::Keyboard(KeyboardEvent::Key { time: _, key, state }) => {
let _ = key;
let _ = state;
// self.emulate_key(key, state);
self.emulate_key(key, state);
}
_ => {}
}