summaryrefslogtreecommitdiff
path: root/NxWidgets/nxwm/src/cnxconsole.cxx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-18 23:08:34 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-18 23:08:34 +0000
commit6cf694d2da5a661373a58c70e3d8e07cc8223eed (patch)
tree8c305f903a5334c3b7b2a48830c6f63199dedfda /NxWidgets/nxwm/src/cnxconsole.cxx
parentf2307dd23f254c58cbc85bcf553ec583509a7082 (diff)
downloadnuttx-6cf694d2da5a661373a58c70e3d8e07cc8223eed.tar.gz
nuttx-6cf694d2da5a661373a58c70e3d8e07cc8223eed.tar.bz2
nuttx-6cf694d2da5a661373a58c70e3d8e07cc8223eed.zip
Final refactoring and implementation of delayed window deletion logic. Works worse now, but the changes are important and need to be checked in now
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4747 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/nxwm/src/cnxconsole.cxx')
-rw-r--r--NxWidgets/nxwm/src/cnxconsole.cxx37
1 files changed, 32 insertions, 5 deletions
diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx
index 577bf661e..64321ddfb 100644
--- a/NxWidgets/nxwm/src/cnxconsole.cxx
+++ b/NxWidgets/nxwm/src/cnxconsole.cxx
@@ -129,9 +129,14 @@ CNxConsole::CNxConsole(CTaskbar *taskbar, CApplicationWindow *window)
NXWidgets::CNxString myName = getName();
window->setWindowLabel(myName);
- // Add our callbacks to the application window
+ // Add our callbacks with the application window
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
+
+ // Add our messenger as the window callback
+
+ NXWidgets::CWidgetControl *control = window->getWidgetControl();
+ control->addWindowEventHandler(&m_messenger);
}
/**
@@ -147,13 +152,15 @@ CNxConsole::~CNxConsole(void)
stop();
+ // Remove ourself from the window callback
+
+ NXWidgets::CWidgetControl *control = m_window->getWidgetControl();
+ control->removeWindowEventHandler(&m_messenger);
+
// Although we didn't create it, we are responsible for deleting the
// application window
- if (m_window)
- {
- delete m_window;
- }
+ delete m_window;
}
/**
@@ -322,6 +329,26 @@ void CNxConsole::stop(void)
}
/**
+ * Destroy the application and free all of its resources. This method
+ * will initiate blocking of messages from the NX server. The server
+ * will flush the window message queue and reply with the blocked
+ * message. When the block message is received by CWindowMessenger,
+ * it will send the destroy message to the start window task which
+ * will, finally, safely delete the application.
+ */
+
+void CNxConsole::destroy(void)
+{
+ // Block any further window messages
+
+ m_window->block();
+
+ // Make sure that the application is stopped
+
+ stop();
+}
+
+/**
* The application window is hidden (either it is minimized or it is
* maximized, but not at the top of the hierarchy
*/