diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2019-04-27 03:52:15 +0000 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2019-04-27 05:30:39 +0000 |
commit | 464f7169625367a86978886fce250c245fe17972 (patch) | |
tree | 74a4215849f615bd6cfa82a6d4eed64e15f0fa35 | |
parent | 6b11a9530f575d1851e63e92929b41bec7640c00 (diff) | |
download | fbterm-464f7169625367a86978886fce250c245fe17972.tar.gz fbterm-464f7169625367a86978886fce250c245fe17972.zip |
Replace cursor logic with progress bar drawing logicHEADmaster04-16-2019
This requires external SIGARLM to be sent after FIFO load
TODO: Figure out a better way to update the progress bar
when data written to FIFOs?
-rw-r--r-- | src/fbshell.cpp | 64 | ||||
-rw-r--r-- | src/screen.cpp | 9 |
2 files changed, 5 insertions, 68 deletions
diff --git a/src/fbshell.cpp b/src/fbshell.cpp index bce28c7..7e298ea 100644 --- a/src/fbshell.cpp +++ b/src/fbshell.cpp @@ -384,71 +384,13 @@ bool FbShell::moveChars(u16 sx, u16 sy, u16 dx, u16 dy, u16 w, u16 h) void FbShell::drawCursor(CharAttr attr, u16 x, u16 y, u16 c) { - u16 oldX = mCursor.x, oldY = mCursor.y; - - adjustCharAttr(attr); - mCursor.attr = attr; - mCursor.x = x; - mCursor.y = y; - mCursor.code = c; - mCursor.showed = false; - - updateCursor(); - - if (manager->activeShell() == this && (oldX != x || oldY != y)) { - reportCursor(); - } + // } void FbShell::updateCursor() { - if (manager->activeShell() != this || mCursor.x >= w() || mCursor.y >= h()) return; - mCursor.showed ^= true; - - u16 shape = mode(CursorShape); - if (shape == CurDefault) { - static bool inited = false; - static u32 default_shape = 0; - if (!inited) { - inited = true; - Config::instance()->getOption("cursor-shape", default_shape); - - if (!default_shape) default_shape = CurUnderline; - else default_shape = CurBlock; - } - - shape = default_shape; - } - - switch (shape) { - case CurNone: - break; - - case CurUnderline: - screen->fillRect(FW(mCursor.x), FH(mCursor.y + 1) - 1, FW(1), 1, mCursor.showed ? mCursor.attr.fcolor : mCursor.attr.bcolor); - if (mImProxy) { - Rectangle rect = { FW(mCursor.x), FH(mCursor.y + 1) - 1, FW(1), 1 }; - mImProxy->redrawImWin(rect); - } - break; - - default: { - bool dw = (mCursor.attr.type != CharAttr::Single); - - u16 x = mCursor.x; - if (mCursor.attr.type == CharAttr::DoubleRight) x--; - - CharAttr attr = mCursor.attr; - if (mCursor.showed) { - u8 temp = attr.fcolor; - attr.fcolor = attr.bcolor; - attr.bcolor = temp; - } - - drawChars(attr, x, mCursor.y, dw ? FW(2) : FW(1), 1, &mCursor.code, &dw); - break; - } - } + if (manager->activeShell() != this) return; + screen->drawProgressBar(); } void FbShell::enableCursor(bool enable) diff --git a/src/screen.cpp b/src/screen.cpp index f7fb8da..c4a7233 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -113,8 +113,8 @@ Screen *Screen::createInstance() pScreen->mProgressBarMaxPipeFD = open("/var/run/fbterm_progress_max", O_RDONLY|O_NONBLOCK); pScreen->mProgressBarValuePipeFD = open("/var/run/fbterm_progress_value", O_RDONLY|O_NONBLOCK); - /* Disable progress bar by default */ - pScreen->mProgressBarMax = 0; + /* Draw empty progress bar outline, waiting for real data from pipes */ + pScreen->mProgressBarMax = 1; pScreen->mProgressBarValue = 0; /* Set up progress bar */ @@ -349,11 +349,6 @@ void Screen::drawText(u32 x, u32 y, u8 fc, u8 bc, u16 num, u16 *text, bool *dw) } else if (draw_space) { fillRect(startx, y, x - startx, FH(1), bc); } - - /* HACK - * If text changed, maybe progress did too? - */ - drawProgressBar(); } void Screen::drawGlyphs(u32 x, u32 y, u8 fc, u8 bc, u16 num, u16 *text, bool *dw) |