mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 09:16:29 -05:00
Add auto-type {CLEARFIELD} on XCB
This commit is contained in:
parent
28678f4e06
commit
7620395f92
@ -723,6 +723,12 @@ bool AutoTypePlatformX11::keysymModifiers(KeySym keysym, int keycode, unsigned i
|
|||||||
* are set ON, many events will be sent.
|
* are set ON, many events will be sent.
|
||||||
*/
|
*/
|
||||||
void AutoTypePlatformX11::SendKeyPressedEvent(KeySym keysym)
|
void AutoTypePlatformX11::SendKeyPressedEvent(KeySym keysym)
|
||||||
|
{
|
||||||
|
SendKey(keysym,true);
|
||||||
|
SendKey(keysym,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoTypePlatformX11::SendKey(KeySym keysym, bool isKeyDown)
|
||||||
{
|
{
|
||||||
Window cur_focus;
|
Window cur_focus;
|
||||||
int revert_to;
|
int revert_to;
|
||||||
@ -802,8 +808,11 @@ void AutoTypePlatformX11::SendKeyPressedEvent(KeySym keysym)
|
|||||||
|
|
||||||
/* press and release key */
|
/* press and release key */
|
||||||
event.keycode = keycode;
|
event.keycode = keycode;
|
||||||
|
if (isKeyDown) {
|
||||||
SendEvent(&event, KeyPress);
|
SendEvent(&event, KeyPress);
|
||||||
|
} else {
|
||||||
SendEvent(&event, KeyRelease);
|
SendEvent(&event, KeyRelease);
|
||||||
|
}
|
||||||
|
|
||||||
/* release the modifiers */
|
/* release the modifiers */
|
||||||
SendModifier(&event, press_mask, KeyRelease);
|
SendModifier(&event, press_mask, KeyRelease);
|
||||||
@ -840,6 +849,22 @@ void AutoTypeExecutorX11::execKey(AutoTypeKey* action)
|
|||||||
m_platform->SendKeyPressedEvent(m_platform->keyToKeySym(action->key));
|
m_platform->SendKeyPressedEvent(m_platform->keyToKeySym(action->key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoTypeExecutorX11::execClearField(AutoTypeClearField* action = nullptr)
|
||||||
|
{
|
||||||
|
Q_UNUSED(action);
|
||||||
|
|
||||||
|
m_platform->SendKey(XK_Control_L, true);
|
||||||
|
m_platform->SendKeyPressedEvent(XK_a);
|
||||||
|
m_platform->SendKey(XK_Control_L, false);
|
||||||
|
m_platform->SendKeyPressedEvent(XK_Delete);
|
||||||
|
|
||||||
|
timespec ts;
|
||||||
|
ts.tv_sec = 0;
|
||||||
|
ts.tv_nsec = 25 * 1000 * 1000;
|
||||||
|
nanosleep(&ts, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int AutoTypePlatformX11::initialTimeout()
|
int AutoTypePlatformX11::initialTimeout()
|
||||||
{
|
{
|
||||||
return 500;
|
return 500;
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
KeySym keyToKeySym(Qt::Key key);
|
KeySym keyToKeySym(Qt::Key key);
|
||||||
|
|
||||||
void SendKeyPressedEvent(KeySym keysym);
|
void SendKeyPressedEvent(KeySym keysym);
|
||||||
|
void SendKey(KeySym keysym, bool isKeyDown);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void globalShortcutTriggered();
|
void globalShortcutTriggered();
|
||||||
@ -126,6 +127,7 @@ public:
|
|||||||
|
|
||||||
void execChar(AutoTypeChar* action) override;
|
void execChar(AutoTypeChar* action) override;
|
||||||
void execKey(AutoTypeKey* action) override;
|
void execKey(AutoTypeKey* action) override;
|
||||||
|
void execClearField(AutoTypeClearField* action) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AutoTypePlatformX11* const m_platform;
|
AutoTypePlatformX11* const m_platform;
|
||||||
|
Loading…
Reference in New Issue
Block a user