Skip to content

Commit

Permalink
Various improvements
Browse files Browse the repository at this point in the history
Yaft:
 - Better handling of colors.
 - Use dithering for 3 gray levels.
 - Support bold font for even more contrast.

Launcher:
 - Hopefully fix the missed finger issue.
 - Default gestures are now three finger swipes.
  • Loading branch information
timower committed Jan 24, 2021
1 parent ed80a97 commit ec66601
Show file tree
Hide file tree
Showing 17 changed files with 8,358 additions and 1,866 deletions.
28 changes: 18 additions & 10 deletions apps/launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ Launcher::readApps() {
}

const Config default_config = { {
{ GestureConfig::Swipe, SwipeGesture::Down, 2, GestureConfig::ShowApps, "" },
{ GestureConfig::Swipe, SwipeGesture::Down, 3, GestureConfig::ShowApps, "" },

{ GestureConfig::Swipe,
SwipeGesture::Right,
2,
3,
GestureConfig::NextRunning,
"" },

{ GestureConfig::Swipe,
SwipeGesture::Left,
2,
3,
GestureConfig::PrevRunning,
"" },
} };
Expand Down Expand Up @@ -567,9 +567,11 @@ Launcher::init() {

void
Launcher::run() {
auto lastSync = std::chrono::steady_clock::now();
while (!shouldStop) {
auto events = inputMgr.waitForInput();

// Switch if current app closed.
if (auto* currentApp = getCurrentApp();
currentApp != nullptr && !currentApp->runInfo.has_value()) {
App* lastApp = nullptr;
Expand All @@ -589,15 +591,21 @@ Launcher::run() {
}
}

if (!events.has_value()) {
std::cerr << "Error reading event\n";
continue;
}
if (events.has_value()) {
auto gestures = gestureController.handleEvents(*events);

auto gestures = gestureController.handleEvents(*events);
for (const auto& gesture : gestures) {
std::visit([this](const auto& g) { handleGesture(config, g); },
gesture);
}
}

for (const auto& gesture : gestures) {
std::visit([this](const auto& g) { handleGesture(config, g); }, gesture);
// Sync
auto now = std::chrono::steady_clock::now();
if (now - lastSync > std::chrono::seconds(10)) {
std::cerr << "Syncing" << std::endl;
gestureController.sync(inputMgr.devices.begin()->second);
lastSync = now;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions apps/yaft/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ project(yaft)

add_executable(${PROJECT_NAME}
main.cpp
terminal.cpp
parse.c
fb/common.cpp
keyboard.cpp)
Expand Down
8 changes: 6 additions & 2 deletions apps/yaft/color.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ enum {
// clang-format off
const uint32_t color_list[COLORS] = {
/* system color: 16 */
0xFFFFFF, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000/* 0xAAAAAA */,
0xAAAAAA, 0xFFFFFF, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000/* 0xFFFFFF */,
/*
0xFFFFFF, 0x777777, 0x777777, 0x777777, 0x777777, 0x777777, 0x777777, 0x000000,
0xFFFFFF, 0x777777, 0x777777, 0x777777, 0x777777, 0x777777, 0x777777, 0x000000,
*/
0x000000, 0xAA0000, 0x00AA00, 0xAA5500, 0x0000AA, 0xAA00AA, 0x00AAAA, 0xAAAAAA,
0x555555, 0xFF5555, 0x55FF55, 0xFFFF55, 0x5555FF, 0xFF55FF, 0x55FFFF, 0xDFDFDF,
/* color cube: 216 */
0x000000, 0x00005F, 0x000087, 0x0000AF, 0x0000D7, 0x0000FF, 0x005F00, 0x005F5F,
0x005F87, 0x005FAF, 0x005FD7, 0x005FFF, 0x008700, 0x00875F, 0x008787, 0x0087AF,
Expand Down
Loading

0 comments on commit ec66601

Please sign in to comment.