From 8e6d6619e128567ef3216911e84ddaa8277206cc Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 3 May 2012 13:29:07 +0000 Subject: [PATCH] Minor task bar fixes git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4691 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- NxWidgets/nxwm/include/ctaskbar.hxx | 1 + NxWidgets/nxwm/src/ctaskbar.cxx | 62 ++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx index 7a6812901..c290cb8ae 100644 --- a/NxWidgets/nxwm/include/ctaskbar.hxx +++ b/NxWidgets/nxwm/include/ctaskbar.hxx @@ -99,6 +99,7 @@ namespace NxWM NXWidgets::CImage *m_backImage; /**< The background image */ IApplication *m_topApp; /**< The top application in the hierarchy */ TNxArray m_slots; /**< List of application slots in the task bar */ + bool m_started; /**< True if window manager has been started */ /** * Create a raw window. diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx index 1d754c0d5..2ba0c4b08 100644 --- a/NxWidgets/nxwm/src/ctaskbar.cxx +++ b/NxWidgets/nxwm/src/ctaskbar.cxx @@ -71,6 +71,7 @@ CTaskbar::CTaskbar(void) m_background = (NXWidgets::CNxWindow *)0; m_backImage = (NXWidgets::CImage *)0; m_topApp = (IApplication *)0; + m_started = false; } /** @@ -225,16 +226,27 @@ bool CTaskbar::initWindowManager(void) bool CTaskbar::startWindowManager(void) { - // Draw the taskbar + // Have we already been started - if (!redrawTaskbarWindow()) + if (!m_started) { - return false; + // We are now started + + m_started = true; + + // Draw the taskbar + + if (!redrawTaskbarWindow()) + { + return false; + } + + // Draw the top application window + + return redrawTopWindow(); } - // Draw the top application window - - return redrawTopWindow(); + return false; } /** @@ -334,18 +346,40 @@ bool CTaskbar::startApplication(IApplication *app, bool minimized) slot.image = image; m_slots.push_back(slot); - // Assume for now that this is not the top application - - hideApplicationWindow(app); - - // Then start the application (whatever that means) + // Start the application (whatever that means). if (!app->run()) { stopApplication(app); + image->disable(); return false; } + // Has the window manager been started? Or were we ask to start + // the application minimized? + + if (minimized || !m_started) + { + // Bring the application up in the minimized state + + hideApplicationWindow(app); + } + else + { + // Bring up the application as the new top application + + app->setTopApplication(false); + app->setMinimized(false); + topApplication(app); + } + + // Redraw the task bar with the new icon (if we have been started) + + if (m_started) + { + redrawTaskbarWindow(); + } + return true; } @@ -359,7 +393,7 @@ bool CTaskbar::startApplication(IApplication *app, bool minimized) bool CTaskbar::topApplication(IApplication *app) { - // Verify that the application is not minimized + // Verify that the application is not minimized and is not already the top application if (!app->isMinimized() && !app->isTopApplication()) { @@ -396,7 +430,7 @@ bool CTaskbar::maximizeApplication(IApplication *app) app->setMinimized(false); - // Then bring the appliation to the top of the hieararchy + // Then bring the application to the top of the hierarchy return topApplication(app); } @@ -867,8 +901,6 @@ bool CTaskbar::redrawTaskbarWindow(void) // Do we add icons left-to-right? Or top-to-bottom? - bool moveTo(nxgl_coord_t x, nxgl_coord_t y); - #if defined(CONFIG_NXWM_TASKBAR_TOP) || defined(CONFIG_NXWM_TASKBAR_BOTTOM) // left-to-right ... increment the X display position