NxWM unit test now appears bug free (other than some NxConsole-related issues).
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4750 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
c6c67e8987
commit
e40d54e2f7
Binary file not shown.
@ -52,7 +52,6 @@
|
|||||||
#include "ctaskbar.hxx"
|
#include "ctaskbar.hxx"
|
||||||
#include "iapplication.hxx"
|
#include "iapplication.hxx"
|
||||||
#include "cfullscreenwindow.hxx"
|
#include "cfullscreenwindow.hxx"
|
||||||
#include "cwindowmessenger.hxx"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -144,7 +143,6 @@ namespace NxWM
|
|||||||
* CCalibration state data
|
* CCalibration state data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CWindowMessenger m_messenger; /**< Window event handler/messenger */
|
|
||||||
CTaskbar *m_taskbar; /**< The taskbar (used to terminate calibration) */
|
CTaskbar *m_taskbar; /**< The taskbar (used to terminate calibration) */
|
||||||
CFullScreenWindow *m_window; /**< The window for the calibration display */
|
CFullScreenWindow *m_window; /**< The window for the calibration display */
|
||||||
CTouchscreen *m_touchscreen; /**< The touchscreen device */
|
CTouchscreen *m_touchscreen; /**< The touchscreen device */
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
#include "iapplication.hxx"
|
#include "iapplication.hxx"
|
||||||
#include "capplicationwindow.hxx"
|
#include "capplicationwindow.hxx"
|
||||||
#include "ctaskbar.hxx"
|
#include "ctaskbar.hxx"
|
||||||
#include "cwindowmessenger.hxx"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
@ -79,7 +78,6 @@ namespace NxWM
|
|||||||
class CNxConsole : public IApplication, private IApplicationCallback
|
class CNxConsole : public IApplication, private IApplicationCallback
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CWindowMessenger m_messenger; /**< Window event handler/messenger */
|
|
||||||
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
||||||
CApplicationWindow *m_window; /**< Reference to the application window */
|
CApplicationWindow *m_window; /**< Reference to the application window */
|
||||||
NXCONSOLE m_nxcon; /**< NxConsole handle */
|
NXCONSOLE m_nxcon; /**< NxConsole handle */
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
|
|
||||||
#include "iapplication.hxx"
|
#include "iapplication.hxx"
|
||||||
#include "capplicationwindow.hxx"
|
#include "capplicationwindow.hxx"
|
||||||
#include "cwindowmessenger.hxx"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
@ -116,7 +115,6 @@ namespace NxWM
|
|||||||
* CStartWindow state data
|
* CStartWindow state data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CWindowMessenger m_messenger; /**< Window event handler/messenger */
|
|
||||||
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
||||||
CApplicationWindow *m_window; /**< Reference to the application window */
|
CApplicationWindow *m_window; /**< Reference to the application window */
|
||||||
TNxArray<struct SStartWindowSlot> m_slots; /**< List of apps in the start window */
|
TNxArray<struct SStartWindowSlot> m_slots; /**< List of apps in the start window */
|
||||||
|
@ -110,14 +110,19 @@ namespace NxWM
|
|||||||
/**
|
/**
|
||||||
* Create a raw window.
|
* Create a raw window.
|
||||||
*
|
*
|
||||||
* 1) Create a dumb NXWidgets::CWidgetControl instance
|
* 1) Create a dumb NXWidgets::CWidgetControl instance (See not).
|
||||||
* 2) Pass the dumb NXWidgets::CWidgetControl instance to the window constructor
|
* 2) Pass the dumb NXWidgets::CWindowMessenger instance to the window constructor
|
||||||
* that inherits from INxWindow. This will "smarten" the NXWidgets::CWidgetControl
|
* that inherits from INxWindow. This will "smarten" the NXWidgets::CWidgetControl
|
||||||
* instance with some window knowlede
|
* instance with some window knowlede
|
||||||
* 3) Call the open() method on the window to display the window.
|
* 3) Call the open() method on the window to display the window.
|
||||||
* 4) After that, the fully smartened NXWidgets::CWidgetControl instance can
|
* 4) After that, the fully smartened NXWidgets::CWidgetControl instance can
|
||||||
* be used to generate additional widgets by passing it to the
|
* be used to generate additional widgets by passing it to the
|
||||||
* widget constructor
|
* widget constructor
|
||||||
|
*
|
||||||
|
* NOTE: Actually, NxWM uses the CWindowMessenger class that inherits from
|
||||||
|
* CWidgetControl. That class just adds some unrelated messenging capability;
|
||||||
|
* It cohabitates with CWidgetControl only becuase it nees the CWidgetControl
|
||||||
|
* this point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NXWidgets::CNxWindow *openRawWindow(void);
|
NXWidgets::CNxWindow *openRawWindow(void);
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include <nuttx/nx/nxconsole.h>
|
#include <nuttx/nx/nxconsole.h>
|
||||||
|
|
||||||
#include "cwindoweventhandler.hxx"
|
#include "cwindoweventhandler.hxx"
|
||||||
|
#include "cwidgetstyle.hxx"
|
||||||
#include "cwidgetcontrol.hxx"
|
#include "cwidgetcontrol.hxx"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -71,10 +72,15 @@ namespace NxWM
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The class CWindowMessenger 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
|
* handling of mouse and keyboard inputs neesed by NxWM. It use used
|
||||||
|
* in place of CWidgetControl whenever an NxWM window is created.
|
||||||
|
*
|
||||||
|
* CWindowMessenger cohabitates with CWidgetControl only becuase it nees the
|
||||||
|
* CWidgetControl as an argument in its messenging.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CWindowMessenger : public NXWidgets::CWindowEventHandler
|
class CWindowMessenger : public NXWidgets::CWindowEventHandler,
|
||||||
|
public NXWidgets::CWidgetControl
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
mqd_t m_mqd; /**< Message queue descriptor used to commincate with the
|
mqd_t m_mqd; /**< Message queue descriptor used to commincate with the
|
||||||
@ -110,9 +116,13 @@ namespace NxWM
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CWindowMessenger Constructor
|
* CWindowMessenger 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(void);
|
CWindowMessenger(FAR const NXWidgets::CWidgetStyle *style = (const NXWidgets::CWidgetStyle *)NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CWindowMessenger Destructor.
|
* CWindowMessenger Destructor.
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#include "nxwmconfig.hxx"
|
#include "nxwmconfig.hxx"
|
||||||
#include "nxwmglyphs.hxx"
|
#include "nxwmglyphs.hxx"
|
||||||
|
#include "cwindowmessenger.hxx"
|
||||||
#include "capplicationwindow.hxx"
|
#include "capplicationwindow.hxx"
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@ -152,15 +153,15 @@ CApplicationWindow::~CApplicationWindow(void)
|
|||||||
|
|
||||||
bool CApplicationWindow::open(void)
|
bool CApplicationWindow::open(void)
|
||||||
{
|
{
|
||||||
// Create a widget control for the tool bar
|
// Create the widget control (with the window messenger) using the default style
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl();
|
CWindowMessenger *control = new CWindowMessenger();
|
||||||
if (!control)
|
if (!control)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the toolbar
|
// Open the toolbar using the widget control
|
||||||
|
|
||||||
m_toolbar = m_window->openToolbar(CONFIG_NXWM_TOOLBAR_HEIGHT, control);
|
m_toolbar = m_window->openToolbar(CONFIG_NXWM_TOOLBAR_HEIGHT, control);
|
||||||
if (!m_toolbar)
|
if (!m_toolbar)
|
||||||
|
@ -99,11 +99,6 @@ CCalibration::CCalibration(CTaskbar *taskbar, CFullScreenWindow *window,
|
|||||||
m_calthread = CALTHREAD_NOTRUNNING;
|
m_calthread = CALTHREAD_NOTRUNNING;
|
||||||
m_calphase = CALPHASE_NOT_STARTED;
|
m_calphase = CALPHASE_NOT_STARTED;
|
||||||
m_touched = false;
|
m_touched = false;
|
||||||
|
|
||||||
// Add our messenger as the window callback
|
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = window->getWidgetControl();
|
|
||||||
control->addWindowEventHandler(&m_messenger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,11 +112,6 @@ CCalibration::~CCalibration(void)
|
|||||||
|
|
||||||
stop();
|
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
|
// Although we did not create the window, the rule is that I have to dispose
|
||||||
// of it
|
// of it
|
||||||
|
|
||||||
|
@ -132,11 +132,6 @@ CNxConsole::CNxConsole(CTaskbar *taskbar, CApplicationWindow *window)
|
|||||||
// Add our callbacks with the application window
|
// Add our callbacks with the application window
|
||||||
|
|
||||||
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
||||||
|
|
||||||
// Add our messenger as the window callback
|
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = window->getWidgetControl();
|
|
||||||
control->addWindowEventHandler(&m_messenger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,11 +147,6 @@ CNxConsole::~CNxConsole(void)
|
|||||||
|
|
||||||
stop();
|
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
|
// Although we didn't create it, we are responsible for deleting the
|
||||||
// application window
|
// application window
|
||||||
|
|
||||||
@ -303,7 +293,7 @@ void CNxConsole::stop(void)
|
|||||||
// Delete the NxConsole task if it is still running (this could strand
|
// Delete the NxConsole task if it is still running (this could strand
|
||||||
// resources). If we get here due to CTaskbar::stopApplication() processing
|
// resources). If we get here due to CTaskbar::stopApplication() processing
|
||||||
// initialed by CNxConsole::exitHandler, then do *not* delete the task (it
|
// initialed by CNxConsole::exitHandler, then do *not* delete the task (it
|
||||||
// is already being delete).
|
// is already being deleted).
|
||||||
|
|
||||||
if (m_pid >= 0)
|
if (m_pid >= 0)
|
||||||
{
|
{
|
||||||
@ -320,7 +310,7 @@ void CNxConsole::stop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Destroy the NX console device
|
// Destroy the NX console device
|
||||||
|
|
||||||
if (m_nxcon)
|
if (m_nxcon)
|
||||||
{
|
{
|
||||||
nxcon_unregister(m_nxcon);
|
nxcon_unregister(m_nxcon);
|
||||||
|
@ -99,11 +99,6 @@ CStartWindow::CStartWindow(CTaskbar *taskbar, CApplicationWindow *window)
|
|||||||
// Add our callbacks to the application window
|
// Add our callbacks to the application window
|
||||||
|
|
||||||
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
window->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
||||||
|
|
||||||
// Add our messenger as the window callback
|
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = window->getWidgetControl();
|
|
||||||
control->addWindowEventHandler(&m_messenger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,11 +112,6 @@ CStartWindow::~CStartWindow(void)
|
|||||||
|
|
||||||
stop();
|
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
|
// Although we didn't create it, we are responsible for deleting the
|
||||||
// application window
|
// application window
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "cwidgetcontrol.hxx"
|
#include "cwidgetcontrol.hxx"
|
||||||
#include "cnxtkwindow.hxx"
|
#include "cnxtkwindow.hxx"
|
||||||
|
|
||||||
|
#include "cwindowmessenger.hxx"
|
||||||
#include "ctaskbar.hxx"
|
#include "ctaskbar.hxx"
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@ -748,7 +749,7 @@ void CTaskbar::clickIcon(int index, bool click)
|
|||||||
/**
|
/**
|
||||||
* Create a raw window.
|
* Create a raw window.
|
||||||
*
|
*
|
||||||
* 1) Create a dumb CWigetControl instance
|
* 1) Create a dumb CWigetControl instance (see note below)
|
||||||
* 2) Pass the dumb CWidgetControl instance to the window constructor
|
* 2) Pass the dumb CWidgetControl instance to the window constructor
|
||||||
* that inherits from INxWindow. This will "smarten" the CWidgetControl
|
* that inherits from INxWindow. This will "smarten" the CWidgetControl
|
||||||
* instance with some window knowlede
|
* instance with some window knowlede
|
||||||
@ -756,13 +757,18 @@ void CTaskbar::clickIcon(int index, bool click)
|
|||||||
* 4) After that, the fully smartened CWidgetControl instance can
|
* 4) After that, the fully smartened CWidgetControl instance can
|
||||||
* be used to generate additional widgets by passing it to the
|
* be used to generate additional widgets by passing it to the
|
||||||
* widget constructor
|
* widget constructor
|
||||||
|
*
|
||||||
|
* NOTE: Actually, NxWM uses the CWindowMessenger class that inherits from
|
||||||
|
* CWidgetControl. That class just adds some unrelated messenging capability;
|
||||||
|
* It cohabitates with CWidgetControl only becuase it nees the CWidgetControl
|
||||||
|
* this point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NXWidgets::CNxWindow *CTaskbar::openRawWindow(void)
|
NXWidgets::CNxWindow *CTaskbar::openRawWindow(void)
|
||||||
{
|
{
|
||||||
// Initialize the widget control using the default style
|
// Create the widget control (with the window messenger) using the default style
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl((NXWidgets::CWidgetStyle *)NULL);
|
CWindowMessenger *control = new CWindowMessenger((NXWidgets::CWidgetStyle *)NULL);
|
||||||
|
|
||||||
// Get an (uninitialized) instance of the background window as a class
|
// Get an (uninitialized) instance of the background window as a class
|
||||||
// that derives from INxWindow.
|
// that derives from INxWindow.
|
||||||
@ -797,9 +803,9 @@ NXWidgets::CNxWindow *CTaskbar::openRawWindow(void)
|
|||||||
|
|
||||||
NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void)
|
NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void)
|
||||||
{
|
{
|
||||||
// Initialize the widget control using the default style
|
// Create the widget control (with the window messenger) using the default style
|
||||||
|
|
||||||
NXWidgets::CWidgetControl *control = new NXWidgets::CWidgetControl((NXWidgets::CWidgetStyle *)NULL);
|
CWindowMessenger *control = new CWindowMessenger((NXWidgets::CWidgetStyle *)NULL);
|
||||||
|
|
||||||
// Get an (uninitialized) instance of the framed window as a class
|
// Get an (uninitialized) instance of the framed window as a class
|
||||||
// that derives from INxWindow.
|
// that derives from INxWindow.
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <cunistd>
|
#include <cunistd>
|
||||||
|
@ -60,9 +60,14 @@ using namespace NxWM;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CWindowMessenger Constructor
|
* CWindowMessenger 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::CWindowMessenger(void)
|
CWindowMessenger::CWindowMessenger(FAR const NXWidgets::CWidgetStyle *style)
|
||||||
|
: NXWidgets::CWidgetControl(style)
|
||||||
{
|
{
|
||||||
// Open a message queue to communicate with the start window task. We need to create
|
// Open a message queue to communicate with the start window task. We need to create
|
||||||
// the message queue if it does not exist.
|
// the message queue if it does not exist.
|
||||||
@ -77,6 +82,10 @@ CWindowMessenger::CWindowMessenger(void)
|
|||||||
{
|
{
|
||||||
gdbg("ERROR: mq_open(%s) failed: %d\n", g_startWindowMqName, errno);
|
gdbg("ERROR: mq_open(%s) failed: %d\n", g_startWindowMqName, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add ourself to the list of window event handlers
|
||||||
|
|
||||||
|
addWindowEventHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,6 +94,10 @@ CWindowMessenger::CWindowMessenger(void)
|
|||||||
|
|
||||||
CWindowMessenger::~CWindowMessenger(void)
|
CWindowMessenger::~CWindowMessenger(void)
|
||||||
{
|
{
|
||||||
|
// Remove ourself from the list of the window event handlers
|
||||||
|
|
||||||
|
removeWindowEventHandler(this);
|
||||||
|
|
||||||
// Close the message queue
|
// Close the message queue
|
||||||
|
|
||||||
(void)mq_close(m_mqd);
|
(void)mq_close(m_mqd);
|
||||||
@ -127,7 +140,7 @@ void CWindowMessenger::handleMouseEvent(void)
|
|||||||
|
|
||||||
struct SStartWindowMessage outmsg;
|
struct SStartWindowMessage outmsg;
|
||||||
outmsg.msgId = MSGID_MOUSE_INPUT;
|
outmsg.msgId = MSGID_MOUSE_INPUT;
|
||||||
outmsg.instance = (FAR void *)this;
|
outmsg.instance = (FAR void *)static_cast<CWidgetControl*>(this);
|
||||||
|
|
||||||
int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage),
|
int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage),
|
||||||
CONFIG_NXWM_STARTWINDOW_MXMPRIO);
|
CONFIG_NXWM_STARTWINDOW_MXMPRIO);
|
||||||
@ -173,7 +186,7 @@ void CWindowMessenger::handleKeyboardEvent(void)
|
|||||||
|
|
||||||
struct SStartWindowMessage outmsg;
|
struct SStartWindowMessage outmsg;
|
||||||
outmsg.msgId = MSGID_KEYBOARD_INPUT;
|
outmsg.msgId = MSGID_KEYBOARD_INPUT;
|
||||||
outmsg.instance = (FAR void *)this;
|
outmsg.instance = (FAR void *)static_cast<CWidgetControl*>(this);
|
||||||
|
|
||||||
int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage),
|
int ret = mq_send(m_mqd, &outmsg, sizeof(struct SStartWindowMessage),
|
||||||
CONFIG_NXWM_STARTWINDOW_MXMPRIO);
|
CONFIG_NXWM_STARTWINDOW_MXMPRIO);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user