| 324 | } |
| 325 | |
| 326 | void PluginNetEventRouter::ProcessKeyboardEvent(std::shared_ptr<Message>&& msg) { |
| 327 | bool global_events = settings_->app_.event_replay_mode_ == TargetApplication::EventReplayMode::kGlobal; |
| 328 | if (global_events) { |
| 329 | if (settings_->can_be_operated_) { |
| 330 | //win_event_replayer_->HandleMessage(msg); |
| 331 | } |
| 332 | } else { |
| 333 | // 1. convert to ipc message |
| 334 | const auto& key_event = msg->key_event(); |
| 335 | auto hwnd = this->app_->GetAppManager()->GetWindowHandle(); |
| 336 | auto hwnd_ptr = reinterpret_cast<uint64_t>(hwnd); |
| 337 | |
| 338 | auto keyboard_msg = CaptureMessageMaker::MakeKeyboardEventMessage(hwnd_ptr, key_event.key_code(), key_event.down(), |
| 339 | key_event.num_lock_status(), key_event.caps_lock_status()); |
| 340 | auto msg_str = CaptureMessageMaker::ConvertMessageToString(keyboard_msg); |
| 341 | // 2. post it |
| 342 | PostIpcMessage(msg_str); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | void PluginNetEventRouter::PostIpcMessage(const std::string& msg) { |
| 347 | auto task_msg = AppMessageMaker::MakeTaskMessage([=, this]() mutable { |
nothing calls this directly
no test coverage detected