diff --git a/src/view.cpp b/src/view.cpp index 815217b..639b875 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -35,10 +35,16 @@ Display &View::get_default_display(){ gui::Color View::getBackgroundColor() const { - if (!m_backgroundInherited) + DEBUG_PRINTF("getBackgroundColor() -> %d\n", m_backgroundColor); + if (!m_backgroundInherited) { + DEBUG_PRINTF("not inherited\n"); return m_backgroundColor; - if (getParentView()) + } + if (getParentView()){ + DEBUG_PRINTF("inherited from parent %p\n", getParentView()); return getParentView()->getBackgroundColor(); + } + DEBUG_PRINTF("inherited from view controller\n"); return ViewController::get().getBackgroundColor(); } @@ -86,17 +92,19 @@ void View::setWidget(gui::Widget *w) { void View::redraw(gui::Graphics&g, bool){ if(!childWidgets) return; + gui::Color c = getBackgroundColor(); if(needsRedrawing()){ - clear(g); + clear(g, c); childWidgets->redraw(g); childWidgets->redrawDone(); return; } if(!childWidgets->needsRedrawing() && !childWidgets->childNeedsRedrawing()) return; - clear(g); + clear(g, c); childWidgets->redraw(g); childWidgets->redrawDone(); + DEBUG_PRINTF("redraw complete\n"); } bool View::relayout(){ diff --git a/src/view_controller.cpp b/src/view_controller.cpp index 8d0838a..5335f52 100644 --- a/src/view_controller.cpp +++ b/src/view_controller.cpp @@ -90,7 +90,7 @@ void ViewController::poll_event_loop(){ gui::Color ViewController::getBackgroundColor() const{ gui::Color c; c = this->current_view? - this->current_view->m_backgroundColor: + this->current_view->getBackgroundColor(): 0; return c; } \ No newline at end of file diff --git a/src/widgets/text_widget.cpp b/src/widgets/text_widget.cpp index fe22963..da1e164 100644 --- a/src/widgets/text_widget.cpp +++ b/src/widgets/text_widget.cpp @@ -42,7 +42,7 @@ void TextWidget::redraw(Graphics& graphics, bool){ clear(graphics, this->m_textColor); graphics.set_pen(ViewController::get().getBackgroundColor()); }else{ - clear(graphics); + clear(graphics, ViewController::get().getBackgroundColor()); graphics.set_pen(this->m_textColor); } graphics.set_font(this->m_font);