Papageno
An Advanced Pattern Matching Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Functions
ppg_tap_dance.h File Reference
#include "ppg_action.h"
#include "ppg_token.h"
#include "ppg_input.h"
#include "ppg_layer.h"

Go to the source code of this file.

Data Structures

struct  PPG_Tap_Definition
 A tap specification. More...
 

Macros

#define PPG_TAP_DEFINITIONS(...)
 Auxiliary macro to simplify passing tap definitions. More...
 
#define PPG_TAP(TAP_COUNT, ACTION)   (PPG_Tap_Definition) { .action = ACTION, .tap_count = TAP_COUNT }
 This macro simplifies the specification of taps as actions that are associated with specific a number of taps. More...
 

Functions

PPG_Token ppg_tap_dance (PPG_Layer layer, PPG_Input_Id input, PPG_Count n_tap_definitions, PPG_Tap_Definition tap_definitions[])
 Defines a tap dance. More...
 

Macro Definition Documentation

#define PPG_TAP (   TAP_COUNT,
  ACTION 
)    (PPG_Tap_Definition) { .action = ACTION, .tap_count = TAP_COUNT }

This macro simplifies the specification of taps as actions that are associated with specific a number of taps.

Parameters
TAP_COUNTThe number of taps the action is associated with
ACTIONThe action
#define PPG_TAP_DEFINITIONS (   ...)
Value:
sizeof((PPG_Tap_Definition[]){ __VA_ARGS__ })/sizeof(PPG_Tap_Definition), \
(PPG_Tap_Definition[]){ __VA_ARGS__ }
A tap specification.
Definition: ppg_tap_dance.h:31

Auxiliary macro to simplify passing tap definitions.

Parameters
...The array members

Function Documentation

PPG_Token ppg_tap_dance ( PPG_Layer  layer,
PPG_Input_Id  input,
PPG_Count  n_tap_definitions,
PPG_Tap_Definition  tap_definitions[] 
)

Defines a tap dance.

Tap dances are a sequence of input presses of the same input. With each press an action can be associated. As an enhancement to the original tap dance idea. It is also possible to fall back to the last action if e.g. an action is defined for three input presses and five input presses. If default_action_flags contains PPG_Action_Fallback the action associated with the next lower amount of input presses is triggered, in this example the action associated with three presses.

Parameters
layerThe layer the pattern is associated with
inputThe input the tap dance is associated with
n_tap_definitionsThe number of tap definitions
tap_definitionsA tap definitions array.
Returns
The constructed token