MCPcopy Create free account
hub / github.com/Zalafina/QKeyMapper / InterceptionThreadStarted

Method InterceptionThreadStarted

QKeyMapper/interception_worker.cpp:52–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void Interception_Worker::InterceptionThreadStarted()
53{
54#ifdef DEBUG_LOGOUT_ON
55 QString threadIdStr = QString("0x%1").arg(QString::number((qulonglong)QThread::currentThreadId(), 16).toUpper(), 8, '0');
56 qDebug().nospace().noquote() << "[InterceptionThreadStarted] ThreadName:" << QThread::currentThread()->objectName() << ", ThreadID:" << threadIdStr;
57#endif
58
59 if (s_InterceptionContext == Q_NULLPTR) {
60 return;
61 }
62
63 InterceptionDevice device;
64 InterceptionStroke stroke;
65
66 while(s_InterceptLoopbreak == false)
67 {
68 int receive_ret = interception_receive(s_InterceptionContext, device = interception_wait_with_timeout(s_InterceptionContext, 1), &stroke, 1);
69
70 if (s_InterceptLoopbreak) {
71#ifdef DEBUG_LOGOUT_ON
72 qDebug().nospace() << "[KeyInterceptionWorker] Interception Loop Breaked!";
73#endif
74 break;
75 }
76
77 QCoreApplication::processEvents();
78 if (receive_ret <= 0) {
79 continue;
80 }
81
82 if (!s_InterceptStart) {
83 if(interception_is_mouse(device))
84 {
85 lastOperateMouseDevice = device;
86 }
87 else {
88 lastOperateKeyboardDevice = device;
89 }
90#ifdef DEBUG_LOGOUT_ON
91 qDebug().nospace() << "[KeyInterceptionWorker] Intercept is stopped!";
92#endif
93 interception_send(s_InterceptionContext, device, (InterceptionStroke *)&stroke, 1);
94 continue;
95 }
96
97 if(interception_is_mouse(device))
98 {
99 lastOperateMouseDevice = device;
100 int index = device - INTERCEPTION_MOUSE(0);
101 if (MouseDeviceList.at(index).disabled) {
102#ifdef DEBUG_LOGOUT_ON
103 qDebug().nospace() << "[KeyInterceptionWorker] Mouse[" << index << "] is disabled!";
104#endif
105 }
106 else {
107 InterceptionMouseStroke &mstroke = *(InterceptionMouseStroke *) &stroke;
108 mstroke.information = INTERCEPTION_EXTRA_INFO + device;
109 // QKeyMapper_Worker::s_Mouse2vJoy_delta_interception.rx() += mstroke.x;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected