| 210 | } |
| 211 | |
| 212 | bool UInputController::input_text(const std::string& str) |
| 213 | { |
| 214 | LogDebug << VAR(str); |
| 215 | |
| 216 | for (const auto ch : str) { |
| 217 | auto [key, need_shift] = ascii_to_evdev(ch); |
| 218 | if (need_shift) { |
| 219 | if (!key_down(KEY_LEFTSHIFT)) { |
| 220 | return false; |
| 221 | } |
| 222 | } |
| 223 | if (!key_down(key)) { |
| 224 | return false; |
| 225 | } |
| 226 | std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
| 227 | if (!key_up(key)) { |
| 228 | return false; |
| 229 | } |
| 230 | if (need_shift) { |
| 231 | if (!key_up(KEY_LEFTSHIFT)) { |
| 232 | return false; |
| 233 | } |
| 234 | } |
| 235 | std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
| 236 | } |
| 237 | |
| 238 | return true; |
| 239 | } |
| 240 | |
| 241 | bool UInputController::scroll(int dx, int dy) |
| 242 | { |
nothing calls this directly
no test coverage detected