From 2acf00c2cde3fd8f42d0ae7eb9df787310b85c41 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 May 2012 23:08:34 +0000 Subject: [PATCH] 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: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4747 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- NxWidgets/UnitTests/nxwm/main.cxx | 52 +++++++-- NxWidgets/libnxwidgets/include/ibitmap.hxx | 9 ++ NxWidgets/libnxwidgets/include/ilistbox.hxx | 8 ++ .../include/ilistdataeventhandler.hxx | 9 ++ NxWidgets/libnxwidgets/include/inxwindow.hxx | 8 ++ .../libnxwidgets/include/iscrollable.hxx | 9 ++ NxWidgets/libnxwidgets/include/islider.hxx | 8 ++ NxWidgets/libnxwidgets/include/itextbox.hxx | 8 ++ NxWidgets/libnxwidgets/src/ccallback.cxx | 2 +- NxWidgets/libnxwidgets/src/cnxwindow.cxx | 2 +- NxWidgets/nxwm/Makefile | 12 ++- NxWidgets/nxwm/doc/NxWM-ThreadingModel.ppt | Bin 92672 -> 126464 bytes NxWidgets/nxwm/include/capplicationwindow.hxx | 30 ++++-- NxWidgets/nxwm/include/ccalibration.hxx | 13 +++ NxWidgets/nxwm/include/cfullscreenwindow.hxx | 30 ++++-- NxWidgets/nxwm/include/cnxconsole.hxx | 21 +++- NxWidgets/nxwm/include/cstartwindow.hxx | 56 +++++----- NxWidgets/nxwm/include/ctaskbar.hxx | 37 ++----- ...windowcontrol.hxx => cwindowmessenger.hxx} | 27 ++--- NxWidgets/nxwm/include/iapplication.hxx | 29 +++-- NxWidgets/nxwm/include/iapplicationwindow.hxx | 41 +++++-- NxWidgets/nxwm/include/nxwmconfig.hxx | 2 +- NxWidgets/nxwm/src/capplicationwindow.cxx | 73 +++++++++---- NxWidgets/nxwm/src/ccalibration.cxx | 30 ++++++ NxWidgets/nxwm/src/cfullscreenwindow.cxx | 40 +++++-- NxWidgets/nxwm/src/cnxconsole.cxx | 37 ++++++- NxWidgets/nxwm/src/cstartwindow.cxx | 90 ++++++++++++++-- NxWidgets/nxwm/src/ctaskbar.cxx | 100 +++++++++++++++--- ...windowcontrol.cxx => cwindowmessenger.cxx} | 43 +++----- nuttx/configs/sim/nxwm/defconfig | 14 ++- nuttx/configs/stm3240g-eval/nxwm/defconfig | 4 +- nuttx/fs/nfs/rpc.h | 2 +- nuttx/graphics/nxmu/nx_disconnect.c | 7 +- 33 files changed, 621 insertions(+), 232 deletions(-) rename NxWidgets/nxwm/include/{cwindowcontrol.hxx => cwindowmessenger.hxx} (81%) rename NxWidgets/nxwm/src/{cwindowcontrol.cxx => cwindowmessenger.cxx} (87%) diff --git a/NxWidgets/UnitTests/nxwm/main.cxx b/NxWidgets/UnitTests/nxwm/main.cxx index 6a2e952d85..86ea324d5d 100644 --- a/NxWidgets/UnitTests/nxwm/main.cxx +++ b/NxWidgets/UnitTests/nxwm/main.cxx @@ -46,10 +46,13 @@ #include "ctaskbar.hxx" #include "cstartwindow.hxx" -#include "ctouchscreen.hxx" -#include "ccalibration.hxx" #include "cnxconsole.hxx" +#ifdef CONFIG_NXWM_TOUCHSCREEN +# include "ctouchscreen.hxx" +# include "ccalibration.hxx" +#endif + ///////////////////////////////////////////////////////////////////////////// // Pre-processor Definitions ///////////////////////////////////////////////////////////////////////////// @@ -67,10 +70,19 @@ #ifdef CONFIG_HAVE_FILENAME # define showTestStepMemory(msg) \ _showTestStepMemory((FAR const char*)__FILE__, (int)__LINE__, msg) -# define showTestCaseMemory(msg) \ - _showTestCaseMemory((FAR const char*)__FILE__, (int)__LINE__, msg) -# define showTestMemory(msg) \ - _showTestMemory((FAR const char*)__FILE__, (int)__LINE__, msg) +#endif + +#ifdef CONFIG_NXWIDGET_MEMMONITOR +# ifdef CONFIG_HAVE_FILENAME +# define showTestCaseMemory(msg) \ + _showTestCaseMemory((FAR const char*)__FILE__, (int)__LINE__, msg) +# define showTestMemory(msg) \ + _showTestMemory((FAR const char*)__FILE__, (int)__LINE__, msg) +# endif +#else +# define initMemoryUsage() +# define showTestCaseMemory(msg) +# define showTestMemory(msg) #endif ///////////////////////////////////////////////////////////////////////////// @@ -85,9 +97,11 @@ struct SNxWmTest NxWM::CTouchscreen *touchscreen; // The touchscreen struct NxWM::SCalibrationData calibData; // Calibration data #endif +#ifdef CONFIG_NXWIDGET_MEMMONITOR unsigned int mmInitial; // Initial memory usage unsigned int mmStep; // Memory Usage at beginning of test step unsigned int mmSubStep; // Memory Usage at beginning of test sub-step +#endif }; ///////////////////////////////////////////////////////////////////////////// @@ -112,6 +126,7 @@ extern "C" int MAIN_NAME(int argc, char *argv[]); // Name: updateMemoryUsage ///////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_NXWIDGET_MEMMONITOR #ifdef CONFIG_HAVE_FILENAME static void updateMemoryUsage(unsigned int *previous, FAR const char *file, int line, @@ -145,11 +160,13 @@ static void updateMemoryUsage(unsigned int *previous, *previous = mmcurrent.uordblks; } +#endif ///////////////////////////////////////////////////////////////////////////// // Name: showTestCaseMemory ///////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_NXWIDGET_MEMMONITOR #ifdef CONFIG_HAVE_FILENAME static void _showTestCaseMemory(FAR const char *file, int line, FAR const char *msg) { @@ -163,11 +180,13 @@ static void showTestCaseMemory(FAR const char *msg) g_nxwmtest.mmSubStep = g_nxwmtest.mmInitial; } #endif +#endif ///////////////////////////////////////////////////////////////////////////// // Name: showTestMemory ///////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_NXWIDGET_MEMMONITOR #ifdef CONFIG_HAVE_FILENAME static void _showTestMemory(FAR const char *file, int line, FAR const char *msg) { @@ -179,11 +198,13 @@ static void showTestMemory(FAR const char *msg) updateMemoryUsage(&g_nxwmtest.mmInitial, msg); } #endif +#endif ///////////////////////////////////////////////////////////////////////////// // Name: initMemoryUsage ///////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_NXWIDGET_MEMMONITOR static void initMemoryUsage(void) { struct mallinfo mmcurrent; @@ -198,6 +219,7 @@ static void initMemoryUsage(void) g_nxwmtest.mmStep = mmcurrent.uordblks; g_nxwmtest.mmSubStep = mmcurrent.uordblks; } +#endif ///////////////////////////////////////////////////////////////////////////// // Name: cleanup @@ -361,7 +383,7 @@ static bool startWindowManager(void) return false; } - showTestCaseMemory("AstartWindowManager: fter starting the window manager"); + showTestCaseMemory("startWindowManager: After starting the window manager"); return true; } @@ -497,12 +519,16 @@ static bool createNxConsole(void) #ifdef CONFIG_HAVE_FILENAME void _showTestStepMemory(FAR const char *file, int line, FAR const char *msg) { +#ifdef CONFIG_NXWIDGET_MEMMONITOR updateMemoryUsage(&g_nxwmtest.mmSubStep, file, line, msg); +#endif } #else void showTestStepMemory(FAR const char *msg) { +#ifdef CONFIG_NXWIDGET_MEMMONITOR updateMemoryUsage(&g_nxwmtest.mmSubStep, msg); +#endif } #endif @@ -608,19 +634,23 @@ int MAIN_NAME(int argc, char *argv[]) } #endif - // Wait a little bit for the display to stabilize. The simulation pressing of + // Wait a little bit for the display to stabilize. Then simulate pressing of // the 'start window' icon in the task bar #ifndef CONFIG_NXWM_TOUCHSCREEN sleep(2); - g_nxwmtest.taskbar->clickIcon(0); + g_nxwmtest.taskbar->clickIcon(0, true); + usleep(500*1000); + g_nxwmtest.taskbar->clickIcon(0, false); showTestCaseMemory(MAIN_STRING "After clicking the start window icon"); - // Wait bit to see the result of the button press. The press the first icon + // Wait bit to see the result of the button press. Then press the first icon // in the start menu. That should be the NxConsole icon. sleep(2); - g_nxwmtest.startwindow->clickIcon(0); + g_nxwmtest.startwindow->clickIcon(0, true); + usleep(500*1000); + g_nxwmtest.startwindow->clickIcon(0, false); showTestCaseMemory(MAIN_STRING "After clicking the NxConsole icon"); #endif diff --git a/NxWidgets/libnxwidgets/include/ibitmap.hxx b/NxWidgets/libnxwidgets/include/ibitmap.hxx index 5eaa5b3c95..923df407a8 100644 --- a/NxWidgets/libnxwidgets/include/ibitmap.hxx +++ b/NxWidgets/libnxwidgets/include/ibitmap.hxx @@ -102,6 +102,15 @@ namespace NXWidgets class IBitmap { public: + /** + * A virtual destructor is required in order to override the IBitmap + * destructor. We do this because if we delete IBitmap, we want the + * destructor of the class that inherits from IBitmap to run, not this + * one. + */ + + virtual ~IBitmap(void) { } + /** * Get the bitmap's color format. * diff --git a/NxWidgets/libnxwidgets/include/ilistbox.hxx b/NxWidgets/libnxwidgets/include/ilistbox.hxx index 9184f23c81..0eb33bc3b4 100644 --- a/NxWidgets/libnxwidgets/include/ilistbox.hxx +++ b/NxWidgets/libnxwidgets/include/ilistbox.hxx @@ -102,6 +102,14 @@ namespace NXWidgets class IListBox { public: + /** + * A virtual destructor is required in order to override the IListBox + * destructor. We do this because if we delete IListBox, we want the + * destructor of the class that inherits from IListBox to run, not this + * one. + */ + + virtual ~IListBox(void) { } /** * Add a new option to the widget using default colors. diff --git a/NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx b/NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx index b6119a2ae2..26bf1411b0 100644 --- a/NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx +++ b/NxWidgets/libnxwidgets/include/ilistdataeventhandler.hxx @@ -103,6 +103,15 @@ namespace NXWidgets class IListDataEventHandler { public: + /** + * A virtual destructor is required in order to override the IListDataEventHandler + * destructor. We do this because if we delete IListDataEventHandler, we want the + * destructor of the class that inherits from IListDataEventHandler to run, not this + * one. + */ + + virtual ~IListDataEventHandler(void) { } + /** * Handle data changes. * diff --git a/NxWidgets/libnxwidgets/include/inxwindow.hxx b/NxWidgets/libnxwidgets/include/inxwindow.hxx index c38052de02..750994a71b 100644 --- a/NxWidgets/libnxwidgets/include/inxwindow.hxx +++ b/NxWidgets/libnxwidgets/include/inxwindow.hxx @@ -79,6 +79,14 @@ namespace NXWidgets class INxWindow { public: + /** + * A virtual destructor is required in order to override the INxWindow + * destructor. We do this because if we delete INxWindow, we want the + * destructor of the class that inherits from INxWindow to run, not this + * one. + */ + + virtual ~INxWindow(void) { } /** * Creates a new window. Window creation is separate from diff --git a/NxWidgets/libnxwidgets/include/iscrollable.hxx b/NxWidgets/libnxwidgets/include/iscrollable.hxx index 21a69e487e..b0e65a9dbc 100644 --- a/NxWidgets/libnxwidgets/include/iscrollable.hxx +++ b/NxWidgets/libnxwidgets/include/iscrollable.hxx @@ -102,6 +102,15 @@ namespace NXWidgets class IScrollable { public: + /** + * A virtual destructor is required in order to override the IScrollable + * destructor. We do this because if we delete IScrollable, we want the + * destructor of the class that inherits from IScrollable to run, not this + * one. + */ + + virtual ~IScrollable(void) { } + /** * Gets the x coordinate of the virtual canvas. * diff --git a/NxWidgets/libnxwidgets/include/islider.hxx b/NxWidgets/libnxwidgets/include/islider.hxx index 5ea821e427..5a93409230 100644 --- a/NxWidgets/libnxwidgets/include/islider.hxx +++ b/NxWidgets/libnxwidgets/include/islider.hxx @@ -99,6 +99,14 @@ namespace NXWidgets class ISlider { public: + /** + * A virtual destructor is required in order to override the ISlider + * destructor. We do this because if we delete ISlider, we want the + * destructor of the class that inherits from ISlider to run, not this + * one. + */ + + virtual ~ISlider(void) { } /** * Get the smallest value that the slider can represent. diff --git a/NxWidgets/libnxwidgets/include/itextbox.hxx b/NxWidgets/libnxwidgets/include/itextbox.hxx index 78de7e5029..0e2e7b824e 100644 --- a/NxWidgets/libnxwidgets/include/itextbox.hxx +++ b/NxWidgets/libnxwidgets/include/itextbox.hxx @@ -115,6 +115,14 @@ namespace NXWidgets class ITextBox { public: + /** + * A virtual destructor is required in order to override the ITextBox + * destructor. We do this because if we delete ITextBox, we want the + * destructor of the class that inherits from ITextBox to run, not this + * one. + */ + + virtual ~ITextBox(void) { } /** * Sets the cursor display mode. diff --git a/NxWidgets/libnxwidgets/src/ccallback.cxx b/NxWidgets/libnxwidgets/src/ccallback.cxx index 09dc53a5aa..32c5b7d642 100644 --- a/NxWidgets/libnxwidgets/src/ccallback.cxx +++ b/NxWidgets/libnxwidgets/src/ccallback.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include diff --git a/NxWidgets/libnxwidgets/src/cnxwindow.cxx b/NxWidgets/libnxwidgets/src/cnxwindow.cxx index 5993359721..5ba4d734c4 100644 --- a/NxWidgets/libnxwidgets/src/cnxwindow.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwindow.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include diff --git a/NxWidgets/nxwm/Makefile b/NxWidgets/nxwm/Makefile index d951d11b26..b0b33c73d5 100644 --- a/NxWidgets/nxwm/Makefile +++ b/NxWidgets/nxwm/Makefile @@ -41,10 +41,16 @@ NXWIDGETDIR := $(NXWMDIR)/../libnxwidgets ASRCS = CSRCS = + + # Window Manager -CXXSRCS = capplicationwindow.cxx ccalibration.cxx cfullscreenwindow.cxx -CXXSRCS += cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx ctouchscreen.cxx -CXXSRCS += cwindowcontrol.cxx +CXXSRCS = capplicationwindow.cxx cfullscreenwindow.cxx cnxconsole.cxx +CXXSRCS += cstartwindow.cxx ctaskbar.cxx cwindowmessenger.cxx + +ifeq ($(CONFIG_NXWM_TOUCHSCREEN),y) +CXXSRCS += ccalibration.cxx ctouchscreen.cxx +endif + # Images CXXSRCS += glyph_calibration.cxx glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx CXXSRCS += glyph_play.cxx glyph_start.cxx glyph_stop.cxx diff --git a/NxWidgets/nxwm/doc/NxWM-ThreadingModel.ppt b/NxWidgets/nxwm/doc/NxWM-ThreadingModel.ppt index 382f69dd84bc787bb639cc4ffe0563e0affb942c..b532eaa659e45903c928aa6d20d60f0e62a4842c 100644 GIT binary patch delta 16011 zcmcgz3wTx4mEPyRZ*m_AAtZ!^oP<~cTtXly)+(Za5RgYO2%-`Lc`A}fLV^{z5wV?C zs^FffrdkBb=QmSl{KPwoV;SoMpQMP-b}TJup+4KD)wX_}V&-3K-<^AI&IMzf8d&Gv z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zdRBX^2JaXRHE0t(n6CMD;f6@&PMmd)2`1AJE3R1uoRo}5PMa1n_e>~&k<4LiQnl+E m9*oEn7*Zo2e~4WQ$0}1K@C{D+g&)IO>>}>MaxMG^j{FC8&~GXL diff --git a/NxWidgets/nxwm/include/capplicationwindow.hxx b/NxWidgets/nxwm/include/capplicationwindow.hxx index f923f28b48..686150d144 100644 --- a/NxWidgets/nxwm/include/capplicationwindow.hxx +++ b/NxWidgets/nxwm/include/capplicationwindow.hxx @@ -44,6 +44,7 @@ #include "cnxtkwindow.hxx" #include "cnxtoolbar.hxx" +#include "cwidgetcontrol.hxx" #include "cwidgeteventargs.hxx" #include "cwidgeteventhandler.hxx" #include "cimage.hxx" @@ -151,12 +152,19 @@ namespace NxWM NXWidgets::INxWindow *getWindow(void) const; /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ - CWindowControl *getWindowControl(void) const ; + NXWidgets::CWidgetControl *getWidgetControl(void) const; + + /** + * Block further activity on this window in preparation for window + * shutdown. + */ + + void block(void); /** * Set the window label @@ -195,21 +203,25 @@ namespace NxWM } /** - * Simulate a mouse click on the minimize icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickMinimizeIcon(int index); + void clickMinimizePosition(bool click); #endif /** - * Simulate a mouse click on the stop applicaiton icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickStopIcon(int index); + void clickStopIcon(bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/ccalibration.hxx b/NxWidgets/nxwm/include/ccalibration.hxx index 55cef6d848..e9b5d400f3 100644 --- a/NxWidgets/nxwm/include/ccalibration.hxx +++ b/NxWidgets/nxwm/include/ccalibration.hxx @@ -52,6 +52,7 @@ #include "ctaskbar.hxx" #include "iapplication.hxx" #include "cfullscreenwindow.hxx" +#include "cwindowmessenger.hxx" /**************************************************************************** * Pre-processor Definitions @@ -143,6 +144,7 @@ namespace NxWM * CCalibration state data */ + CWindowMessenger m_messenger; /**< Window event handler/messenger */ CTaskbar *m_taskbar; /**< The taskbar (used to terminate calibration) */ CFullScreenWindow *m_window; /**< The window for the calibration display */ CTouchscreen *m_touchscreen; /**< The touchscreen device */ @@ -289,6 +291,17 @@ namespace NxWM void 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 destroy(void); + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy diff --git a/NxWidgets/nxwm/include/cfullscreenwindow.hxx b/NxWidgets/nxwm/include/cfullscreenwindow.hxx index 2e3fbd45d5..1bab37543f 100644 --- a/NxWidgets/nxwm/include/cfullscreenwindow.hxx +++ b/NxWidgets/nxwm/include/cfullscreenwindow.hxx @@ -43,6 +43,7 @@ #include #include "cnxwindow.hxx" +#include "cwidgetcontrol.hxx" #include "iapplicationwindow.hxx" @@ -115,12 +116,19 @@ namespace NxWM NXWidgets::INxWindow *getWindow(void) const; /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ - CWindowControl *getWindowControl(void) const; + NXWidgets::CWidgetControl *getWidgetControl(void) const; + + /** + * Block further activity on this window in preparation for window + * shutdown. + */ + + void block(void); /** * Set the window label @@ -147,21 +155,25 @@ namespace NxWM void registerCallbacks(IApplicationCallback *callback); /** - * Simulate a mouse click on the minimize icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickMinimizeIcon(int index); + void clickMinimizePosition(bool click); #endif /** - * Simulate a mouse click on the stop applicaiton icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - void clickStopIcon(int index); + void clickStopIcon(bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/cnxconsole.hxx b/NxWidgets/nxwm/include/cnxconsole.hxx index b95c86406c..bf3606f053 100644 --- a/NxWidgets/nxwm/include/cnxconsole.hxx +++ b/NxWidgets/nxwm/include/cnxconsole.hxx @@ -49,6 +49,7 @@ #include "iapplication.hxx" #include "capplicationwindow.hxx" #include "ctaskbar.hxx" +#include "cwindowmessenger.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -78,10 +79,11 @@ namespace NxWM class CNxConsole : public IApplication, private IApplicationCallback { private: - CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ - CApplicationWindow *m_window; /**< Reference to the application window */ - NXCONSOLE m_nxcon; /**< NxConsole handle */ - pid_t m_pid; /**< Task ID of the NxConsole thread */ + CWindowMessenger m_messenger; /**< Window event handler/messenger */ + CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ + CApplicationWindow *m_window; /**< Reference to the application window */ + NXCONSOLE m_nxcon; /**< NxConsole handle */ + pid_t m_pid; /**< Task ID of the NxConsole thread */ /** * This is the NxConsole task. This function first redirects output to the @@ -166,6 +168,17 @@ namespace NxWM void 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 destroy(void); + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx index 8b5fd92d36..3a5325cb75 100644 --- a/NxWidgets/nxwm/include/cstartwindow.hxx +++ b/NxWidgets/nxwm/include/cstartwindow.hxx @@ -48,6 +48,7 @@ #include "iapplication.hxx" #include "capplicationwindow.hxx" +#include "cwindowmessenger.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -115,11 +116,12 @@ namespace NxWM * CStartWindow state data */ - CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ - CApplicationWindow *m_window; /**< Reference to the application window */ - TNxArray m_slots; /**< List of apps in the start window */ - struct nxgl_size_s m_iconSize; /**< A box big enough to hold the largest icon */ - pid_t m_taskId; /**< ID of the start window task */ + CWindowMessenger m_messenger; /**< Window event handler/messenger */ + CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */ + CApplicationWindow *m_window; /**< Reference to the application window */ + TNxArray m_slots; /**< List of apps in the start window */ + struct nxgl_size_s m_iconSize; /**< A box big enough to hold the largest icon */ + pid_t m_taskId; /**< ID of the start window task */ /** * This is the start window task. This function receives window events from @@ -138,8 +140,8 @@ namespace NxWM * 4. NXWidgets::CWidgetControl records the new state data and raises a * window event. * 5. NXWidgets::CWindowEventHandlerList will give the event to - * NxWM::CWindowControl. - * 6. NxWM::CWindowControl will send the a message on a well-known message + * NxWM::CWindowMessenger. + * 6. NxWM::CWindowMessenger will send the a message on a well-known message * queue. * 7. This CStartWindow::startWindow task will receive and process that * message. @@ -235,6 +237,17 @@ namespace NxWM void 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 destroy(void); + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy) @@ -275,32 +288,15 @@ namespace NxWM bool addApplication(IApplicationFactory *app); /** - * Simulate a mouse click on the icon at index. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the icon at index. This method + * is only available during automated testing of NxWM. + * + * @param index. Selects the icon in the start window + * @param click. True to click and false to release */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - inline void clickIcon(int index) - { - if (index < m_slots.size()) - { - // Get the image widget at this index - - NXWidgets::CImage *image = m_slots.at(index).image; - - // Get the size and position of the widget - - struct nxgl_size_s imageSize; - image->getSize(imageSize); - - struct nxgl_point_s imagePos; - image->getPos(imagePos); - - // And click the image at its center - - image->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1)); - } - } + void clickIcon(int index, bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx index cf98d10d9f..a78fb17394 100644 --- a/NxWidgets/nxwm/include/ctaskbar.hxx +++ b/NxWidgets/nxwm/include/ctaskbar.hxx @@ -110,12 +110,12 @@ namespace NxWM /** * Create a raw window. * - * 1) Create a dumb CWindowControl instance - * 2) Pass the dumb CWindowControl instance to the window constructor - * that inherits from INxWindow. This will "smarten" the CWindowControl + * 1) Create a dumb NXWidgets::CWidgetControl instance + * 2) Pass the dumb NXWidgets::CWidgetControl instance to the window constructor + * that inherits from INxWindow. This will "smarten" the NXWidgets::CWidgetControl * instance with some window knowlede * 3) Call the open() method on the window to display the window. - * 4) After that, the fully smartened CWindowControl instance can + * 4) After that, the fully smartened NXWidgets::CWidgetControl instance can * be used to generate additional widgets by passing it to the * widget constructor */ @@ -398,32 +398,15 @@ namespace NxWM void getDisplaySize(FAR struct nxgl_size_s &size); /** - * Simulate a mouse click on the icon at index. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the icon at index. This method + * is only available during automated testing of NxWM. + * + * @param index. Selects the icon in the start window + * @param click. True to click and false to release */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - inline void clickIcon(int index) - { - if (index < m_slots.size()) - { - // Get the image widget at this index - - NXWidgets::CImage *image = m_slots.at(index).image; - - // Get the size and position of the widget - - struct nxgl_size_s imageSize; - image->getSize(imageSize); - - struct nxgl_point_s imagePos; - image->getPos(imagePos); - - // And click the image at its center - - image->click(imagePos.x + (imageSize.w >> 1), imagePos.y + (imageSize.h >> 1)); - } - } + void clickIcon(int index, bool click); #endif }; } diff --git a/NxWidgets/nxwm/include/cwindowcontrol.hxx b/NxWidgets/nxwm/include/cwindowmessenger.hxx similarity index 81% rename from NxWidgets/nxwm/include/cwindowcontrol.hxx rename to NxWidgets/nxwm/include/cwindowmessenger.hxx index 91e430c5c0..645e750cb1 100644 --- a/NxWidgets/nxwm/include/cwindowcontrol.hxx +++ b/NxWidgets/nxwm/include/cwindowmessenger.hxx @@ -1,5 +1,5 @@ /**************************************************************************** - * NxWidgets/nxwm/include/cwindowcontrol.hxx + * NxWidgets/nxwm/include/cwindowmessenger.hxx * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_CWINDOWCONTROL_HXX -#define __INCLUDE_CWINDOWCONTROL_HXX +#ifndef __INCLUDE_CWINDOWMESSENGER_HXX +#define __INCLUDE_CWINDOWMESSENGER_HXX /**************************************************************************** * Included Files @@ -70,12 +70,11 @@ namespace NxWM class IApplication; /** - * The class CWindowControl integrates the widget control with some special + * The class CWindowMessenger integrates the widget control with some special * handling of mouse and keyboard inputs neesed by NxWM */ - class CWindowControl : public NXWidgets::CWidgetControl, - private NXWidgets::CWindowEventHandler + class CWindowMessenger : public NXWidgets::CWindowEventHandler { private: mqd_t m_mqd; /**< Message queue descriptor used to commincate with the @@ -102,24 +101,20 @@ namespace NxWM public: /** - * Constructor - * - * @param style The default style that all widgets on this display - * should use. If this is not specified, the widget will use the - * values stored in the defaultCWidgetStyle object. + * CWindowMessenger Constructor */ - CWindowControl(FAR const NXWidgets::CWidgetStyle *style = (const NXWidgets::CWidgetStyle *)NULL); + CWindowMessenger(void); /** - * Destructor. + * CWindowMessenger Destructor. */ - ~CWindowControl(void); + ~CWindowMessenger(void); /** * Destroy the application window and everything in it. This is - * handled by CWindowControl (vs just calling the destructors) because + * 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. @@ -130,4 +125,4 @@ namespace NxWM } #endif // __cplusplus -#endif // __INCLUDE_CWINDOWCONTROL_HXX +#endif // __INCLUDE_CWINDOWMESSENGER_HXX diff --git a/NxWidgets/nxwm/include/iapplication.hxx b/NxWidgets/nxwm/include/iapplication.hxx index 45067d900a..28e50e0136 100644 --- a/NxWidgets/nxwm/include/iapplication.hxx +++ b/NxWidgets/nxwm/include/iapplication.hxx @@ -45,8 +45,7 @@ #include "cnxstring.hxx" #include "ibitmap.hxx" -#include "cwindowcontrol.hxx" -#include "capplicationwindow.hxx" +#include "iapplicationwindow.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -93,18 +92,6 @@ namespace NxWM virtual IApplicationWindow *getWindow(void) const = 0; - /** - * Get the window widget control. - * - * @return The widget control of the underlying window instance. - */ - - virtual inline CWindowControl *getWindowControl(void) const - { - IApplicationWindow *window = getWindow(); - return window->getWindowControl(); - } - /** * Get the icon associated with the application * @@ -132,11 +119,23 @@ namespace NxWM virtual bool run(void) = 0; /** - * Stop the application. + * Stop the application, put all widgets in a deactivated/disabled state + * and wait to see what happens next. */ virtual void stop(void) = 0; + /** + * 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. + */ + + virtual void destroy(void) = 0; + /** * The application window is hidden (either it is minimized or it is * maximized, but not at the top of the hierarchy diff --git a/NxWidgets/nxwm/include/iapplicationwindow.hxx b/NxWidgets/nxwm/include/iapplicationwindow.hxx index fe8830c2fa..ed221797d4 100644 --- a/NxWidgets/nxwm/include/iapplicationwindow.hxx +++ b/NxWidgets/nxwm/include/iapplicationwindow.hxx @@ -44,8 +44,7 @@ #include "inxwindow.hxx" #include "cnxstring.hxx" - -#include "cwindowcontrol.hxx" +#include "cwidgetcontrol.hxx" /**************************************************************************** * Pre-Processor Definitions @@ -88,6 +87,15 @@ namespace NxWM class IApplicationWindow { public: + /** + * A virtual destructor is required in order to override the IApplicationWindow + * destructor. We do this because if we delete IApplicationWindow, we want the + * destructor of the class that inherits from IApplicationWindow to run, not this + * one. + */ + + virtual ~IApplicationWindow(void) { } + /** * Initialize window. Window initialization is separate from * object instantiation so that failures can be reported. @@ -119,12 +127,19 @@ namespace NxWM virtual NXWidgets::INxWindow *getWindow(void) const = 0; /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ - virtual CWindowControl *getWindowControl(void) const = 0; + virtual NXWidgets::CWidgetControl *getWidgetControl(void) const = 0; + + /** + * Block further activity on this window in preparation for window + * shutdown. + */ + + virtual void block(void) = 0; /** * Set the window label @@ -151,21 +166,25 @@ namespace NxWM virtual void registerCallbacks(IApplicationCallback *callback) = 0; /** - * Simulate a mouse click on the minimize icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - virtual void clickMinimizeIcon(int index) = 0; + virtual void clickMinimizePosition(bool click) = 0; #endif /** - * Simulate a mouse click on the stop applicaiton icon. This inline method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) - virtual void clickStopIcon(int index) = 0; + virtual void clickStopIcon(bool click) = 0; #endif }; } diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx index 3605f8c4fc..25a8beb662 100644 --- a/NxWidgets/nxwm/include/nxwmconfig.hxx +++ b/NxWidgets/nxwm/include/nxwmconfig.hxx @@ -264,7 +264,7 @@ * CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows * CONFIG_NXWM_STARTWINDOW_ICON - The glyph to use as the start window icon * CONFIG_NXWM_STARTWINDOW_MQNAME - The well known name of the message queue - * Used to communicated from CWindowControl tothe start window thread. + * Used to communicated from CWindowMessenger to the start window thread. * Default: "/dev/nxwm" * CONFIG_NXWM_STARTWINDOW_MXMSGS - The maximum number of messages to queue * before blocking. Defualt 32 diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx index 15d4a4a9d0..c0bc9ed62c 100644 --- a/NxWidgets/nxwm/src/capplicationwindow.cxx +++ b/NxWidgets/nxwm/src/capplicationwindow.cxx @@ -47,7 +47,6 @@ #include "nxwmconfig.hxx" #include "nxwmglyphs.hxx" -#include "cwindowcontrol.hxx" #include "capplicationwindow.hxx" /******************************************************************************************** @@ -153,9 +152,9 @@ CApplicationWindow::~CApplicationWindow(void) bool CApplicationWindow::open(void) { - // Create one of our special window controls for the tool bar + // Create a widget control for the tool bar - CWindowControl *control = new CWindowControl(); + NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl(); if (!control) { return false; @@ -414,15 +413,31 @@ NXWidgets::INxWindow *CApplicationWindow::getWindow(void) const } /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ -CWindowControl *CApplicationWindow::getWindowControl(void) const +NXWidgets::CWidgetControl *CApplicationWindow::getWidgetControl(void) const { + return m_window->getWidgetControl(); +} + +/** + * Block further activity on this window in preparation for window + * shutdown. + */ + +void CApplicationWindow::block(void) +{ + // Get the widget control from the NXWidgets::CNxWindow instance + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); - return static_cast(control); + + // And then block further reporting activity on the underlying + // NX framed window + + nxtk_block(control->getWindowHandle()); } /** @@ -459,12 +474,14 @@ void CApplicationWindow::registerCallbacks(IApplicationCallback *callback) } /** - * Simulate a mouse click on the minimize icon. This method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) -void CApplicationWindow::clickMinimizeIcon(int index) +void CApplicationWindow::clickMinimizePosition(bool click) { // Get the size and position of the widget @@ -474,20 +491,30 @@ void CApplicationWindow::clickMinimizeIcon(int index) struct nxgl_point_s imagePos; m_minimizeImage->getPos(imagePos); - // And click the image at its center + // And click or release the image at its center - m_minimizeImage->click(imagePos.x + (imageSize.w >> 1), - imagePos.y + (imageSize.h >> 1)); + if (click) + { + m_minimizeImage->click(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } + else + { + m_minimizeImage->release(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } } #endif /** - * Simulate a mouse click on the stop applicaiton icon. This method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) -void CApplicationWindow::clickStopIcon(int index) +void CApplicationWindow::clickStopIcon(bool click) { // The stop icon will not be available for "persistent" applications @@ -501,10 +528,18 @@ void CApplicationWindow::clickStopIcon(int index) struct nxgl_point_s imagePos; m_stopImage->getPos(imagePos); - // And click the image at its center + // And click or release the image at its center - m_stopImage->click(imagePos.x + (imageSize.w >> 1), - imagePos.y + (imageSize.h >> 1)); + if (click) + { + m_stopImage->click(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } + else + { + m_stopImage->release(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } } } #endif diff --git a/NxWidgets/nxwm/src/ccalibration.cxx b/NxWidgets/nxwm/src/ccalibration.cxx index 248aca8389..d93f56a47a 100644 --- a/NxWidgets/nxwm/src/ccalibration.cxx +++ b/NxWidgets/nxwm/src/ccalibration.cxx @@ -99,6 +99,11 @@ CCalibration::CCalibration(CTaskbar *taskbar, CFullScreenWindow *window, m_calthread = CALTHREAD_NOTRUNNING; m_calphase = CALPHASE_NOT_STARTED; m_touched = false; + + // Add our messenger as the window callback + + NXWidgets::CWidgetControl *control = window->getWidgetControl(); + control->addWindowEventHandler(&m_messenger); } /** @@ -112,6 +117,11 @@ CCalibration::~CCalibration(void) stop(); + // Remove ourself from the window callback + + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); + control->removeWindowEventHandler(&m_messenger); + // Although we did not create the window, the rule is that I have to dispose // of it @@ -199,6 +209,26 @@ void CCalibration::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 CCalibration::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 it is not at the top of the hierarchy) diff --git a/NxWidgets/nxwm/src/cfullscreenwindow.cxx b/NxWidgets/nxwm/src/cfullscreenwindow.cxx index 40647d8e90..0c34166c06 100644 --- a/NxWidgets/nxwm/src/cfullscreenwindow.cxx +++ b/NxWidgets/nxwm/src/cfullscreenwindow.cxx @@ -128,15 +128,31 @@ NXWidgets::INxWindow *CFullScreenWindow::getWindow(void) const } /** - * Recover the contained window control + * Recover the contained widget control * - * @return. The window control used by this application + * @return. The widget control used by this application */ -CWindowControl *CFullScreenWindow::getWindowControl(void) const +NXWidgets::CWidgetControl *CFullScreenWindow::getWidgetControl(void) const { + return m_window->getWidgetControl(); +} + +/** + * Block further activity on this window in preparation for window + * shutdown. + */ + +void CFullScreenWindow::block(void) +{ + // Get the widget control from the NXWidgets::CNxWindow instance + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); - return static_cast(control); + + // And then block further reporting activity on the underlying + // NX raw window + + nx_block(control->getWindowHandle()); } /** @@ -171,23 +187,27 @@ void CFullScreenWindow::registerCallbacks(IApplicationCallback *callback) } /** - * Simulate a mouse click on the minimize icon. This method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the minimize icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) -void CFullScreenWindow::clickMinimizeIcon(int index) +void CFullScreenWindow::clickMinimizePosition(bool click) { } #endif /** - * Simulate a mouse click on the stop applicaiton icon. This method is only - * used during automated testing of NxWM. + * Simulate a mouse click or release on the stop icon. This method + * is only available for automated testing of NxWM. + * + * @param click. True to click; false to release; */ #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) -void CFullScreenWindow::clickStopIcon(int index) +void CFullScreenWindow::clickStopIcon(bool click) { } #endif diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx index 577bf661e0..64321ddfbf 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(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; } /** @@ -321,6 +328,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 diff --git a/NxWidgets/nxwm/src/cstartwindow.cxx b/NxWidgets/nxwm/src/cstartwindow.cxx index 2b7ecbe66d..3dfab50975 100644 --- a/NxWidgets/nxwm/src/cstartwindow.cxx +++ b/NxWidgets/nxwm/src/cstartwindow.cxx @@ -99,6 +99,11 @@ CStartWindow::CStartWindow(CTaskbar *taskbar, CApplicationWindow *window) // Add our callbacks to the application window window->registerCallbacks(static_cast(this)); + + // Add our messenger as the window callback + + NXWidgets::CWidgetControl *control = window->getWidgetControl(); + control->addWindowEventHandler(&m_messenger); } /** @@ -112,13 +117,15 @@ CStartWindow::~CStartWindow(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; // Then stop and delete all applications @@ -211,6 +218,28 @@ void CStartWindow::stop(void) task_delete(pid); } } +/** + * 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 CStartWindow::destroy(void) +{ + // What are we doing? This should never happen because the start + // window task is persistent! + + // 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 @@ -404,6 +433,47 @@ bool CStartWindow::addApplication(IApplicationFactory *app) return true; } +/** + * Simulate a mouse click or release on the icon at index. This method + * is only available during automated testing of NxWM. + * + * @param index. Selects the icon in the start window + * @param click. True to click and false to release + */ + +#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) +void CStartWindow::clickIcon(int index, bool click) +{ + if (index < m_slots.size()) + { + // Get the image widget at this index + + NXWidgets::CImage *image = m_slots.at(index).image; + + // Get the size and position of the widget + + struct nxgl_size_s imageSize; + image->getSize(imageSize); + + struct nxgl_point_s imagePos; + image->getPos(imagePos); + + // And click or release the image at its center + + if (click) + { + image->click(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } + else + { + image->release(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } + } +} +#endif + /** * Called when the window minimize button is pressed. */ @@ -523,11 +593,11 @@ void CStartWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e) } else { - // If we cannot start the app. Destroy the - // instance we created and see what happens next. + // If we cannot start the app. Destroy the instance we + // created and see what happens next. Could be interesting. - CWindowControl *control = app->getWindowControl(); - control->destroy(app); + app->stop(); + app->destroy(); } } } @@ -548,8 +618,8 @@ void CStartWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e) * 4. NXWidgets::CWidgetControl records the new state data and raises a * window event. * 5. NXWidgets::CWindowEventHandlerList will give the event to - * NxWM::CWindowControl. - * 6. NxWM::CWindowControl will send the a message on a well-known message + * NxWM::CWindowMessenger. + * 6. NxWM::CWindowMessenger will send the a message on a well-known message * queue. * 7. This CStartWindow::startWindow task will receive and process that * message. diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx index ab686f81cc..b4df0bb862 100644 --- a/NxWidgets/nxwm/src/ctaskbar.cxx +++ b/NxWidgets/nxwm/src/ctaskbar.cxx @@ -47,7 +47,6 @@ #include "cwidgetcontrol.hxx" #include "cnxtkwindow.hxx" -#include "cwindowcontrol.hxx" #include "ctaskbar.hxx" /******************************************************************************************** @@ -68,11 +67,11 @@ using namespace NxWM; CTaskbar::CTaskbar(void) { - m_taskbar = (NXWidgets::CNxWindow *)0; - m_background = (NXWidgets::CNxWindow *)0; - m_backImage = (NXWidgets::CImage *)0; - m_topApp = (IApplication *)0; - m_started = false; + m_taskbar = (NXWidgets::CNxWindow *)0; + m_background = (NXWidgets::CNxWindow *)0; + m_backImage = (NXWidgets::CImage *)0; + m_topApp = (IApplication *)0; + m_started = false; } /** @@ -81,6 +80,9 @@ CTaskbar::CTaskbar(void) CTaskbar::~CTaskbar(void) { + // The disconnect,putting the instance back in the state that it + // was before it was constructed. + disconnect(); } @@ -107,7 +109,8 @@ bool CTaskbar::connect(void) } /** - * Disconnect from the server + * Disconnect from the server. This method restores the taskbar to the + * same state that it was in when it was constructed. */ void CTaskbar::disconnect(void) @@ -141,6 +144,7 @@ void CTaskbar::disconnect(void) // Then delete the task bar window delete m_taskbar; + m_taskbar = (NXWidgets::CNxWindow *)0; } if (m_background) @@ -157,8 +161,22 @@ void CTaskbar::disconnect(void) // Then delete the background delete m_background; + m_background = (NXWidgets::CNxWindow *)0; } + // Delete the background image + + if (m_backImage) + { + delete m_backImage; + m_backImage = (NXWidgets::CImage *)0; + } + + // Reset other variables + + m_topApp = (IApplication *)0; + m_started = false; + // And disconnect from the server CNxServer::disconnect(); @@ -279,7 +297,9 @@ bool CTaskbar::startWindowManager(void) continue; } - // Hide all appliations except for the top application + // Hide all applications except for the top application. NOTE: + // topIndex may still be -1, meaning that there is no application + // and that all applications should be hidden. if (i != topIndex) { @@ -303,6 +323,17 @@ bool CTaskbar::startWindowManager(void) i++; } + // If there is no top appliation (i.e., no applications or all applications + // are minimized), then draw the background image + + if (!m_topApp) + { + if (!redrawBackgroundWindow()) + { + return false; + } + } + // Draw the taskbar. It will be draw at a higher level than the application. return redrawTaskbarWindow(); @@ -418,7 +449,7 @@ bool CTaskbar::startApplication(IApplication *app, bool minimized) { // Get the widget control associated with the task bar window - NXWidgets::CWidgetControl *control = m_taskbar->getWidgetControl(); + NXWidgets::CWidgetControl *control = m_taskbar->getWidgetControl(); // Get the bitmap icon that goes with this application @@ -633,10 +664,10 @@ bool CTaskbar::stopApplication(IApplication *app) } } - // destroy the application + // Destroy the application (actually, this just sets up the application for + // later destruction. - CWindowControl *control = app->getWindowControl(); - control->destroy(app); + app->destroy(); // Re-draw the new top, non-minimized application @@ -673,6 +704,47 @@ void CTaskbar::getDisplaySize(FAR struct nxgl_size_s &size) rect.getSize(size); } +/** + * Simulate a mouse click or release on the icon at index. This method + * is only available during automated testing of NxWM. + * + * @param index. Selects the icon in the start window + * @param click. True to click and false to release + */ + +#if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN) +void CTaskbar::clickIcon(int index, bool click) +{ + if (index < m_slots.size()) + { + // Get the image widget at this index + + NXWidgets::CImage *image = m_slots.at(index).image; + + // Get the size and position of the widget + + struct nxgl_size_s imageSize; + image->getSize(imageSize); + + struct nxgl_point_s imagePos; + image->getPos(imagePos); + + // And click or release the image at its center + + if (click) + { + image->click(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } + else + { + image->release(imagePos.x + (imageSize.w >> 1), + imagePos.y + (imageSize.h >> 1)); + } + } +} +#endif + /** * Create a raw window. * @@ -690,7 +762,7 @@ NXWidgets::CNxWindow *CTaskbar::openRawWindow(void) { // Initialize the widget control using the default style - CWindowControl *control = new CWindowControl((NXWidgets::CWidgetStyle *)NULL); + NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl((NXWidgets::CWidgetStyle *)NULL); // Get an (uninitialized) instance of the background window as a class // that derives from INxWindow. @@ -727,7 +799,7 @@ NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void) { // Initialize the widget control using the default style - CWindowControl *control = new CWindowControl((NXWidgets::CWidgetStyle *)NULL); + NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl((NXWidgets::CWidgetStyle *)NULL); // Get an (uninitialized) instance of the framed window as a class // that derives from INxWindow. diff --git a/NxWidgets/nxwm/src/cwindowcontrol.cxx b/NxWidgets/nxwm/src/cwindowmessenger.cxx similarity index 87% rename from NxWidgets/nxwm/src/cwindowcontrol.cxx rename to NxWidgets/nxwm/src/cwindowmessenger.cxx index 6c2144bad7..4e458566d3 100644 --- a/NxWidgets/nxwm/src/cwindowcontrol.cxx +++ b/NxWidgets/nxwm/src/cwindowmessenger.cxx @@ -1,5 +1,5 @@ /******************************************************************************************** - * NxWidgets/nxwm/src/cwindowcontrol.cxx + * NxWidgets/nxwm/src/cwindowmessenger.cxx * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -46,28 +46,23 @@ #include "nxwmconfig.hxx" #include "cstartwindow.hxx" -#include "cwindowcontrol.hxx" +#include "cwindowmessenger.hxx" /******************************************************************************************** * Pre-Processor Definitions ********************************************************************************************/ /******************************************************************************************** - * CWindowControl Method Implementations + * CWindowMessenger Method Implementations ********************************************************************************************/ using namespace NxWM; /** - * Constructor - * - * @param style The default style that all widgets on this display - * should use. If this is not specified, the widget will use the - * values stored in the defaultCWidgetStyle object. + * CWindowMessenger Constructor */ -CWindowControl::CWindowControl(FAR const NXWidgets::CWidgetStyle *style) -: NXWidgets::CWidgetControl(style) +CWindowMessenger::CWindowMessenger(void) { // Open a message queue to communicate with the start window task. We need to create // the message queue if it does not exist. @@ -82,36 +77,28 @@ CWindowControl::CWindowControl(FAR const NXWidgets::CWidgetStyle *style) { gdbg("ERROR: mq_open(%s) failed: %d\n", g_startWindowMqName, errno); } - - // Add ourself as the window callback - - addWindowEventHandler(this); } /** - * Destructor. + * CWindowMessenger Destructor. */ -CWindowControl::~CWindowControl(void) +CWindowMessenger::~CWindowMessenger(void) { // Close the message queue (void)mq_close(m_mqd); - - // Remove ourself from the window callback - - removeWindowEventHandler(this); } /** * Destroy the application window and everything in it. This is - * handled by CWindowControl (vs just calling the destructors) because + * 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 CWindowControl::destroy(IApplication *app) +void CWindowMessenger::destroy(IApplication *app) { // Send a message to destroy the window isntance at a later time @@ -135,7 +122,7 @@ void CWindowControl::destroy(IApplication *app) */ #ifdef CONFIG_NX_MOUSE -void CWindowControl::handleMouseEvent(void) +void CWindowMessenger::handleMouseEvent(void) { // The logic path here is tortuous but flexible: // @@ -157,8 +144,8 @@ void CWindowControl::handleMouseEvent(void) // 7. NXWidgets::CWidgetControl records the new state data and raises a // window event. // 8. NXWidgets::CWindowEventHandlerList will give the event to this method - // NxWM::CWindowControl. - // 9. This NxWM::CWindowControl method will send the a message on a well- + // NxWM::CWindowMessenger. + // 9. This NxWM::CWindowMessenger method will send the a message on a well- // known message queue. // 10. This CStartWindow::startWindow task will receive and process that // message by calling CWidgetControl::pollEvents() @@ -181,7 +168,7 @@ void CWindowControl::handleMouseEvent(void) */ #ifdef CONFIG_NX_KBD -void CWindowControl::handleKeyboardEvent(void) +void CWindowMessenger::handleKeyboardEvent(void) { // The logic path here is tortuous but flexible: // @@ -203,8 +190,8 @@ void CWindowControl::handleKeyboardEvent(void) // 7. NXWidgets::CWidgetControl records the new state data and raises a // window event. // 8. NXWidgets::CWindowEventHandlerList will give the event to this method - // NxWM::CWindowControl. - // 9. This NxWM::CWindowControl method will send the a message on a well- + // NxWM::CWindowMessenger. + // 9. This NxWM::CWindowMessenger method will send the a message on a well- // known message queue. // 10. This CStartWindow::startWindow task will receive and process that // message by calling CWidgetControl::pollEvents() diff --git a/nuttx/configs/sim/nxwm/defconfig b/nuttx/configs/sim/nxwm/defconfig index 75afe862a9..3daa60f668 100644 --- a/nuttx/configs/sim/nxwm/defconfig +++ b/nuttx/configs/sim/nxwm/defconfig @@ -162,6 +162,7 @@ CONFIG_SIM_TOUCHSCREEN=n # the worker thread. Default: 4 # CONFIG_SCHED_WAITPID - Enable the waitpid() API # CONFIG_SCHED_ATEXIT - Enabled the atexit() API +# CONFIG_SCHED_ONEXIT - Enabled the on_exit() API # #CONFIG_APPS_DIR= CONFIG_DEBUG=n @@ -195,6 +196,7 @@ CONFIG_SCHED_WORKPERIOD=(50*1000) CONFIG_SCHED_WORKSTACKSIZE=8192 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n +CONFIG_SCHED_ONEXIT=y # # The following can be used to disable categories of @@ -557,11 +559,14 @@ CONFIG_NX_MXCLIENTMSGS=16 # NxWidgets / NxWM # # 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 -# 3. Taskbar on the left -# 4. Bigger stack for NxConsole +# 1. 32 bits-per-pixel +# 2. Need an especially big server stack size to work with X +# 3. Make the NxWidgets background color match the NxWM back color +# 4. Taskbar on the left +# 5. Bigger stack for NxConsole +# 6. No touchscreen # +CONFIG_NXWIDGETS_BPP=32 CONFIG_NXWIDGETS_SERVERSTACK=16384 CONFIG_NXWIDGETS_LISTENERSTACK=8192 CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215) @@ -571,6 +576,7 @@ CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=MKRGB(35,58,73) CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_NXCONSOLE_STACKSIZE=8192 CONFIG_NXWM_UNITTEST=y +CONFIG_NXWM_TOUCHSCREEN=n # # NxConsole Configuration Settings: diff --git a/nuttx/configs/stm3240g-eval/nxwm/defconfig b/nuttx/configs/stm3240g-eval/nxwm/defconfig index 0633a03f4b..2a3cf3c86d 100644 --- a/nuttx/configs/stm3240g-eval/nxwm/defconfig +++ b/nuttx/configs/stm3240g-eval/nxwm/defconfig @@ -512,7 +512,7 @@ CONFIG_HAVE_LIBM=n # the worker thread. Default: 4 # CONFIG_SCHED_WAITPID - Enable the waitpid() API # CONFIG_SCHED_ATEXIT - Enabled the atexit() API -# CONFIG_SCHED_ONEXIT - Enabled the atexit() API +# CONFIG_SCHED_ONEXIT - Enabled the on_exit() API # #CONFIG_APPS_DIR= CONFIG_DEBUG=n @@ -710,7 +710,7 @@ CONFIG_NAME_MAX=32 CONFIG_STDIO_BUFFER_SIZE=64 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 -CONFIG_PREALLOC_MQ_MSGS=8 +CONFIG_PREALLOC_MQ_MSGS=32 CONFIG_MQ_MAXMSGSIZE=48 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=8 diff --git a/nuttx/fs/nfs/rpc.h b/nuttx/fs/nfs/rpc.h index 16bafa440e..52694ccbd9 100644 --- a/nuttx/fs/nfs/rpc.h +++ b/nuttx/fs/nfs/rpc.h @@ -171,7 +171,7 @@ struct auth_unix struct rpc_call_header { uint32_t rp_xid; /* request transaction id */ - int32_t rp_direction; /* call direction (0) */ + int32_t rp_direction; /* call direction (0) */ uint32_t rp_rpcvers; /* rpc version (2) */ uint32_t rp_prog; /* program */ uint32_t rp_vers; /* version */ diff --git a/nuttx/graphics/nxmu/nx_disconnect.c b/nuttx/graphics/nxmu/nx_disconnect.c index bbbf05251b..48e1e9cc03 100644 --- a/nuttx/graphics/nxmu/nx_disconnect.c +++ b/nuttx/graphics/nxmu/nx_disconnect.c @@ -90,6 +90,7 @@ void nx_disconnect(NXHANDLE handle) { FAR struct nxfe_conn_s *conn = (FAR struct nxfe_conn_s *)handle; struct nxsvrmsg_s outmsg; + int ret; /* Inform the server that this client no longer exists */ @@ -98,6 +99,10 @@ void nx_disconnect(NXHANDLE handle) /* We will finish the teardown upon receipt of the DISCONNECTED message */ - return nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_s)); + ret = nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_s)); + if (ret < 0) + { + gdbg("ERROR: nxmu_sendserver() returned %d\n", ret); + } }