mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-07-02 03:51:33 +08:00
[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:
@@ -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
|
||||
Reference in New Issue
Block a user