|
|
|
/* Kaleidoscope - Firmware for computer input devices
|
|
|
|
* Copyright (C) 2013-2020 Keyboard.io, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#define DEPRECATED(tag) \
|
|
|
|
__attribute__((deprecated(_DEPRECATE(_DEPRECATED_MESSAGE_ ## tag))))
|
|
|
|
|
|
|
|
#define _DEPRECATE(message) "\n" \
|
|
|
|
"------------------------------------------------------------------------\n" \
|
|
|
|
message \
|
|
|
|
"\n" \
|
|
|
|
"------------------------------------------------------------------------\n" \
|
|
|
|
|
|
|
|
/* Messages */
|
|
|
|
|
|
|
|
#define _DEPRECATED_MESSAGE_KEY_MASKING __NL__ \
|
|
|
|
"Key masking has been deprecated, please map keys to NoKey instead.\n" __NL__ \
|
|
|
|
"\n" __NL__ \
|
|
|
|
"For further information and examples on how to do that, \n" __NL__ \
|
|
|
|
"please see UPGRADING.md"
|
|
|
|
|
Switch to activation-order for Layers
Previously, we used index-ordering for layers, meaning, we looked keys up based
on the index of active layers. This turned out to be confusing, and in many
cases, limiting, since we couldn't easily shift to a lower layer from a higher
one. As such, index-ordering required careful planning of one's layers, and a
deeper understanding of the system.
This patch switches us to activation-ordering: the layer subsystem now keeps
track of the order in which layers are activated, and uses that order to look
keys up, instead of the index of layers. This makes it easier to understand how
the system works, and allows us to shift to lower layers too.
It does require a bit more resources, since we can't just store a bitmap of
active layers, but need 32 bytes to store the order. We still keep the bitmap,
to make `Layer.isActive()` fast: looking up a bit in the bitmap is more
efficient than walking the active layer array, and this function is often used
in cases where speed matters.
As a side effect of the switch, a number of methods were deprecated, and similar
ones with more appropriate names were introduced. See the updated `UPGRADING.md`
document for more details.
Plugins that used the deprecated methods were updated to use the new ones.
Fixes #857.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
5 years ago
|
|
|
#define _DEPRECATED_MESSAGE_LAYER_DEACTIVATETOP __NL__ \
|
|
|
|
"`Layer.deactivateTop()` is deprecated.\n" __NL__ \
|
|
|
|
"Please use `Layer.deactivateMostRecent()` instead."
|
|
|
|
|
|
|
|
#define _DEPRECATED_MESSAGE_LAYER_TOP __NL__ \
|
|
|
|
"`Layer.top()` is deprecated.\n" __NL__ \
|
|
|
|
"Please use `Layer.mostRecent()` instead."
|
|
|
|
|
|
|
|
#define _DEPRECATED_MESSAGE_LAYER_GETLAYERSTATE __NL__ \
|
|
|
|
"`Layer.getLayerState()` is deprecated.\n" __NL__ \
|
|
|
|
"Layers are now in activation-order, please use" __NL__ \
|
|
|
|
"`Layer.forEachActiveLayer()` instead."
|
|
|
|
|