summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NxWidgets/UnitTests/nxwm/main.cxx29
-rw-r--r--NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx6
-rw-r--r--NxWidgets/libnxwidgets/include/nxconfig.hxx166
-rw-r--r--NxWidgets/libnxwidgets/src/cnxtkwindow.cxx19
-rw-r--r--NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx23
-rw-r--r--NxWidgets/nxwm/include/ctaskbar.hxx11
-rw-r--r--NxWidgets/nxwm/include/nxwmconfig.hxx28
-rw-r--r--NxWidgets/nxwm/src/capplicationwindow.cxx2
-rw-r--r--NxWidgets/nxwm/src/ctaskbar.cxx145
-rw-r--r--nuttx/configs/sim/nxwm/defconfig6
10 files changed, 235 insertions, 200 deletions
diff --git a/NxWidgets/UnitTests/nxwm/main.cxx b/NxWidgets/UnitTests/nxwm/main.cxx
index d0050b2bd..8da6839a6 100644
--- a/NxWidgets/UnitTests/nxwm/main.cxx
+++ b/NxWidgets/UnitTests/nxwm/main.cxx
@@ -162,9 +162,18 @@ int MAIN_NAME(int argc, char *argv[])
return EXIT_FAILURE;
}
+ printf(MAIN_STRING "Initialize the CApplicationWindow\n");
+ if (!window->open())
+ {
+ printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
+ delete window;
+ delete g_nxwmtest.taskbar;
+ return EXIT_FAILURE;
+ }
+
printf(MAIN_STRING "Creating the start window application\n");
g_nxwmtest.startwindow = new NxWM::CStartWindow(g_nxwmtest.taskbar, window);
- if (!g_nxwmtest.taskbar)
+ if (!g_nxwmtest.startwindow)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CStartWindow\n");
delete window;
@@ -195,6 +204,15 @@ int MAIN_NAME(int argc, char *argv[])
goto noconsole;
}
+ printf(MAIN_STRING "Initialize the CApplicationWindow\n");
+ if (!window->open())
+ {
+ printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
+ delete window;
+ delete g_nxwmtest.taskbar;
+ return EXIT_FAILURE;
+ }
+
printf(MAIN_STRING "Creating the NxConsole application\n");
console = new NxWM::CNxConsole(g_nxwmtest.taskbar, window);
if (!console)
@@ -226,6 +244,15 @@ noconsole:
goto nocalculator;
}
+ printf(MAIN_STRING "Initialize the CApplicationWindow\n");
+ if (!window->open())
+ {
+ printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
+ delete window;
+ delete g_nxwmtest.taskbar;
+ return EXIT_FAILURE;
+ }
+
printf(MAIN_STRING "Creating the calculator application\n");
calculator = new NxWM::CCalculator(g_nxwmtest.taskbar, window);
if (!calculator)
diff --git a/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx b/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
index 0a894eae8..7725dec2c 100644
--- a/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
+++ b/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
@@ -166,7 +166,7 @@ namespace NXWidgets
TNxArray<CNxWidget*> m_widgets; /**< List of controlled
widgets. */
bool m_modal; /**< True: in modal loop */
- sem_t m_modalsem; /**< Modal loops waits for
+ sem_t m_modalSem; /**< Modal loops waits for
events on this semaphore */
/**
* I/O
@@ -194,7 +194,7 @@ namespace NXWidgets
struct nxgl_point_s m_pos; /**< Position in display space */
struct nxgl_rect_s m_bounds; /**< Size of the display */
#ifdef CONFIG_NX_MULTIUSER
- sem_t m_geosem; /**< Posted when geometry is valid */
+ sem_t m_geoSem; /**< Posted when geometry is valid */
#endif
/**
@@ -299,7 +299,7 @@ namespace NXWidgets
inline void giveGeoSem(void)
{
#ifdef CONFIG_NX_MULTIUSER
- sem_post(&m_geosem);
+ sem_post(&m_geoSem);
#endif
}
diff --git a/NxWidgets/libnxwidgets/include/nxconfig.hxx b/NxWidgets/libnxwidgets/include/nxconfig.hxx
index 1c7b6a3f0..5d3752fd0 100644
--- a/NxWidgets/libnxwidgets/include/nxconfig.hxx
+++ b/NxWidgets/libnxwidgets/include/nxconfig.hxx
@@ -53,6 +53,90 @@
****************************************************************************/
/* NX Configuration *********************************************************/
/**
+ * Prerequisites:
+ *
+ * CONFIG_HAVE_CXX=y : C++ support is required
+ * CONFIG_NX=y : NX graphics support must be enabled
+ * CONFIG_NX_MOUSE=y : Required to enable NX mouse/touchscreen support
+ * CONFIG_NX_KBD=y : Required to enabled NX keyboard support
+ * CONFIG_NX_NPLANES=1 : Only a single video plane is supported
+ *
+ * NX Server/Device Configuration
+ *
+ * CONFIG_NXWIDGETS_DEVNO - LCD device number (in case there are more than
+ * one LCDs connected. Default: 0
+ * CONFIG_NXWIDGETS_VPLANE - Only a single video plane is supported. Default: 0
+ * CONFIG_NXWIDGETS_SERVERPRIO - Priority of the NX server. This applies
+ * only if NX is configured in multi-user mode (CONFIG_NX_MULTIUSER=y).
+ * Default: SCHED_PRIORITY_DEFAULT+1. NOTE: Of the three priority
+ * definitions here, CONFIG_NXWIDGETS_SERVERPRIO should have the highest
+ * priority to avoid data overrun race conditions. Such errors would most
+ * likely appear as duplicated rows of data on the display.
+ * CONFIG_NXWIDGETS_CLIENTPRIO - The thread that calls CNxServer::connect()
+ * will be re-prioritized to this priority. This applies only if NX is
+ * configured in multi-user mode (CONFIG_NX_MULTIUSER=y). Default:
+ * SCHED_PRIORITY_DEFAULT
+ * CONFIG_NXWIDGETS_LISTENERPRIO - Priority of the NX event listener thread.
+ * This applies only if NX is configured in multi-user mode
+ * (CONFIG_NX_MULTIUSER=y). Default: SCHED_PRIORITY_DEFAULT
+ * CONFIG_NXWIDGETS_EXTERNINIT - Define to support external display
+ * initialization.
+ * CONFIG_NXWIDGETS_SERVERSTACK - NX server thread stack size (in multi-user
+ * mode). Default 2048
+ * CONFIG_NXWIDGETS_LISTENERSTACK - NX listener thread stack size (in multi-user
+ * mode). Default 2048
+ *
+ * NXWidget Configuration
+ *
+ * CONFIG_NXWIDGETS_BPP - Supported bits-per-pixel {8, 16, 24, 32}. Default:
+ * The smallest BPP configuration supported by NX.
+ * CONFIG_NXWIDGETS_SIZEOFCHAR - Size of character {1 or 2 bytes}. Default
+ * Determined by CONFIG_NXWIDGETS_SIZEOFCHAR
+ *
+ * NXWidget Default Values
+ *
+ * CONFIG_NXWIDGETS_DEFAULT_FONTID - Default font ID. Default: NXFONT_DEFAULT
+ * CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE, CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT -
+ * Default dynamic array parameters. Default: 16, 8
+ *
+ * CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
+ * MKRGB(160,160,160)
+ * CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR - Default selected background
+ * color. Default: MKRGB(120,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR - Shiny side boarder color. Default
+ * MKRGB(248,248,248)
+ * CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR - Shadowed side border color.
+ * Default: MKRGB(0,0,0)
+ * CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR - Highlight color. Default:
+ * MKRGB(192,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a disabled widget:
+ * Default: MKRGB(192,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR - Text color on a enabled widget:
+ * Default: MKRGB(248,248,248)
+ * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a selected widget:
+ * Default: MKRGB(0,0,0)
+ * CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR - Default font color: Default:
+ * MKRGB(255,255,255)
+ * CONFIG_NXWIDGETS_TRANSPARENT_COLOR - Transparent color: Default: MKRGB(0,0,0)
+ *
+ * Keypad behavior
+ *
+ * CONFIG_NXWIDGETS_FIRST_REPEAT_TIME - Time taken before a key starts
+ * repeating (in milliseconds). Default: 500
+ * CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME - Time taken before a repeating key
+ * repeats again (in milliseconds). Default: 200
+ * CONFIG_NXWIDGETS_DOUBLECLICK_TIME - Left button release-press time for
+ * double click (in milliseconds). Default: 350
+ * CONFIG_NXWIDGETS_KBDBUFFER_SIZE - Size of incoming character buffer, i.e.,
+ * the maximum number of characters that can be entered between NX polling
+ * cycles without losing data.
+ * CONFIG_NXWIDGETS_CURSORCONTROL_SIZE - Size of incoming cursor control
+ * buffer, i.e., the maximum number of cursor controls that can between
+ * entered by NX polling cycles without losing data. Default: 4
+ */
+
+/* Prerequisites ************************************************************/
+/**
* C++ support is required
*/
@@ -61,7 +145,7 @@
#endif
/**
- * Required to enabled NX graphics support
+ * NX graphics support must be enabled
*/
#ifndef CONFIG_NX
@@ -69,7 +153,7 @@
#endif
/**
- * Required to enabled NX mouse/touchscreen support
+ * Required to enable NX mouse/touchscreen support
*/
#ifndef CONFIG_NX_MOUSE
@@ -97,7 +181,6 @@
#endif
/* NX Server/Device Configuration *******************************************/
-
/**
* LCD device number (in case there are more than one LCDs connected)
*/
@@ -162,81 +245,6 @@
/* NXWidget Configuration ***************************************************/
/**
- * NX Server/Device Configuration
- *
- * CONFIG_NXWIDGETS_DEVNO - LCD device number (in case there are more than
- * one LCDs connected. Default: 0
- * CONFIG_NXWIDGETS_VPLANE - Only a single video plane is supported. Default: 0
- * CONFIG_NXWIDGETS_SERVERPRIO - Priority of the NX server. This applies
- * only if NX is configured in multi-user mode (CONFIG_NX_MULTIUSER=y).
- * Default: SCHED_PRIORITY_DEFAULT+1. NOTE: Of the three priority
- * definitions here, CONFIG_NXWIDGETS_SERVERPRIO should have the highest
- * priority to avoid data overrun race conditions. Such errors would most
- * likely appear as duplicated rows of data on the display.
- * CONFIG_NXWIDGETS_CLIENTPRIO - The thread that calls CNxServer::connect()
- * will be re-prioritized to this priority. This applies only if NX is
- * configured in multi-user mode (CONFIG_NX_MULTIUSER=y). Default:
- * SCHED_PRIORITY_DEFAULT
- * CONFIG_NXWIDGETS_LISTENERPRIO - Priority of the NX event listener thread.
- * This applies only if NX is configured in multi-user mode
- * (CONFIG_NX_MULTIUSER=y). Default: SCHED_PRIORITY_DEFAULT
- * CONFIG_NXWIDGETS_EXTERNINIT - Define to support external display
- * initialization.
- * CONFIG_NXWIDGETS_SERVERSTACK - NX server thread stack size (in multi-user
- * mode). Default 2048
- * CONFIG_NXWIDGETS_LISTENERSTACK - NX listener thread stack size (in multi-user
- * mode). Default 2048
- *
- * NXWidget Configuration
- *
- * CONFIG_NXWIDGETS_BPP - Supported bits-per-pixel {8, 16, 24, 32}. Default:
- * The smallest BPP configuration supported by NX.
- * CONFIG_NXWIDGETS_SIZEOFCHAR - Size of character {1 or 2 bytes}. Default
- * Determined by CONFIG_NXWIDGETS_SIZEOFCHAR
- *
- * NXWidget Default Values
- *
- * CONFIG_NXWIDGETS_DEFAULT_FONTID - Default font ID. Default: NXFONT_DEFAULT
- * CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE, CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT -
- * Default dynamic array parameters. Default: 16, 8
- *
- * CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
- * MKRGB(160,160,160)
- * CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR - Default selected background
- * color. Default: MKRGB(120,192,192)
- * CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR - Shiny side boarder color. Default
- * MKRGB(248,248,248)
- * CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR - Shadowed side border color.
- * Default: MKRGB(0,0,0)
- * CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR - Highlight color. Default:
- * MKRGB(192,192,192)
- * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a disabled widget:
- * Default: MKRGB(192,192,192)
- * CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR - Text color on a enabled widget:
- * Default: MKRGB(248,248,248)
- * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a selected widget:
- * Default: MKRGB(0,0,0)
- * CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR - Default font color: Default:
- * MKRGB(255,255,255)
- * CONFIG_NXWIDGETS_TRANSPARENT_COLOR - Transparent color: Default: MKRGB(0,0,0)
- *
- * Keypad behavior
- *
- * CONFIG_NXWIDGETS_FIRST_REPEAT_TIME - Time taken before a key starts
- * repeating (in milliseconds). Default: 500
- * CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME - Time taken before a repeating key
- * repeats again (in milliseconds). Default: 200
- * CONFIG_NXWIDGETS_DOUBLECLICK_TIME - Left button release-press time for
- * double click (in milliseconds). Default: 350
- * CONFIG_NXWIDGETS_KBDBUFFER_SIZE - Size of incoming character buffer, i.e.,
- * the maximum number of characters that can be entered between NX polling
- * cycles without losing data.
- * CONFIG_NXWIDGETS_CURSORCONTROL_SIZE - Size of incoming cursor control
- * buffer, i.e., the maximum number of cursor controls that can between
- * entered by NX polling cycles without losing data. Default: 4
- */
-
-/**
* Bits per pixel
*/
@@ -317,7 +325,6 @@
#endif
/* NXWidget Default Values **************************************************/
-
/**
* Default font ID
*/
@@ -409,7 +416,6 @@
#endif
/* Keypad behavior **********************************************************/
-
/**
* Time taken before a key starts repeating (in milliseconds).
*/
diff --git a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
index ba62ee435..bae9cb815 100644
--- a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
@@ -133,23 +133,12 @@ CNxToolbar *CNxTkWindow::openToolbar(nxgl_coord_t height)
{
if (m_hNxTkWindow && !m_toolbar)
{
- // Get current window style from the widget control
-
- CWidgetStyle style;
- m_widgetControl->getWidgetStyle(&style);
-
- // Create a new controlling widget for the window
-
- CWidgetControl *widgetControl = new CWidgetControl(&style);
-
- // And create the toolcar
+ // Create the toolbar. Note that we use the SAME underlying
+ // widget control. That is because the tool bar really resides
+ // in the same "physical" window.
m_toolbar = new CNxToolbar(this, m_hNxTkWindow,
- widgetControl, height);
- if (!m_toolbar)
- {
- delete widgetControl;
- }
+ m_widgetControl, height);
}
return m_toolbar;
}
diff --git a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
index a6807dad5..1e1c9ce87 100644
--- a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
+++ b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
@@ -104,10 +104,17 @@ CWidgetControl::CWidgetControl(FAR const CWidgetStyle *style)
m_nCh = 0;
m_nCc = 0;
- // Enable the semaphore that will wake up the modal loop on mouse or
- // keypress events
-
- sem_init(&m_modalsem, 0, 0);
+ // Intialize semaphores:
+ //
+ // m_modalSem. The semaphore that will wake up the modal loop on mouse or
+ // keypress events
+ // m_geoSem. The semaphore that will synchronize window size and position
+ // informatin.
+
+ sem_init(&m_modalSem, 0, 0);
+#ifdef CONFIG_NX_MULTIUSER
+ sem_init(&m_geoSem, 0, 0);
+#endif
// Do we need to fetch the default style?
@@ -197,7 +204,7 @@ void CWidgetControl::waitForModalEvent(void)
{
// Wait for an interesting event (like a mouse or keyboard event)
- (void)sem_wait(&m_modalsem);
+ (void)sem_wait(&m_modalSem);
}
}
@@ -209,7 +216,7 @@ void CWidgetControl::wakeupModalLoop(void)
{
if (m_modal)
{
- (void)sem_post(&m_modalsem);
+ (void)sem_post(&m_modalSem);
}
}
@@ -227,7 +234,7 @@ void CWidgetControl::stopModal(void)
// Wake up the modal loop so that it can terminate properly
- (void)sem_post(&m_modalsem);
+ (void)sem_post(&m_modalSem);
}
}
@@ -885,7 +892,7 @@ void CWidgetControl::takeGeoSem(void)
int ret;
do
{
- ret = sem_wait(&m_geosem);
+ ret = sem_wait(&m_geoSem);
}
while (ret < 0 && errno == EINTR);
}
diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx
index f5bef2054..994b918ae 100644
--- a/NxWidgets/nxwm/include/ctaskbar.hxx
+++ b/NxWidgets/nxwm/include/ctaskbar.hxx
@@ -166,6 +166,14 @@ namespace NxWM
bool redrawTaskbarWindow(void);
/**
+ * Redraw the window at the top of the heirarchy.
+ *
+ * @return true on success
+ */
+
+ bool redrawTopWindow(void);
+
+ /**
* (Re-)draw the background window.
*
* @return true on success
@@ -177,10 +185,11 @@ namespace NxWM
* Redraw the last application in the list of application maintained by
* the task bar.
*
+ * @param app. The new top application to draw
* @return true on success
*/
- bool redrawApplicationWindow(void);
+ bool redrawApplicationWindow(IApplication *app);
/**
* Handle a mouse button click event.
diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx
index cfdd7510e..59ae1e79d 100644
--- a/NxWidgets/nxwm/include/nxwmconfig.hxx
+++ b/NxWidgets/nxwm/include/nxwmconfig.hxx
@@ -100,13 +100,9 @@
* Color configuration
*
* CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
- * MKRGB(160,160,160)
+ * MKRGB(148,189,215)
* CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR - Select background color.
- * Default: MKRGB(120,192,192)
- * CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR - Normal "foreground" color. Default:
- * MKRGB(192,192,192)
- * CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR - Selected "foreground" color.
- * Default: MKRGB(192,192,192)
+ * Default: MKRGB(206,227,241)
* CONFIG_NXWM_DEFAULT_SHINEEDGECOLOR - Color of the bright edge of a border.
* Default: MKRGB(255,255,255)
* CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR - Color of the shadowed edge of a border.
@@ -122,7 +118,7 @@
*/
#ifndef CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR
-# define CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR MKRGB(160,160,160)
+# define CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR MKRGB(148,189,215)
#endif
/**
@@ -130,23 +126,7 @@
*/
#ifndef CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR
-# define CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(120,192,192)
-#endif
-
-/**
- * Default foreground color
- */
-
-#ifndef CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR
-# define CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR MKRGB(192,192,192)
-#endif
-
-/**
- * Default selected foreground color
- */
-
-#ifndef CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR
-# define CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR MKRGB(248,248,248)
+# define CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(206,227,241)
#endif
/**
diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx
index 8fd578c1a..c11f40090 100644
--- a/NxWidgets/nxwm/src/capplicationwindow.cxx
+++ b/NxWidgets/nxwm/src/capplicationwindow.cxx
@@ -168,7 +168,7 @@ bool CApplicationWindow::open(void)
// Get the CWidgetControl associated with this window
NXWidgets::CWidgetControl *control = m_toolbar->getWidgetControl();
- if (control)
+ if (!control)
{
return false;
}
diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx
index 1dba90c5a..7630a29b5 100644
--- a/NxWidgets/nxwm/src/ctaskbar.cxx
+++ b/NxWidgets/nxwm/src/ctaskbar.cxx
@@ -232,9 +232,9 @@ bool CTaskbar::startWindowManager(void)
return false;
}
- // Draw the application window
+ // Draw the top application window
- return redrawApplicationWindow();
+ return redrawTopWindow();
}
/**
@@ -368,27 +368,9 @@ bool CTaskbar::topApplication(IApplication *app)
if (!app->isMinimized())
{
- // Every application provides a method to obtain its application window
-
- CApplicationWindow *appWindow = app->getWindow();
-
- // Each application window provides a method to get the underlying NX window
-
- NXWidgets::CNxTkWindow *window = appWindow->getWindow();
-
- // Mark the window as the top application
-
- m_topapp = app;
- app->setTopApplication(true);
-
- // Raise the window to the top of the hierarchy
-
- window->raise();
-
- // And re-draw it
+ // It is not... Make the application the top application and redraw it
- app->redraw();
- return true;
+ return redrawApplicationWindow(app);
}
return false;
@@ -441,7 +423,7 @@ bool CTaskbar::minimizeApplication(IApplication *app)
app->setMinimized(true);
// And it certainly is no longer the top application. If it was before
- // then redrawApplicationWindow() will pick a new one (rather arbitrarily).
+ // then redrawTopWindow() will pick a new one (rather arbitrarily).
if (app->isTopApplication())
{
@@ -453,9 +435,9 @@ bool CTaskbar::minimizeApplication(IApplication *app)
window->lower();
- // And re-draw the next non-minimized application
+ // And re-draw the new top, non-minimized application
- return redrawApplicationWindow();
+ return redrawTopWindow();
}
return false;
@@ -708,10 +690,6 @@ bool CTaskbar::createTaskbarWindow(void)
m_taskbar->setPosition(&pos);
m_taskbar->setSize(&size);
-
- /* And raise the window to the top of the display */
-
- m_taskbar->raise();
return true;
}
@@ -734,10 +712,6 @@ bool CTaskbar::createBackgroundWindow(void)
// Set the geometry to fit in the application window space
setApplicationGeometry(static_cast<NXWidgets::INxWindow*>(m_background));
-
- /* The background window starts at the top display */
-
- m_background->raise();
return true;
}
@@ -932,6 +906,50 @@ bool CTaskbar::redrawTaskbarWindow(void)
}
/**
+ * Redraw the window at the top of the heirarchy.
+ *
+ * @return true on success
+ */
+
+bool CTaskbar::redrawTopWindow(void)
+{
+ // Check if there is already a top application
+
+ IApplication *app = m_topapp;
+ if (!app)
+ {
+ // No.. Search for that last, non-minimized application
+
+ for (int i = m_slots.size() - 1; i >= 0; i--)
+ {
+ IApplication *candidate = m_slots.at(i).app;
+ if (!candidate->isMinimized())
+ {
+ app = candidate;
+ break;
+ }
+ }
+ }
+
+ // Did we find one?
+
+ if (app)
+ {
+ // Yes.. make it the top application window and redraw it
+
+ return redrawApplicationWindow(app);
+ return true;
+ }
+ else
+ {
+ // Otherwise, there is no top application. Re-draw the background image.
+
+ m_topapp = (IApplication *)0;
+ return redrawBackgroundWindow();
+ }
+}
+
+/**
* (Re-)draw the background window.
*
* @return true on success
@@ -955,11 +973,21 @@ bool CTaskbar::redrawBackgroundWindow(void)
return false;
}
+ // Raise the background window to the top of the display
+
+ m_background->raise();
+
// Fill the entire window with the background color
port->drawFilledRect(0, 0, windowSize.w, windowSize.h,
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR);
+ // Add a border to the task bar to delineate it from the task bar
+
+ port->drawBevelledRect(0, 0, windowSize.w, windowSize.h,
+ CONFIG_NXWM_DEFAULT_SHINEEDGECOLOR,
+ CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR);
+
// Then re-draw the background image on the window
m_backImage->enableDrawing();
@@ -971,54 +999,37 @@ bool CTaskbar::redrawBackgroundWindow(void)
* Redraw the last application in the list of application maintained by
* the task bar.
*
+ * @param app. The new top application to draw
* @return true on success
*/
-bool CTaskbar::redrawApplicationWindow(void)
+bool CTaskbar::redrawApplicationWindow(IApplication *app)
{
- // Check if there is already a top application
+ // Every application provides a method to obtain its application window
- IApplication *app = m_topapp;
- if (!app)
- {
- // No.. Search for that last, non-minimized application
+ CApplicationWindow *appWindow = app->getWindow();
- for (int i = m_slots.size() - 1; i >= 0; i--)
- {
- IApplication *candidate = m_slots.at(i).app;
- if (!candidate->isMinimized())
- {
- app = candidate;
- break;
- }
- }
- }
+ // Each application window provides a method to get the underlying NX window
- // Did we find one?
+ NXWidgets::CNxTkWindow *window = appWindow->getWindow();
- if (app)
- {
- // Yes.. Then this is the new top application
+ // Mark the window as the top application
- m_topapp = app;
- app->setTopApplication(true);
+ m_topapp = app;
+ app->setTopApplication(true);
- // Disable drawing of the background image.
+ // Disable drawing of the background image.
- m_backImage->disableDrawing();
+ m_backImage->disableDrawing();
- // And.. Draw the application
+ // Raise the window to the top of the hierarchy
- app->redraw();
- return true;
- }
- else
- {
- // Otherwise, re-draw the background image
+ window->raise();
- m_topapp = (IApplication *)0;
- return redrawBackgroundWindow();
- }
+ // And re-draw it
+
+ app->redraw();
+ return true;
}
/**
diff --git a/nuttx/configs/sim/nxwm/defconfig b/nuttx/configs/sim/nxwm/defconfig
index 24996e895..74b5aea15 100644
--- a/nuttx/configs/sim/nxwm/defconfig
+++ b/nuttx/configs/sim/nxwm/defconfig
@@ -547,8 +547,14 @@ CONFIG_NX_MXCLIENTMSGS=16
#
# NxWidgets
#
+# Use all defaults except
+# 1. Need an especially big server stack size to work with X
+# 2. Make the NxWidgets background color match the NxWM back color
+#
CONFIG_NXWIDGETS_SERVERSTACK=16384
CONFIG_NXWIDGETS_LISTENERSTACK=8192
+CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215)
+CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241)
#
# NxConsole Configuration Settings: