Compositor-agnostic trigger parsing and modifier checking. More...
Functions | |
| bool | checkModifier (int modifierSetting, Qt::KeyboardModifiers mods) |
| Map DragModifier enum value to Qt modifier flags. | |
| Qt::KeyboardModifiers | modifierMaskFor (int modifierSetting) |
| The Qt modifier mask a DragModifier enumerator stands for. | |
| bool | exactModifierMatch (int modifierSetting, Qt::KeyboardModifiers mods) |
Whether mods is EXACTLY the combination modifierSetting names. | |
| bool | anyTriggerHeldExact (const QVector< ParsedTrigger > &triggers, Qt::KeyboardModifiers mods, Qt::MouseButtons mouseButtons) |
| Whether any trigger matches the current state exactly on MODIFIERS. | |
| bool | anyTriggerHeld (const QVector< ParsedTrigger > &triggers, Qt::KeyboardModifiers mods, Qt::MouseButtons mouseButtons) |
| Check if any parsed trigger is currently held. | |
| PHOSPHORCOMPOSITOR_EXPORT QVector< ParsedTrigger > | parseTriggers (const QVariant &triggerVariant, const QString &modifierFieldName, const QString &mouseButtonFieldName) |
| Parse trigger list from D-Bus QVariantList (handles QDBusArgument wrapping) | |
Compositor-agnostic trigger parsing and modifier checking.
Used by all compositor plugins to parse activation triggers from D-Bus and check if the current modifier/button state matches any trigger.
|
inline |
Check if any parsed trigger is currently held.
| triggers | Pre-parsed trigger list |
| mods | Current keyboard modifier state |
| mouseButtons | Current mouse button state |
|
inline |
Whether any trigger matches the current state exactly on MODIFIERS.
The strict peer of anyTriggerHeld, for consumers whose chords must not shadow one another (the scrolling wheel chords). Nothing distinguishes these triggers from drag triggers in storage — a trigger list is a trigger list — so the caller decides which matcher a list is read with, and it decides that by which SETTING the list came from.
Exact on modifiers, SUBSET on buttons, and the asymmetry is deliberate rather than an oversight: a trigger naming no button matches with any buttons held, so wheeling while a button happens to be down still works. The cost is that the shadowing this matcher prevents on the modifier axis survives on the button axis — a modifier-only chord swallows events meant for the same modifier plus a button. Callers that care should offer modifiers only, which is what the scroll-key rows do.
DragModifier::AlwaysActive does NOT survive this matcher's semantics: modifierMaskFor has no case for it, so it folds to Qt::NoModifier and the entry comes to mean "only when nothing is held". Lists read with this matcher are validated by canonicalWheelTriggerList, which drops it.
A trigger with neither modifier nor button is skipped here as it is in anyTriggerHeld: an all-zero entry is malformed config, and honouring it would hand the consumer every unmodified event in the session.
|
inline |
Map DragModifier enum value to Qt modifier flags.
The single table. WindowDragAdaptor::checkModifier() in the daemon used to carry a hand-synced copy and now delegates here, so a new enumerator is added in one place. The enum values are defined in src/core/types/enums.h (DragModifier), whose MaxDragModifier is the authority on the last valid one.
|
inline |
Whether mods is EXACTLY the combination modifierSetting names.
checkModifier is deliberately subset-matching: a drag with Meta+Shift held satisfies a Meta trigger, because holding an extra key should not cancel an in-progress drag gesture. Wheel chords need the opposite. Two scroll keys that differ only by one extra modifier (the stock Meta / Meta+Shift pair) are DISTINCT verbs, and under subset matching the shorter one would swallow every event meant for the longer, making the longer binding unreachable. Extra modifiers therefore mean "not this chord" here.
Only the four chord modifiers are compared. Keypad, group-switch and lock modifiers ride along on real events and are not bindable, so folding them into the comparison would make a chord fail under Num Lock.
|
inline |
The Qt modifier mask a DragModifier enumerator stands for.
The inverse of the checkModifier table, and it must stay in step with it. Disabled and AlwaysActive both map to "no modifiers": neither names a key combination, so neither has a mask, and callers gate on the enumerator before asking.
| PHOSPHORCOMPOSITOR_EXPORT QVector< ParsedTrigger > PhosphorCompositor::TriggerParser::parseTriggers | ( | const QVariant & | triggerVariant, |
| const QString & | modifierFieldName, | ||
| const QString & | mouseButtonFieldName | ||
| ) |
Parse trigger list from D-Bus QVariantList (handles QDBusArgument wrapping)
D-Bus may deliver QVariantList-of-QVariantMap as QDBusArgument. This function handles both wrapped and unwrapped forms.
| triggerVariant | The raw QVariant from D-Bus |
| modifierFieldName | Config key for the modifier field |
| mouseButtonFieldName | Config key for the mouse button field |