[fix] move keyboard capturer to a background thread and use poll-based X11 event handling to avoid main-thread blocking

This commit is contained in:
dijunkun
2026-03-20 14:56:40 +08:00
parent 38b7775b1b
commit 262af263f2
2 changed files with 75 additions and 14 deletions
@@ -11,6 +11,9 @@
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>
#include <atomic>
#include <thread>
#include "device_controller.h"
namespace crossdesk {
@@ -28,7 +31,8 @@ class KeyboardCapturer : public DeviceController {
private:
Display* display_;
Window root_;
bool running_;
std::atomic<bool> running_;
std::thread event_thread_;
};
} // namespace crossdesk
#endif