Skip to content

Commit

Permalink
v79 (non beta): merge to master
Browse files Browse the repository at this point in the history
- fixed reload / same layer
  • Loading branch information
cajhin committed Jan 2, 2021
1 parent 5b7dcaf commit 5b918da
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 225 deletions.
267 changes: 54 additions & 213 deletions capsicain/capsicain.cajhin.ini

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions capsicain/capsicain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ int main()
}

parseIniGlobals();
switchLayer(globals.activeLayerOnStartup);
switchLayer(globals.activeLayerOnStartup, true);

interceptionState.interceptionContext = interception_create_context();
interception_set_filter(interceptionState.interceptionContext, interception_is_keyboard, INTERCEPTION_FILTER_KEY_ALL);
Expand Down Expand Up @@ -637,7 +637,7 @@ bool processCommand()
case SC_0:
{
cout << endl << "LAYER CHANGE: " << LAYER_DISABLED;
switchLayer(LAYER_DISABLED);
switchLayer(LAYER_DISABLED, 0);
break;
}
case SC_1:
Expand All @@ -652,7 +652,7 @@ bool processCommand()
{
int layer = loopState.scancode - 1;
cout << endl << "LAYER CHANGE: " << layer;
switchLayer(layer);
switchLayer(layer, false);
break;
}
case SC_BACK:
Expand Down Expand Up @@ -1179,9 +1179,9 @@ bool parseProcessIniLayer(int layer)
return true;
}

void switchLayer(int layer)
void switchLayer(int layer, bool forceReloadSameLayer)
{
if (layer == globalState.activeLayer)
if (!forceReloadSameLayer && layer == globalState.activeLayer)
return;

int oldLayer = globalState.activeLayer;
Expand Down Expand Up @@ -1254,7 +1254,7 @@ void reload()
readSanitizeIniFile(sanitizedIniContent);

parseIniGlobals();
switchLayer(globalState.activeLayer);
switchLayer(globalState.activeLayer, true);
}

//Release all keys to 'up' that have been sent out as 'down'
Expand Down Expand Up @@ -1461,7 +1461,7 @@ void sendCapsicainCodeHandler(VKeyEvent keyEvent)
}
case VK_CPS_LAYERPREVIOUS:
{
switchLayer(globalState.previousLayer);
switchLayer(globalState.previousLayer, false);
}
}

Expand Down Expand Up @@ -1524,7 +1524,7 @@ void playKeyEventSequence(vector<VKeyEvent> keyEventSequence)
else if (expectNextLayerSwitch)
{
IFDEBUG cout << endl << "vklayerswitch: " << getPrettyVKLabelPadded(keyEvent.vcode, 0);
switchLayer(keyEvent.vcode);
switchLayer(keyEvent.vcode, false);
expectNextLayerSwitch = false;
}
//release and remember all keys that are physically down
Expand Down
2 changes: 1 addition & 1 deletion capsicain/capsicain.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ void reset();
void reload();
void releaseAllSentKeys();
std::vector<std::string> assembleLayerConfig(int layer);
void switchLayer(int layer);
void switchLayer(int layer, bool forceReloadSameLayer);
void resetCapsNumScrollLock();

4 changes: 2 additions & 2 deletions capsicain/capsicain.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ GLOBAL IniVersion ini66
#any string, so you can check with Status [ESC]+[S] if you're using the right config


#GLOBAL ActiveLayerOnStartup 1
GLOBAL ActiveLayerOnStartup 1
#This layer is active on startup. Default=1
#Switch layer with [ESC]+[0..9]
#0=hardcoded = no changes at all, Only listen to layer change (ESC + number)
Expand Down Expand Up @@ -163,6 +163,7 @@ COMBO V [&^^^ .... ....] > sequence (&LSHF_H_^LSHF_e_l_l_o_SLEEP:1000_&LSHF_1
REWIRE LCTRL NOP // LSHF
COMBO F11 [...& .... ....] > layerSwitch(11) //should fail


#Collect the many sections for the 'KingCon' config into one 'super-module'
#The order of the includes may matter - the first matching rule always wins.
[KINGCON_ALL_SECTIONS_BUT_LAYOUT]
Expand All @@ -183,7 +184,6 @@ INCLUDE KINGCON_NUMPAD+CONTROL_TO_TABLE1
INCLUDE KINGCON_NUMPAD+CONTROL+SHIFT_TO_TABLE2
INCLUDE CAPS+NUMBERS_TO_AHK_CLIPBOARDS
INCLUDE WINDOWS_SHORTCUTS
INCLUDE LAYER_SWITCH
INCLUDE SHOWOFF

# ╔════════════════════════════════════════════════════════════════════════╗
Expand Down
2 changes: 2 additions & 0 deletions capsicain/codenotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ v78beta: configurable layer change
- new functions > layerSwitch(0..9), > layerPrevious()
- disable Ctrl-C
- (new internal vkeys LAYERSWITCH, LAYERPREVIOUS)

v79: fix reload, final non-beta
2 changes: 1 addition & 1 deletion capsicain/constants.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#define VERSION "79beta"
#define VERSION "79"


//arbitray limits
Expand Down
Binary file modified x64/Release/capsicain.exe
Binary file not shown.

0 comments on commit 5b918da

Please sign in to comment.