diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2019-04-25 11:50:35 +0000 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2019-04-27 05:30:39 +0000 |
commit | 6b11a9530f575d1851e63e92929b41bec7640c00 (patch) | |
tree | c18c667418d7eb1e8c1c2d13e945722e9a2ee7d0 | |
parent | b86a25755150cca0fd3901fe839a254ab1cddf8d (diff) | |
download | fbterm-6b11a9530f575d1851e63e92929b41bec7640c00.tar.gz fbterm-6b11a9530f575d1851e63e92929b41bec7640c00.zip |
Add margin defines
Fix black border around console region when background image defined
-rw-r--r-- | src/screen.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/screen.cpp b/src/screen.cpp index 1393b84..f7fb8da 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -1,5 +1,6 @@ /* * Copyright © 2008-2010 dragchan <zgchan317@gmail.com> + * Copyright © 2019 Raptor Engineering, LLC * This file is part of FbTerm. * * This program is free software; you can redistribute it and/or @@ -19,6 +20,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <string.h> #include <fcntl.h> @@ -40,6 +42,11 @@ #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define redraw(args...) (FbShellManager::instance()->redraw(args)) +#define LEFT_MARGIN_PIXELS 14 +#define RIGHT_MARGIN_PIXELS 14 +#define TOP_MARGIN_PIXELS 103 +#define BOTTOM_MARGIN_PIXELS 35 + DEFINE_INSTANCE(Screen) Screen *Screen::createInstance() @@ -88,8 +95,8 @@ Screen *Screen::createInstance() pScreen->mHeight = tmp; } - if (!pScreen->mCols) pScreen->mCols = pScreen->mWidth / FW(1); - if (!pScreen->mRows) pScreen->mRows = pScreen->mHeight / FH(1); + if (!pScreen->mCols) pScreen->mCols = (pScreen->mWidth - (LEFT_MARGIN_PIXELS + RIGHT_MARGIN_PIXELS)) / FW(1); + if (!pScreen->mRows) pScreen->mRows = (pScreen->mHeight - (TOP_MARGIN_PIXELS + BOTTOM_MARGIN_PIXELS)) / FH(1); /* Set up progress bar pipes */ if (mkfifo("/var/run/fbterm_progress_max", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)) { @@ -230,12 +237,17 @@ bool Screen::move(u16 scol, u16 srow, u16 dcol, u16 drow, u16 w, u16 h) void Screen::eraseMargin(bool top, u16 h) { - if (mWidth % FW(1)) { - fillRect(FW(mCols), top ? 0 : FH(mRows - h), mWidth % FW(1), FH(h), 0); + if (getenv("FBTERM_BACKGROUND_IMAGE")) { + // Disabled } + else { + if (mWidth % FW(1)) { + fillRect(FW(mCols), top ? 0 : FH(mRows - h), mWidth % FW(1), FH(h), 0); + } - if (mHeight % FH(1)) { - fillRect(0, FH(mRows), mWidth, mHeight % FH(1), 0); + if (mHeight % FH(1)) { + fillRect(0, FH(mRows), mWidth, mHeight % FH(1), 0); + } } } @@ -356,6 +368,9 @@ void Screen::adjustOffset(u32 &x, u32 &y) { if (mScrollType == XPan) x += mOffsetCur; else y += mOffsetCur; + + x += LEFT_MARGIN_PIXELS; + y += TOP_MARGIN_PIXELS; } void Screen::fillRect(u32 x, u32 y, u32 w, u32 h, u8 color) |