| 988 | } |
| 989 | |
| 990 | bool ManagerService::SendPointerEvent(const std::string& vm_id, |
| 991 | int32_t x, int32_t y, uint32_t buttons) { |
| 992 | std::unique_lock<std::mutex> lock(vms_mutex_, std::try_to_lock); |
| 993 | if (!lock.owns_lock()) return false; |
| 994 | VmRecord* vm = FindVm(vm_id); |
| 995 | if (!vm) return false; |
| 996 | |
| 997 | ipc::Message msg; |
| 998 | msg.channel = ipc::Channel::kInput; |
| 999 | msg.kind = ipc::Kind::kRequest; |
| 1000 | msg.type = "input.pointer_event"; |
| 1001 | msg.vm_id = vm_id; |
| 1002 | msg.request_id = GetTickCount64(); |
| 1003 | msg.fields["x"] = std::to_string(x); |
| 1004 | msg.fields["y"] = std::to_string(y); |
| 1005 | msg.fields["buttons"] = std::to_string(buttons); |
| 1006 | return SendRuntimeMessage(*vm, msg); |
| 1007 | } |
| 1008 | |
| 1009 | bool ManagerService::SendWheelEvent(const std::string& vm_id, int32_t delta) { |
| 1010 | std::unique_lock<std::mutex> lock(vms_mutex_, std::try_to_lock); |