apps/graphics/twm4nx: Suppress input thread if using the VNC server. We don't need to catch input fromo keyboard and mouse devices in that case; those inputs will be injected into NX directly by the VNC server. Includes a couple of fixes from initial bringup attempts.

This commit is contained in:
Gregory Nutt 2019-04-28 12:47:49 -06:00
parent e742f97674
commit 6a970ec4e9
5 changed files with 30 additions and 22 deletions

View File

@ -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.

Binary file not shown.

View File

@ -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

View File

@ -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 */

View File

@ -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