[fix] release keyboard hook after remote control disconnects, refs #23

This commit is contained in:
dijunkun
2025-11-21 00:08:14 +08:00
parent 5d0a4d1385
commit f94ef49210
4 changed files with 31 additions and 1 deletions

View File

@@ -51,7 +51,16 @@ int KeyboardCapturer::Hook(OnKeyAction on_key_action, void* user_ptr) {
}
int KeyboardCapturer::Unhook() {
g_on_key_action = nullptr;
g_user_ptr = nullptr;
running_ = false;
if (display_) {
XSelectInput(display_, DefaultRootWindow(display_), 0);
XFlush(display_);
}
return 0;
}