Optional PC key blocks: function row, navigation, numeric keypad
- Template sections placed above or to the right of the typing keys; the user picks any mix in settings, typing keys included - keysym keys send XKB keysyms on press, optionally repeating - Geometry lays blocks side by side with one key unit; stretch keys are resolved at layout time so composed blocks line up - Toggling a block resizes the window so keys keep their size Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
#include "LayoutBuilder.h"
|
||||
#include "KeyGeometry.h"
|
||||
|
||||
#include <QSet>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -74,24 +72,6 @@ Row expandLetters(const Row &row, const KeymapLetters &letters, const QHash<QStr
|
||||
return result;
|
||||
}
|
||||
|
||||
void stretchRows(Layer &layer)
|
||||
{
|
||||
qreal widest = 0;
|
||||
for (const Row &row : layer.rows)
|
||||
widest = std::max(widest, rowUnits(row));
|
||||
|
||||
for (Row &row : layer.rows) {
|
||||
const auto stretchy = std::ranges::count_if(row, &KeyDef::stretch);
|
||||
if (stretchy == 0)
|
||||
continue;
|
||||
const qreal extra = (widest - rowUnits(row)) / qreal(stretchy);
|
||||
for (KeyDef &key : row) {
|
||||
if (key.stretch)
|
||||
key.width += extra;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Layout buildLayout(const Layout &tmpl, const KeymapLetters &letters)
|
||||
@@ -104,7 +84,6 @@ Layout buildLayout(const Layout &tmpl, const KeymapLetters &letters)
|
||||
for (Layer &layer : layout.layers) {
|
||||
for (Row &row : layer.rows)
|
||||
row = expandLetters(row, letters, alternates);
|
||||
stretchRows(layer);
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user