Skip to content

Commit

Permalink
Update README.md, bump version and some minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Animeshz committed Jan 5, 2021
1 parent 852152f commit 1dbe0d2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Following are the future plans for the project:
, [How to solve missing javah in Java 10 – ugly way](https://www.owsiak.org/how-to-solve-missing-javah-ugly-way)
- [X] Implement way to cross compile the C/C++ library from any OS to any OS and then package it up in the resulting
Jar. Done with PR [#4](https://github.com/Animeshz/keyboard-mouse-kt/pull/4).
- [X] (Complete for Windows x64 currently) Implement JNI each for different platforms. I've considered it to do via C++ instead of reusing Kotlin/Native because
- [X] (Complete for Windows x64 and Linux x64 currently) Implement JNI each for different platforms. I've considered it to do via C++ instead of reusing Kotlin/Native because
it will result in low performance and maybe huge sizes (if K/N becomes stable and performance wise equivalent we can
directly reuse the sources we've written).
- Add Linux Device (`/dev/uinput` | `/dev/input/xxx`) based implementation of interaction of Keyboard/Mouse as a
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ know more!
- [ ] MacOS
- [ ] JVM
- [X] Windows x86_64 (64 bit)
- [ ] Windows x86 (32 bit)
- [ ] Linux x86_64 (64 bit)
- [X] Windows x86 (32 bit)
- [X] Linux x86_64 (64 bit)
- [ ] Linux x86 (32 bit)
- [ ] Linux Arm32
- [ ] Linux Arm64
- [ ] Mouse
- [ ] Windows
- [ ] Linux
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

allprojects {
this.group = "com.github.animeshz"
this.version = "0.1.1"
this.version = "0.1.2"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion keyboard/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fun KotlinMultiplatformExtension.configureJvm() {
"cd \$WORK_DIR/project/build/tmp/compile-jni-${target.os}-${target.arch} && " +
"cmake \$WORK_DIR/project/src/jvmMain/jni/${target.os}-${target.arch} && " +
"cmake --build . --config Release && " +
"cp -rf libKeyboardKt${target.arch}.{dll,so,dylib} \$WORK_DIR/project/build/jni 2>/dev/null || : &&" +
"cp -rf libKeyboardKt${target.arch}.{dll,so,dylib} \$WORK_DIR/project/build/jni 2>/dev/null || : && " +
"cd .. && rm -rf compile-jni-${target.os}-${target.arch}"
)
println(args.joinToString(" "))
Expand Down
6 changes: 4 additions & 2 deletions keyboard/src/jvmMain/jni/linux-x64/X11KeyboardHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ class X11KeyboardHandler : BaseKeyboardHandler {
int mask = isPressed ? KeyPressMask : KeyReleaseMask;

XGetInputFocus(display, &focusedWindow, &focusRevert);

XKeyEvent event;
memset(&event, 0, sizeof(XKeyEvent));
event.keycode = scanCode + 8;
event.type = isPressed ? KeyPress : KeyRelease;
event.root = focusedWindow;
event.display = display;

XSendEvent(display, focusedWindow, 1, mask, (XEvent *)&event);
XFlush(display);
XSync(display, 0);
}

bool isPressed(int scanCode) {
Expand Down Expand Up @@ -165,4 +167,4 @@ class X11KeyboardHandler : BaseKeyboardHandler {
XSendEvent(display, XDefaultRootWindow(display), 0, 0, (XEvent *)&dummyEvent);
XFlush(display);
}
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal class X11KeyboardHandler(x11: COpaquePointer, xInput2: COpaquePointer)
}

XSendEvent(display, focusedWindow.value, 1, mask, event.ptr.reinterpret())
XFlush(display)
XSync(display, 0)
}
}

Expand Down

0 comments on commit 1dbe0d2

Please sign in to comment.