diff --git a/graphics/twm4nx/README.txt b/graphics/twm4nx/README.txt index 8e6cf98e6..d04e464e9 100644 --- a/graphics/twm4nx/README.txt +++ b/graphics/twm4nx/README.txt @@ -29,7 +29,7 @@ within this directory. STATUS ====== - 2019-04-27: This port was brutal. Much TWM logic was removed because it + 2019-04-28: This port was brutal. Much TWM logic was removed because it depended on X11 features (or just because I could not understand how to use it). The replacement logic is only mostly in place but more needs to be done to have a complete system (hence, it is marked @@ -38,11 +38,9 @@ STATUS 1. Update some logic that is only fragmentary for things like resizing. Resizing events should be be generated when user pulls to right, left, top, bottom, etc. None of that is implemented. - 2. Revisit Icons. They are windows now, but need to be compound widgets - lying on the background (compound: CImage + CLabel) - 3. Left click on background should bring up a user provided main main menu. + 2. Left click on background should bring up a user provided main menu. Right click should bring up a window list (like the icon manager???) - 4. For TWM-like behavior, a window frame and toolbar should be highlighted + 3. For TWM-like behavior, a window frame and toolbar should be highlighted when the window has focus. - 5. A right click on the toolbar should bring up a window-specific menu. + 4. A right click on the toolbar should bring up a window-specific menu. diff --git a/graphics/twm4nx/Twm4NX-Threading.pdf b/graphics/twm4nx/Twm4NX-Threading.pdf index 9e857384c..c07eec4f1 100644 Binary files a/graphics/twm4nx/Twm4NX-Threading.pdf and b/graphics/twm4nx/Twm4NX-Threading.pdf differ diff --git a/graphics/twm4nx/src/ctwm4nx.cxx b/graphics/twm4nx/src/ctwm4nx.cxx index 8949506bd..8fe21ceab 100644 --- a/graphics/twm4nx/src/ctwm4nx.cxx +++ b/graphics/twm4nx/src/ctwm4nx.cxx @@ -123,12 +123,15 @@ CTwm4Nx::CTwm4Nx(int display) m_display = display; m_eventq = (mqd_t)-1; m_background = (FAR CBackground *)0; - m_input = (FAR CInput *)0; m_icon = (FAR CIcon *)0; m_iconmgr = (FAR CIconMgr *)0; m_factory = (FAR CWindowFactory *)0; m_fonts = (FAR CFonts *)0; m_resize = (FAR CResize *)0; + +#ifndef CONFIG_VNCSERVER + m_input = (FAR CInput *)0; +#endif } /** @@ -157,8 +160,14 @@ bool CTwm4Nx::run(void) // do this early so that the messasge queue name will be available to // constructors - genMqName(); // Generate a random message queue name - m_eventq = mq_open(m_queueName, O_RDONLY | O_CREAT, 0666); + struct mq_attr attr; + attr.mq_maxmsg = 32; // REVISIT: Should be configurable + attr.mq_msgsize = CONFIG_MQ_MAXMSGSIZE; + attr.mq_flags = 0; + attr.mq_curmsgs = 0; + + genMqName(); // Generate a random message queue name + m_eventq = mq_open(m_queueName, O_RDONLY | O_CREAT, 0666, &attr); if (m_eventq == (mqd_t)-1) { gerr("ERROR: Failed open message queue '%s': %d\n", @@ -222,6 +231,7 @@ bool CTwm4Nx::run(void) m_maxWindow.w = INT16_MAX - m_displaySize.w; m_maxWindow.h = INT16_MAX - m_displaySize.w; +#ifndef CONFIG_VNCSERVER // Create the keyboard/mouse input device thread m_input = new CInput(this); @@ -238,6 +248,7 @@ bool CTwm4Nx::run(void) cleanup(); return false; } +#endif // Create the Icon Manager @@ -506,6 +517,7 @@ void CTwm4Nx::cleanup() m_background = (FAR CBackground *)0; } +#ifndef CONFIG_VNCSERVER // Halt the keyboard/mouse listener and destroy the CInput class if (m_input != (CInput *)0) @@ -513,6 +525,7 @@ void CTwm4Nx::cleanup() delete m_input; m_input = (CInput *)0; } +#endif // Free the Icon Manager diff --git a/include/graphics/twm4nx/ctwm4nx.hxx b/include/graphics/twm4nx/ctwm4nx.hxx index 416c133fc..c6f4f399e 100644 --- a/include/graphics/twm4nx/ctwm4nx.hxx +++ b/include/graphics/twm4nx/ctwm4nx.hxx @@ -111,13 +111,15 @@ namespace Twm4Nx FAR char *m_queueName; /**< NxWidget event queue name */ mqd_t m_eventq; /**< NxWidget event message queue */ FAR CBackground *m_background; /**< Background window management */ - FAR CInput *m_input; /**< Keyboard/mouse input injector */ FAR CIcon *m_icon; /**< The cached Cicon instance */ FAR CIconMgr *m_iconmgr; /**< The Default icon manager */ FAR CWindowFactory *m_factory; /**< The cached CWindowFactory instance */ FAR CFonts *m_fonts; /**< The cached Cfonts instance */ FAR CResize *m_resize; /**< The cached CResize instance */ +#ifndef CONFIG_VNCSERVER + FAR CInput *m_input; /**< Keyboard/mouse input injector */ +#endif /* Display properties */ FAR struct nxgl_size_s m_displaySize; /**< Size of the display */ diff --git a/include/graphics/twm4nx/twm4nx_config.hxx b/include/graphics/twm4nx/twm4nx_config.hxx index 9a7580f80..0bcbe3a6c 100644 --- a/include/graphics/twm4nx/twm4nx_config.hxx +++ b/include/graphics/twm4nx/twm4nx_config.hxx @@ -59,7 +59,6 @@ * CONFIG_HAVE_CXX : C++ support is required * CONFIG_NX : NX must enabled * CONFIG_NXTERM=y : For NxTerm support - * CONFIG_SCHED_ONEXIT : Support for on_exit() */ #ifndef CONFIG_HAVE_CXX @@ -82,16 +81,6 @@ # warning "NxTerm support may be needed (CONFIG_NXTERM)" #endif -/** - * on_exit() support is (probably) required. on_exit() is the normal - * mechanism used by Twm4Nx applications to clean-up on a application task - * exit. - */ - -#ifndef CONFIG_SCHED_ONEXIT -# warning "on_exit() support may be needed (CONFIG_SCHED_ONEXIT)" -#endif - // Background /////////////////////////////////////////////////////////////// /** @@ -388,7 +377,13 @@ // Input Devices ///////////////////////////////////////////////////////////// -/** Common input device settings +/** + * Configuration settings + * + * CONFIG_VNCSERVER - If selected, then keyboard and positional input will + * come from the VNC server. In this case all input settings are ignored. + * + * Common input device settings * * CONFIG_TWM4NX_INPUT_SIGNO - The realtime signal used to wake up the * keyboard/mouse listener thread. Default: 6