@ -46,7 +46,7 @@ uint16_t SpaceCadet::time_out = 200;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// State variables
// State variables
bool SpaceCadet : : disabled = false ;
uint8_t SpaceCadet : : mode_ = SpaceCadet : : Mode : : ON ;
// These variables are used to keep track of any pending unresolved SpaceCadet
// These variables are used to keep track of any pending unresolved SpaceCadet
// key that has been pressed. If `pending_map_index_` is negative, it means
// key that has been pressed. If `pending_map_index_` is negative, it means
@ -82,17 +82,17 @@ SpaceCadet::SpaceCadet() {
// Function to determine whether SpaceCadet is active (useful for Macros and
// Function to determine whether SpaceCadet is active (useful for Macros and
// other plugins).
// other plugins).
bool SpaceCadet : : active ( ) {
bool SpaceCadet : : active ( ) {
return ! disabled ;
return mode_ = = Mode : : ON ;
}
}
// Function to enable SpaceCadet behavior
// Function to enable SpaceCadet behavior
void SpaceCadet : : enable ( ) {
void SpaceCadet : : enable ( ) {
disabled = false ;
mode_ = Mode : : ON ;
}
}
// Function to disable SpaceCadet behavior
// Function to disable SpaceCadet behavior
void SpaceCadet : : disable ( ) {
void SpaceCadet : : disable ( ) {
disabled = true ;
mode_ = Mode : : OFF ;
}
}
// =============================================================================
// =============================================================================
@ -134,7 +134,7 @@ EventHandlerResult SpaceCadet::onKeyswitchEvent(KeyEvent &event) {
}
}
// Do nothing if disabled, but keep the event tracker current.
// Do nothing if disabled, but keep the event tracker current.
if ( disabl ed)
if ( mo de_ ! = Mo de: : ON )
return EventHandlerResult : : OK ;
return EventHandlerResult : : OK ;
if ( ! event_queue_ . isEmpty ( ) ) {
if ( ! event_queue_ . isEmpty ( ) ) {