This (hopefully) makes layer changes more intuitive for users, and more
straightforward to explain and reason about. I believe this is a natural
extension of the activation-order layer stack, and away from the fixed-order
stack of old.
Specifically, it changes things so that layer lock keys will deactivate the
target layer if it is at the top of the active layer stack, but otherwise it
will bring the target layer to the top of the stack, regardless of whether or
not it was previously active. This ought to provide less surprising behaviour
in the case where a layer was active, but hidden (possibly for long enough that
the user can't recall its status). Pressing the layer lock key is now
guaranteed to produce a user-visible change (unless the target layer is 100%
transparent).
Layer shift behaviour is also changed, but not quite in the same way. A layer
shift key will now activate the target layer, as before, but pressing a second
layer shift key for the same target layer won't bring the target layer to the
top of the stack. The idea is that pressing a second identical layer shift
should be interpreted as a continuation of the already-active shift, probably so
that the user can change hands. A user could still forget about a shifted
layer, but it would have to be a sticky OneShot layer shift, so I think this is
reasonable.
The major change is that locked and shifted layers are now tracked separately on
the layer stack (using an offset), which means that locking a layer, then
pressing and releasing a layer shift key for that layer will not result in the
layer being unlocked.
Closes#1009
Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>