MCPcopy Create free account
hub / github.com/Zalafina/QKeyMapper / detectDisplaySwitchKey

Method detectDisplaySwitchKey

QKeyMapper/qkeymapper_worker.cpp:16250–16299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16248}
16249
16250bool QKeyMapper_Worker::detectDisplaySwitchKey(const QString &keycodeString, int keyupdown)
16251{
16252 bool detected = false;
16253 bool passthrough = false;
16254 QString displayswitchKey = QKeyMapper::s_WindowSwitchKeyString;
16255 if (displayswitchKey.startsWith(PREFIX_PASSTHROUGH)) {
16256 passthrough = true;
16257 displayswitchKey.remove(0, 1);
16258 }
16259 QStringList keys = displayswitchKey.split(SEPARATOR_PLUS);
16260 bool allKeysPressed = true;
16261 bool combinationKey = (keys.size() > 1) ? true : false;
16262 QList<int> pressedCombinationRealKeysOrder;
16263
16264 for (const QString &key : std::as_const(keys))
16265 {
16266 int index = pressedRealKeysListRemoveMultiInput.indexOf(key);
16267 if (index < 0)
16268 {
16269 allKeysPressed = false;
16270 break;
16271 }
16272 else {
16273 pressedCombinationRealKeysOrder.append(index);
16274 }
16275 }
16276
16277 if (combinationKey) {
16278 bool keyorder_increasing = isKeyOrderIncreasing(pressedCombinationRealKeysOrder);
16279 if (!keyorder_increasing) {
16280 allKeysPressed = false;
16281 }
16282 }
16283
16284 if (KEY_DOWN == keyupdown && allKeysPressed && displayswitchKey.contains(keycodeString))
16285 {
16286#ifdef DEBUG_LOGOUT_ON
16287 qDebug() << "[detectDisplaySwitchKey]" << "DisplaySwitchKey Activated ->" << displayswitchKey;
16288#endif
16289 emit QKeyMapper::getInstance()->HotKeyDisplaySwitchActivated_Signal(displayswitchKey);
16290 if (passthrough) {
16291 detected = false;
16292 }
16293 else {
16294 detected = true;
16295 }
16296 }
16297
16298 return detected;
16299}
16300
16301bool QKeyMapper_Worker::detectMappingSwitchKey(const QString &keycodeString, int keyupdown)
16302{

Callers

nothing calls this directly

Calls 3

removeMethod · 0.80
sizeMethod · 0.80
containsMethod · 0.80

Tested by

no test coverage detected