| 50 | } |
| 51 | |
| 52 | void 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; |
nothing calls this directly
no outgoing calls
no test coverage detected