From e50bbaac3af0d06984b75d5f5ef08d6c6e604ff9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 4 May 2019 07:47:00 -0600 Subject: [PATCH] graphics/twm4nx/src/cbackground.cxx: Should set the initial background color immediately without waiting for a redraw. --- graphics/twm4nx/src/cbackground.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/graphics/twm4nx/src/cbackground.cxx b/graphics/twm4nx/src/cbackground.cxx index 4bcf7cca8..99993618e 100644 --- a/graphics/twm4nx/src/cbackground.cxx +++ b/graphics/twm4nx/src/cbackground.cxx @@ -246,6 +246,25 @@ bool CBackground::createBackgroundWindow(void) return false; } + // Get the graphics port for drawing on the background window + + NXWidgets::CGraphicsPort *port = control->getGraphicsPort(); + + // Get the size of the region to redraw (the whole display) + + struct nxgl_size_s windowSize; + if (!m_backWindow->getSize(&windowSize)) + { + twmerr("ERROR: getSize failed\n"); + delete m_backWindow; + m_backWindow = (FAR NXWidgets::CBgWindow *)0; + return false; + } + + // Fill the display with the background color + + port->drawFilledRect(0, 0, windowSize.w, windowSize.h, + CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR); return true; }