MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / input_text

Method input_text

source/MaaKWinControlUnit/Input/UInputController.cpp:212–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212bool 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
241bool UInputController::scroll(int dx, int dy)
242{

Callers

nothing calls this directly

Calls 1

ascii_to_evdevFunction · 0.85

Tested by

no test coverage detected