Fixed redraw issue on non-Windows platforms when ListWindow is blurred.

This commit is contained in:
Casey Langen 2016-05-28 10:42:52 -07:00
parent 7220617db0
commit 05c36ef76b
3 changed files with 18 additions and 7 deletions

View File

@ -36,11 +36,11 @@ void LogWindow::Update() {
return; return;
} }
int64 attrs = COLOR_PAIR(BOX_COLOR_WHITE_ON_BLACK);
WINDOW* contents = this->GetContent(); WINDOW* contents = this->GetContent();
for (size_t i = 0; i < pending.size(); i++) { for (size_t i = 0; i < pending.size(); i++) {
int64 attrs = COLOR_PAIR(BOX_COLOR_WHITE_ON_BLACK);
LogEntry* entry = pending[i]; LogEntry* entry = pending[i];
switch (entry->level) { switch (entry->level) {

View File

@ -8,6 +8,12 @@ typedef IScrollAdapter::ScrollPosition ScrollPos;
size_t ListWindow::NO_SELECTION = (size_t) -1; size_t ListWindow::NO_SELECTION = (size_t) -1;
#define REDRAW_VISIBLE_PAGE() \
GetScrollAdapter().DrawPage( \
this->GetContent(), \
this->scrollPosition.firstVisibleEntryIndex, \
&this->scrollPosition); \
ListWindow::ListWindow(IWindow *parent) ListWindow::ListWindow(IWindow *parent)
: ScrollableWindow(parent) { : ScrollableWindow(parent) {
this->selectedIndex = (size_t) -1; this->selectedIndex = (size_t) -1;
@ -30,11 +36,14 @@ void ListWindow::ScrollToBottom() {
this->Repaint(); this->Repaint();
} }
void ListWindow::Blur() {
ScrollableWindow::Blur();
REDRAW_VISIBLE_PAGE();
}
void ListWindow::Focus() { void ListWindow::Focus() {
GetScrollAdapter().DrawPage( ScrollableWindow::Focus();
this->GetContent(), REDRAW_VISIBLE_PAGE();
this->scrollPosition.firstVisibleEntryIndex,
&this->scrollPosition);
} }
void ListWindow::ScrollUp(int delta) { void ListWindow::ScrollUp(int delta) {

View File

@ -22,7 +22,9 @@ namespace cursespp {
virtual void ScrollDown(int delta = 1); virtual void ScrollDown(int delta = 1);
virtual void PageUp(); virtual void PageUp();
virtual void PageDown(); virtual void PageDown();
virtual void Focus(); virtual void Focus();
virtual void Blur();
virtual size_t GetSelectedIndex(); virtual size_t GetSelectedIndex();
@ -38,4 +40,4 @@ namespace cursespp {
IScrollAdapter::ScrollPosition scrollPosition; IScrollAdapter::ScrollPosition scrollPosition;
size_t selectedIndex; size_t selectedIndex;
}; };
} }