| 1078 | } |
| 1079 | |
| 1080 | bool MessageInput::input_text(const std::string& text) |
| 1081 | { |
| 1082 | LogInfo << VAR(config_.mode) << VAR(config_.with_cursor_pos) << VAR(config_.with_window_pos) << VAR(text); |
| 1083 | |
| 1084 | if (!hwnd_) { |
| 1085 | LogError << VAR(config_.mode) << VAR(config_.with_cursor_pos) << VAR(config_.with_window_pos) << "hwnd_ is nullptr"; |
| 1086 | return false; |
| 1087 | } |
| 1088 | |
| 1089 | HWND target = send_activate(); |
| 1090 | |
| 1091 | bool success = true; |
| 1092 | |
| 1093 | for (const auto ch : to_u16(text)) { |
| 1094 | success &= send_or_post_w(target, WM_CHAR, static_cast<WPARAM>(ch), 0); |
| 1095 | std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
| 1096 | } |
| 1097 | return success; |
| 1098 | } |
| 1099 | |
| 1100 | bool MessageInput::key_down(int key) |
| 1101 | { |
nothing calls this directly
no outgoing calls
no test coverage detected