fix(input): add sliding-window multi-tap candidate bar and input tail-scrolling across plugins and fcitx5-t9

This commit is contained in:
Luxferre committed 2026-10-26 17:37:53 +02:00
1 parent a53a331111
commit 1f9138f0c6
24 files changed
+394 -125

No files matched your search

+33 -14
View File
@@ -42,16 +42,16 @@ enum class TextCaseMode {
};
const char* kMultiTapTheme[10] = {
" _-0", // 0
".-_1", // 1
"abc2", // 2
"def3", // 3
"ghi4", // 4
"jkl5", // 5
"mno6", // 6
"pqrs7", // 7
"tuv8", // 8
"wxyz9" // 9
" _-0", // 0
".-_1,!?+@#$%~()[]{}", // 1
"abc2", // 2
"def3", // 3
"ghi4", // 4
"jkl5", // 5
"mno6", // 6
"pqrs7", // 7
"tuv8", // 8
"wxyz9" // 9
};
const char* kHexKeyMap[10] = {
@@ -821,13 +821,22 @@ int runThemesApp(int argc, char** argv) {
XFillRectangle(dpy, pix, gc, 10, 74, kWinWidth - 20, 38);
XSetForeground(dpy, gc, pt.spec.accentAlt);
XDrawRectangle(dpy, pix, gc, 10, 74, kWinWidth - 21, 37);
drawPango(layoutMain, &colWhite, 16, 74, 38, nameInput + "|",
kWinWidth - 32);
std::string nameDisp =
tailFitPangoText(layoutMain, nameInput + "|", kWinWidth - 32);
drawPango(layoutMain, &colWhite, 16, 74, 38, nameDisp, kWinWidth - 32);
drawPango(layoutSmall, &colMuted, 10, 124, 20,
"Saves to ~/.xthemes/<Name>.xth", 220);
drawPango(layoutSmall, &colMuted, 10, 146, 20,
"# Input mode", 220);
if (lastTapDigit >= 0 && lastTapDigit <= 9 &&
(nowMs() - lastTapMs) <= 850) {
std::string cand = formatMultiTapBar(
std::to_string(lastTapDigit) + ":", kMultiTapTheme[lastTapDigit],
lastTapCycle, caseMode == TextCaseMode::Upper);
drawPango(layoutSmall, &colYellow, 10, 146, 20, cand, 220);
} else {
drawPango(layoutSmall, &colMuted, 10, 146, 20,
"# Input mode", 220);
}
drawSoftkeyBar("Save", "Save", nameInput.empty() ? "Cancel" : "Del");
} else if (mode == ViewMode::ConfirmDelete && !themes.empty()) {
@@ -1323,10 +1332,20 @@ int runThemesApp(int argc, char** argv) {
}
}
if (visible && mode == ViewMode::NameModal && lastTapDigit != -1 &&
(tNow - lastTapMs) > 850) {
lastTapDigit = -1;
drawUI();
}
int timeoutMs = -1;
if (visible && softkeyPending != 0) {
timeoutMs = std::max(1, static_cast<int>(softkeyDeadlineMs - tNow));
}
if (visible && mode == ViewMode::NameModal && lastTapDigit != -1) {
int tapRem = std::max(1, static_cast<int>(851 - (tNow - lastTapMs)));
timeoutMs = (timeoutMs < 0) ? tapRem : std::min(timeoutMs, tapRem);
}
struct pollfd pfds[2];
int nfds = 0;