Files
keepassxc/src/autotype/AutoTypeAction.cpp
Toni Spets 4d07507739 Auto-Type: Support multiple Xkb layouts
Completely rewritten XCB Auto-Type keymap system.

 - supports multiple simultaneous layouts
 - prefers current layout if it has all keysyms available
 - removed hardcoded KeySymMap
 - removed clunky custom KeySym emulation

Biggest breaking change is removing KeySym emulation for keys that
do not exist in any of the layouts currently in use. It would be
possible to make it work but if you are trying to type syms that
are not available in any of your layouts you are abusing it. It
also adds unnecessary complexity and opens up timing issues when
the keymap is modified on-the-fly. Now we are just reading it.

This also workarounds a Qt related issue where QX11Info::display()
returns a connection to X server that fails to receive updated
keymap data when client settings change. We use our own connection
now to get it working.
2021-03-26 06:16:37 -04:00

66 lines
1.7 KiB
C++

/*
* Copyright (C) 2021 Team KeePassXC <team@keepassxc.org>
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AutoTypeAction.h"
#include "core/Tools.h"
AutoTypeKey::AutoTypeKey(Qt::Key key, Qt::KeyboardModifiers modifiers)
: key(key)
, modifiers(modifiers)
{
}
AutoTypeKey::AutoTypeKey(const QChar& character, Qt::KeyboardModifiers modifiers)
: character(character)
, modifiers(modifiers)
{
}
void AutoTypeKey::exec(AutoTypeExecutor* executor) const
{
executor->execType(this);
}
AutoTypeDelay::AutoTypeDelay(int delayMs, bool setExecDelay)
: delayMs(delayMs)
, setExecDelay(setExecDelay)
{
}
void AutoTypeDelay::exec(AutoTypeExecutor* executor) const
{
if (setExecDelay) {
// Change the delay between actions
executor->execDelayMs = delayMs;
} else {
// Pause execution
Tools::wait(delayMs);
}
}
void AutoTypeClearField::exec(AutoTypeExecutor* executor) const
{
executor->execClearField(this);
}
void AutoTypeBegin::exec(AutoTypeExecutor* executor) const
{
executor->execBegin(this);
}