diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-19 01:01:00 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-19 01:01:00 +0000 |
commit | a591b9ca86b86684f2804cedf5d0c17a3614e913 (patch) | |
tree | b60235b0a038088298aa0f5497411fcb453c424d /NxWidgets/nxwm/src/cwindowmessenger.cxx | |
parent | 6cf694d2da5a661373a58c70e3d8e07cc8223eed (diff) | |
download | nuttx-a591b9ca86b86684f2804cedf5d0c17a3614e913.tar.gz nuttx-a591b9ca86b86684f2804cedf5d0c17a3614e913.tar.bz2 nuttx-a591b9ca86b86684f2804cedf5d0c17a3614e913.zip |
NxWM: Add a missing part of the message blocking logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4748 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/nxwm/src/cwindowmessenger.cxx')
-rw-r--r-- | NxWidgets/nxwm/src/cwindowmessenger.cxx | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/NxWidgets/nxwm/src/cwindowmessenger.cxx b/NxWidgets/nxwm/src/cwindowmessenger.cxx index 4e458566d..b467f533c 100644 --- a/NxWidgets/nxwm/src/cwindowmessenger.cxx +++ b/NxWidgets/nxwm/src/cwindowmessenger.cxx @@ -91,31 +91,6 @@ CWindowMessenger::~CWindowMessenger(void) } /** - * Destroy the application window and everything in it. This is - * handled by CWindowMessenger (vs just calling the destructors) because - * in the case where an application destroys itself (because of pressing - * the stop button), then we need to unwind and get out of the application - * logic before destroying all of its objects. - */ - -void CWindowMessenger::destroy(IApplication *app) -{ - // Send a message to destroy the window isntance at a later time - - struct SStartWindowMessage outmsg; - outmsg.msgId = MSGID_DESTROY_APP; - outmsg.instance = (FAR void *)app; - - gdbg("Sending MSGID_DESTROY_APP with instance=%p\n", app); - int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage), - CONFIG_NXWM_STARTWINDOW_MXMPRIO); - if (ret < 0) - { - gdbg("ERROR: mq_send failed: %d\n", errno); - } -} - -/** * Handle an NX window mouse input event. * * @param e The event data. @@ -208,3 +183,35 @@ void CWindowMessenger::handleKeyboardEvent(void) } } #endif + +/** + * Handle a NX window blocked event. This handler is called when we + * receive the BLOCKED message meaning that there are no further pending + * actions on the window. It is now safe to delete the window. + * + * This is handled by sending a message to the start window thread (vs just + * calling the destructors) because in the case where an application + * destroys itself (because of pressing the stop button), then we need to + * unwind and get out of the application logic before destroying all of its + * objects. + * + * @param arg - User provided argument (see nx_block or nxtk_block) + */ + +void CWindowMessenger::handleBlockedEvent(FAR void *arg) +{ + // Send a message to destroy the window isntance at a later time + + struct SStartWindowMessage outmsg; + outmsg.msgId = MSGID_DESTROY_APP; + outmsg.instance = arg; + + gdbg("Sending MSGID_DESTROY_APP with instance=%p\n", arg); + int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage), + CONFIG_NXWM_STARTWINDOW_MXMPRIO); + if (ret < 0) + { + gdbg("ERROR: mq_send failed: %d\n", errno); + } +} + |