| 16998 | } |
| 16999 | |
| 17000 | void QKeyMapper_Worker::resendRealKeyCodeOnStop(int rowindex, bool restart, QList<MAP_KEYDATA> *keyMappingDataListForRow, QList<MAP_KEYDATA> *keyMappingDataListToCheck) |
| 17001 | { |
| 17002 | if (pressedRealKeysListRemoveMultiInput.isEmpty()) { |
| 17003 | return; |
| 17004 | } |
| 17005 | |
| 17006 | QList<MAP_KEYDATA> *KeyMappingDataList_ForResend = keyMappingDataListForRow; |
| 17007 | if (KeyMappingDataList_ForResend == Q_NULLPTR) { |
| 17008 | KeyMappingDataList_ForResend = QKeyMapper::KeyMappingDataList; |
| 17009 | |
| 17010 | if (restart && QKeyMapper::lastKeyMappingDataList != Q_NULLPTR) { |
| 17011 | KeyMappingDataList_ForResend = QKeyMapper::lastKeyMappingDataList; |
| 17012 | } |
| 17013 | } |
| 17014 | |
| 17015 | if (KeyMappingDataList_ForResend == Q_NULLPTR) { |
| 17016 | #ifdef DEBUG_LOGOUT_ON |
| 17017 | qWarning() << "[resendRealKeyCodeOnStop] KeyMappingDataList_ForResend is null, skip resend."; |
| 17018 | #endif |
| 17019 | return; |
| 17020 | } |
| 17021 | |
| 17022 | bool hook_proc_stopped = false; |
| 17023 | if (HOOKPROC_STATE_STOPPED == s_AtomicHookProcState |
| 17024 | || HOOKPROC_STATE_STOPPING == s_AtomicHookProcState) { |
| 17025 | hook_proc_stopped = true; |
| 17026 | } |
| 17027 | QStringList pressedRealKeysListToCheck = pressedRealKeysListRemoveMultiInput; |
| 17028 | if (!hook_proc_stopped) { |
| 17029 | QList<MAP_KEYDATA> *KeyMappingDataList_ToCheck = KeyMappingDataList_ForResend; |
| 17030 | if (keyMappingDataListToCheck != Q_NULLPTR) { |
| 17031 | KeyMappingDataList_ToCheck = keyMappingDataListToCheck; |
| 17032 | } |
| 17033 | |
| 17034 | QStringList currentBlockedKeysList = collectCertainMappingDataListBlockedKeysList(KeyMappingDataList_ToCheck); |
| 17035 | for (const QString &blockedKey : std::as_const(currentBlockedKeysList)) { |
| 17036 | pressedRealKeysListToCheck.removeAll(blockedKey); |
| 17037 | } |
| 17038 | |
| 17039 | QStringList pressedRealKeysListToCheckCopy = pressedRealKeysListToCheck; |
| 17040 | for (const QString &realkey : pressedRealKeysListToCheckCopy) { |
| 17041 | int findindex = QKeyMapper::findOriKeyInKeyMappingDataList(realkey, KeyMappingDataList_ToCheck); |
| 17042 | if (findindex >= 0 && !KeyMappingDataList_ToCheck->at(findindex).PassThrough) { |
| 17043 | pressedRealKeysListToCheck.removeAll(realkey); |
| 17044 | } |
| 17045 | } |
| 17046 | } |
| 17047 | |
| 17048 | if (restart) { |
| 17049 | /* resendRealKeyCodeOnStop on mapping restart do not resend mapping tab switch hotkey */ |
| 17050 | QString tabHotkey = QKeyMapper::s_KeyMappingTabInfoList.at(QKeyMapper::s_KeyMappingTabWidgetCurrentIndex).TabHotkey; |
| 17051 | if (tabHotkey.startsWith(PREFIX_PASSTHROUGH)) { |
| 17052 | tabHotkey.remove(0, 1); |
| 17053 | } |
| 17054 | pressedRealKeysListToCheck.removeAll(tabHotkey); |
| 17055 | } |
| 17056 | else { |
| 17057 | /* resendRealKeyCodeOnStop on mapping stop do not resend mapping stop hotkey */ |
nothing calls this directly
no test coverage detected