| 121 | |
| 122 | ThreadQueue inputQueue; |
| 123 | bool _stdcall InputHook::InputProc(BYTE key, bool press, POINT cursor, PULONG_PTR param) |
| 124 | { |
| 125 | // is self |
| 126 | if (*param == Qi::key_info) |
| 127 | { |
| 128 | *param = 0; |
| 129 | return false; |
| 130 | } |
| 131 | // key |
| 132 | else if (key) |
| 133 | { |
| 134 | if (press) |
| 135 | { |
| 136 | if (!Qi::keyState[key]) |
| 137 | { |
| 138 | Qi::keyState[key] = press; |
| 139 | inputQueue.enqueue(InputTask, key, press, cursor, KeyState(Qi::keyState)); |
| 140 | } |
| 141 | } |
| 142 | else |
| 143 | { |
| 144 | Qi::keyState[key] = press; |
| 145 | inputQueue.enqueue(InputTask, key, press, cursor, KeyState(Qi::keyState)); |
| 146 | } |
| 147 | // block |
| 148 | if (Qi::run && Qi::keyBlock[key]) return true; |
| 149 | } |
| 150 | // cursor |
| 151 | else |
| 152 | { |
| 153 | if (Qi::recording) inputQueue.enqueue(InputTask, 0, 0, cursor, KeyState(Qi::keyState)); |
| 154 | // block |
| 155 | if (Qi::run && (Qi::curBlock > 0 || Qi::keyBlock[0])) return true; |
| 156 | } |
| 157 | return false; |
| 158 | } |