change timeings, reduced logging
This commit is contained in:
parent
7faf7dfc29
commit
0151c34bd2
|
@ -27,6 +27,8 @@
|
|||
#include <cstring>
|
||||
|
||||
|
||||
#include <thread>
|
||||
|
||||
|
||||
XInputSimulatorImplLinux::XInputSimulatorImplLinux()
|
||||
{
|
||||
|
@ -156,44 +158,39 @@ void XInputSimulatorImplLinux::keyUp(int key)
|
|||
|
||||
void XInputSimulatorImplLinux::keyClick(int key)
|
||||
{
|
||||
std::cout << "key click: " << key << std::endl;
|
||||
|
||||
this->keyDown(key);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(25));
|
||||
this->keyUp(key);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(36));
|
||||
}
|
||||
|
||||
int XInputSimulatorImplLinux::charToKeyCode(char key_char)
|
||||
{
|
||||
std::cout << "cchar: " << (int)key_char << std::endl;
|
||||
// std::cout << "cchar: " << (int)key_char << std::endl;
|
||||
|
||||
int keyCode = XKeysymToKeycode(display, key_char);
|
||||
// int keyCode = XKeysymToKeycode(display, XStringToKeysym(&key_char));
|
||||
std::cout << "ccode: " << keyCode << std::endl;
|
||||
// std::cout << "ccode: " << keyCode << std::endl;
|
||||
|
||||
return keyCode;
|
||||
}
|
||||
void XInputSimulatorImplLinux::keySequence(const std::string &sequence)
|
||||
{
|
||||
std::cout << "key seq: " << sequence << std::endl;
|
||||
|
||||
for(const char c : sequence) {
|
||||
std::cout << "cahr: " << c << std::endl;
|
||||
int keyCode = this->charToKeyCode(c);
|
||||
std::cout << "key code: " << keyCode << std::endl;
|
||||
|
||||
if (isupper(c)) {
|
||||
std::cout << "upper " << c << std::endl;
|
||||
|
||||
this->keyDown(XKeysymToKeycode(display, XK_Shift_L));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(42));
|
||||
this->keyClick(keyCode);
|
||||
|
||||
this->keyUp(XKeysymToKeycode(display, XK_Shift_L));
|
||||
}
|
||||
else {
|
||||
this->keyClick(keyCode);
|
||||
}
|
||||
|
||||
|
||||
std::cout << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(35));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue