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