apps/graphics/twm4nx: Correct design of input event logic. Still getting a hardfault.
This commit is contained in:
parent
358f32bfdc
commit
2fff83d60d
@ -220,6 +220,7 @@ void CWidgetControl::postWindowEvent(void)
|
|||||||
* {
|
* {
|
||||||
* window->waitWindowEvent();
|
* window->waitWindowEvent();
|
||||||
* }
|
* }
|
||||||
|
*
|
||||||
* sched_unlock();
|
* sched_unlock();
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
@ -569,9 +570,9 @@ void CWidgetControl::newMouseEvent(FAR const struct nxgl_point_s *pos, uint8_t b
|
|||||||
|
|
||||||
m_eventHandlers.raiseMouseEvent();
|
m_eventHandlers.raiseMouseEvent();
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
||||||
// Then wake up logic that may be waiting for a window event
|
// Then wake up logic that may be waiting for a window event
|
||||||
|
|
||||||
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
|
||||||
postWindowEvent();
|
postWindowEvent();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -604,9 +605,9 @@ void CWidgetControl::newKeyboardEvent(uint8_t nCh, FAR const uint8_t *pStr)
|
|||||||
|
|
||||||
m_eventHandlers.raiseKeyboardEvent();
|
m_eventHandlers.raiseKeyboardEvent();
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
||||||
// Then wake up logic that may be waiting for a window event
|
// Then wake up logic that may be waiting for a window event
|
||||||
|
|
||||||
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
|
||||||
postWindowEvent();
|
postWindowEvent();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -132,11 +132,11 @@ void CWindowEventHandlerList::raiseGeometryEvent(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_XYINPUT
|
||||||
/**
|
/**
|
||||||
* Raise an NX mouse window input event.
|
* Raise an NX mouse window input event.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
void CWindowEventHandlerList::raiseMouseEvent(void)
|
void CWindowEventHandlerList::raiseMouseEvent(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_eventHandlers.size(); ++i)
|
for (int i = 0; i < m_eventHandlers.size(); ++i)
|
||||||
@ -146,11 +146,11 @@ void CWindowEventHandlerList::raiseMouseEvent(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_KBD
|
||||||
/**
|
/**
|
||||||
* Raise an NX keybord input event
|
* Raise an NX keybord input event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
|
||||||
void CWindowEventHandlerList::raiseKeyboardEvent(void)
|
void CWindowEventHandlerList::raiseKeyboardEvent(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_eventHandlers.size(); ++i)
|
for (int i = 0; i < m_eventHandlers.size(); ++i)
|
||||||
|
@ -85,13 +85,11 @@ CWindowMessenger::~CWindowMessenger(void)
|
|||||||
removeWindowEventHandler(this);
|
removeWindowEventHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_XYINPUT
|
||||||
/**
|
/**
|
||||||
* Handle an NX window mouse input event.
|
* Handle an NX window mouse input event.
|
||||||
*
|
|
||||||
* @param e The event data.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
void CWindowMessenger::handleMouseEvent(void)
|
void CWindowMessenger::handleMouseEvent(void)
|
||||||
{
|
{
|
||||||
// The logic path here is tortuous but flexible:
|
// The logic path here is tortuous but flexible:
|
||||||
@ -130,11 +128,11 @@ void CWindowMessenger::handleMouseEvent(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_KBD
|
||||||
/**
|
/**
|
||||||
* Handle a NX window keyboard input event.
|
* Handle a NX window keyboard input event.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
|
||||||
void CWindowMessenger::handleKeyboardEvent(void)
|
void CWindowMessenger::handleKeyboardEvent(void)
|
||||||
{
|
{
|
||||||
work_state_t *state = new work_state_t;
|
work_state_t *state = new work_state_t;
|
||||||
|
@ -179,9 +179,17 @@ bool CBackground::event(FAR struct SEventMsg *eventmsg)
|
|||||||
{
|
{
|
||||||
twminfo("eventID: %u\n", eventmsg->eventID);
|
twminfo("eventID: %u\n", eventmsg->eventID);
|
||||||
|
|
||||||
|
// Handle the event
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
switch (eventmsg->eventID)
|
switch (eventmsg->eventID)
|
||||||
{
|
{
|
||||||
|
case EVENT_BACKGROUND_POLL: // Poll for icon events
|
||||||
|
{
|
||||||
|
#warning Missing logic
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case EVENT_BACKGROUND_REDRAW: // Redraw the background
|
case EVENT_BACKGROUND_REDRAW: // Redraw the background
|
||||||
{
|
{
|
||||||
FAR struct SRedrawEventMsg *redrawmsg =
|
FAR struct SRedrawEventMsg *redrawmsg =
|
||||||
@ -216,7 +224,8 @@ bool CBackground::createBackgroundWindow(void)
|
|||||||
// 3. Create a Widget control instance for the window using the default
|
// 3. Create a Widget control instance for the window using the default
|
||||||
// style for now. CWindowEvent derives from CWidgetControl.
|
// style for now. CWindowEvent derives from CWidgetControl.
|
||||||
|
|
||||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, true);
|
FAR CWindowEvent *control =
|
||||||
|
new CWindowEvent(m_twm4nx, (FAR void *)this, true);
|
||||||
|
|
||||||
// Create the background window (CTwm4Nx inherits from CNxServer)
|
// Create the background window (CTwm4Nx inherits from CNxServer)
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ bool CMenus::createMenuWindow(void)
|
|||||||
// 3. Create a Widget control instance for the window using the default
|
// 3. Create a Widget control instance for the window using the default
|
||||||
// style for now. CWindowEvent derives from CWidgetControl.
|
// style for now. CWindowEvent derives from CWidgetControl.
|
||||||
|
|
||||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx);
|
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, (FAR void *)this);
|
||||||
|
|
||||||
// 4. Create the menu window
|
// 4. Create the menu window
|
||||||
|
|
||||||
|
@ -955,7 +955,7 @@ bool CResize::createSizeWindow(void)
|
|||||||
// 3. Create a Widget control instance for the window using the default
|
// 3. Create a Widget control instance for the window using the default
|
||||||
// style for now. CWindowEvent derives from CWidgetControl.
|
// style for now. CWindowEvent derives from CWidgetControl.
|
||||||
|
|
||||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx);
|
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, (FAR void *)this);
|
||||||
|
|
||||||
// 4. Create the main window
|
// 4. Create the main window
|
||||||
|
|
||||||
|
@ -430,10 +430,6 @@ bool CTwm4Nx::dispatchEvent(FAR struct SEventMsg *eventmsg)
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
switch (recipient)
|
switch (recipient)
|
||||||
{
|
{
|
||||||
case EVENT_RECIPIENT_MSG: // NX message event
|
|
||||||
ret = CWindowEvent::event(eventmsg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EVENT_RECIPIENT_SYSTEM: // Twm4Nx system event
|
case EVENT_RECIPIENT_SYSTEM: // Twm4Nx system event
|
||||||
ret = systemEvent(eventmsg);
|
ret = systemEvent(eventmsg);
|
||||||
break;
|
break;
|
||||||
|
@ -614,7 +614,7 @@ bool CWindow::createMainWindow(FAR const nxgl_size_s *winsize,
|
|||||||
// 3. Create a Widget control instance for the window using the default
|
// 3. Create a Widget control instance for the window using the default
|
||||||
// style for now. CWindowEvent derives from CWidgetControl.
|
// style for now. CWindowEvent derives from CWidgetControl.
|
||||||
|
|
||||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx);
|
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, (FAR void *)this);
|
||||||
|
|
||||||
// 4. Create the window
|
// 4. Create the window
|
||||||
|
|
||||||
@ -698,7 +698,7 @@ bool CWindow::createToolbar(void)
|
|||||||
// 2. Create a Widget control instance for the window using the default
|
// 2. Create a Widget control instance for the window using the default
|
||||||
// style for now. CWindowEvent derives from CWidgetControl.
|
// style for now. CWindowEvent derives from CWidgetControl.
|
||||||
|
|
||||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx);
|
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, (FAR void *)this);
|
||||||
|
|
||||||
// 3. Get the toolbar sub-window from the framed window
|
// 3. Get the toolbar sub-window from the framed window
|
||||||
|
|
||||||
|
@ -59,18 +59,21 @@ using namespace Twm4Nx;
|
|||||||
/**
|
/**
|
||||||
* CWindowEvent Constructor
|
* CWindowEvent Constructor
|
||||||
*
|
*
|
||||||
* @param twm4nx. The Twm4Nx session instance.
|
* @param twm4nx The Twm4Nx session instance.
|
||||||
* @param isBackground. True is this for the background window.
|
* @param obj Contextual object (Usually 'this' of instantiator)
|
||||||
|
* @param isBackground True is this for the background window.
|
||||||
* @param style The default style that all widgets on this display
|
* @param style The default style that all widgets on this display
|
||||||
* should use. If this is not specified, the widget will use the
|
* should use. If this is not specified, the widget will use the
|
||||||
* values stored in the defaultCWidgetStyle object.
|
* values stored in the defaultCWidgetStyle object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CWindowEvent::CWindowEvent(FAR CTwm4Nx *twm4nx, bool isBackground,
|
CWindowEvent::CWindowEvent(FAR CTwm4Nx *twm4nx, FAR void *obj,
|
||||||
|
bool isBackground,
|
||||||
FAR const NXWidgets::CWidgetStyle *style)
|
FAR const NXWidgets::CWidgetStyle *style)
|
||||||
: NXWidgets::CWidgetControl(style)
|
: NXWidgets::CWidgetControl(style)
|
||||||
{
|
{
|
||||||
m_twm4nx = twm4nx; // Cache the Twm4Nx session
|
m_twm4nx = twm4nx; // Cache the Twm4Nx session
|
||||||
|
m_object = obj; // Used for event message construction
|
||||||
m_isBackground = isBackground; // Background window?
|
m_isBackground = isBackground; // Background window?
|
||||||
|
|
||||||
// Open a message queue to send raw NX events. This cannot fail!
|
// Open a message queue to send raw NX events. This cannot fail!
|
||||||
@ -107,40 +110,6 @@ CWindowEvent::~CWindowEvent(void)
|
|||||||
removeWindowEventHandler(this);
|
removeWindowEventHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle MSG events.
|
|
||||||
*
|
|
||||||
* @param msg. The received system MSG event message.
|
|
||||||
* @return True if the message was properly handled. false is
|
|
||||||
* return on any failure.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool CWindowEvent::event(FAR struct SEventMsg *eventmsg)
|
|
||||||
{
|
|
||||||
twminfo("eventID: %u\n", eventmsg->eventID);
|
|
||||||
|
|
||||||
// Handle the event
|
|
||||||
|
|
||||||
bool success = true;
|
|
||||||
switch (eventmsg->eventID)
|
|
||||||
{
|
|
||||||
case EVENT_MSG_POLL: // Poll for event
|
|
||||||
{
|
|
||||||
// Poll for pending events before closing.
|
|
||||||
|
|
||||||
FAR CWindow *cwin = (FAR CWindow *)eventmsg->obj;
|
|
||||||
success = cwin->pollToolbarEvents();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
success = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the EVENT_MSG_POLL input event message to the Twm4Nx event loop.
|
* Send the EVENT_MSG_POLL input event message to the Twm4Nx event loop.
|
||||||
*/
|
*/
|
||||||
@ -181,12 +150,10 @@ void CWindowEvent::sendInputEvent(void)
|
|||||||
// in the Twm4Nx main thread. The event will, finally be delivered
|
// in the Twm4Nx main thread. The event will, finally be delivered
|
||||||
// to the recipient in its fully digested and decorated form.
|
// to the recipient in its fully digested and decorated form.
|
||||||
|
|
||||||
struct SNxEventMsg msg =
|
struct SNxEventMsg msg;
|
||||||
{
|
msg.eventID = m_isBackground ? EVENT_BACKGROUND_POLL : EVENT_WINDOW_POLL;
|
||||||
.eventID = EVENT_MSG_POLL,
|
msg.instance = this;
|
||||||
.instance = this,
|
msg.obj = m_object;
|
||||||
.win = (FAR struct SWindow *)0
|
|
||||||
};
|
|
||||||
|
|
||||||
int ret = mq_send(m_eventq, (FAR const char *)&msg,
|
int ret = mq_send(m_eventq, (FAR const char *)&msg,
|
||||||
sizeof(struct SNxEventMsg), 100);
|
sizeof(struct SNxEventMsg), 100);
|
||||||
@ -236,11 +203,11 @@ void CWindowEvent::handleRedrawEvent(FAR const nxgl_rect_s *nxRect,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_XYINPUT
|
||||||
/**
|
/**
|
||||||
* Handle an NX window mouse input event.
|
* Handle an NX window mouse input event.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
void CWindowEvent::handleMouseEvent(void)
|
void CWindowEvent::handleMouseEvent(void)
|
||||||
{
|
{
|
||||||
twminfo("Mouse input...\n");
|
twminfo("Mouse input...\n");
|
||||||
@ -288,7 +255,7 @@ void CWindowEvent::handleBlockedEvent(FAR void *arg)
|
|||||||
{
|
{
|
||||||
.eventID = EVENT_WINDOW_DELETE,
|
.eventID = EVENT_WINDOW_DELETE,
|
||||||
.instance = this,
|
.instance = this,
|
||||||
.win = (FAR struct SWindow *)arg
|
.obj = arg
|
||||||
};
|
};
|
||||||
|
|
||||||
int ret = mq_send(m_eventq, (FAR const char *)&msg,
|
int ret = mq_send(m_eventq, (FAR const char *)&msg,
|
||||||
|
@ -250,12 +250,35 @@ void CWindowFactory::destroyWindow(FAR CWindow *cwin)
|
|||||||
|
|
||||||
bool CWindowFactory::event(FAR struct SEventMsg *eventmsg)
|
bool CWindowFactory::event(FAR struct SEventMsg *eventmsg)
|
||||||
{
|
{
|
||||||
FAR CWindow *cwin = (FAR CWindow *)eventmsg->obj;
|
twminfo("eventID: %d\n", eventmsg->eventID);
|
||||||
DEBUGASSERT(cwin != (FAR CWindow *)0);
|
bool success = true;
|
||||||
|
|
||||||
// Forward the event to the appropriate window
|
switch (eventmsg->eventID)
|
||||||
|
{
|
||||||
|
case EVENT_WINDOW_POLL: // Poll for icon events
|
||||||
|
{
|
||||||
|
FAR struct SNxEventMsg *nxmsg =
|
||||||
|
(FAR struct SNxEventMsg *)eventmsg;
|
||||||
|
FAR CWindow *cwin = (FAR CWindow *)nxmsg->obj;
|
||||||
|
DEBUGASSERT(cwin != (FAR CWindow *)0);
|
||||||
|
|
||||||
return cwin->event(eventmsg);
|
success = cwin->pollToolbarEvents();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Forward the event to the appropriate window
|
||||||
|
|
||||||
|
default: // All other window messsages
|
||||||
|
{
|
||||||
|
FAR CWindow *cwin = (FAR CWindow *)eventmsg->obj;
|
||||||
|
DEBUGASSERT(cwin != (FAR CWindow *)0);
|
||||||
|
|
||||||
|
success = cwin->event(eventmsg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ namespace NXWidgets
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
NXHANDLE m_hNxServer; /**< Handle to the NX server. */
|
NXHANDLE m_hNxServer; /**< Handle to the NX server. */
|
||||||
NXTKWINDOW m_hNxTkWindow; /**< Handle to the NX raw window */
|
NXTKWINDOW m_hNxTkWindow; /**< Handle to the NxTk window */
|
||||||
CWidgetControl *m_widgetControl; /**< Controlling widget for the window */
|
CWidgetControl *m_widgetControl; /**< Controlling widget for the window */
|
||||||
CNxToolbar *m_toolbar; /**< Child toolbar */
|
CNxToolbar *m_toolbar; /**< Child toolbar */
|
||||||
nxgl_coord_t m_toolbarHeight; /**< The height of the toolbar */
|
nxgl_coord_t m_toolbarHeight; /**< The height of the toolbar */
|
||||||
|
@ -298,11 +298,11 @@ namespace NXWidgets
|
|||||||
|
|
||||||
bool pollCursorControlEvents(void);
|
bool pollCursorControlEvents(void);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
||||||
/**
|
/**
|
||||||
* Wake up and external logic that is waiting for a window event.
|
* Wake up and external logic that is waiting for a window event.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
|
||||||
void postWindowEvent(void);
|
void postWindowEvent(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -382,6 +382,7 @@ namespace NXWidgets
|
|||||||
|
|
||||||
virtual ~CWidgetControl(void);
|
virtual ~CWidgetControl(void);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
||||||
/**
|
/**
|
||||||
* Wait for an interesting window event to occur (like a mouse or keyboard event)
|
* Wait for an interesting window event to occur (like a mouse or keyboard event)
|
||||||
* Caller's should exercise care to assure that the test for waiting and this
|
* Caller's should exercise care to assure that the test for waiting and this
|
||||||
@ -396,17 +397,16 @@ namespace NXWidgets
|
|||||||
* sched_unlock();
|
* sched_unlock();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
|
||||||
void waitForWindowEvent(void);
|
void waitForWindowEvent(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
||||||
/**
|
/**
|
||||||
* Is external logic awaiting for a window event?
|
* Is external logic awaiting for a window event?
|
||||||
*
|
*
|
||||||
* @return True if the widget if external logic is waiting.
|
* @return True if the widget if external logic is waiting.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NXWIDGET_EVENTWAIT
|
|
||||||
inline const bool isWaiting(void) const
|
inline const bool isWaiting(void) const
|
||||||
{
|
{
|
||||||
return m_waiting;
|
return m_waiting;
|
||||||
@ -619,6 +619,7 @@ namespace NXWidgets
|
|||||||
|
|
||||||
void newMouseEvent(FAR const struct nxgl_point_s *pos, uint8_t buttons);
|
void newMouseEvent(FAR const struct nxgl_point_s *pos, uint8_t buttons);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_KBD
|
||||||
/**
|
/**
|
||||||
* This event means that keyboard/keypad data is available for the window.
|
* This event means that keyboard/keypad data is available for the window.
|
||||||
*
|
*
|
||||||
@ -626,7 +627,6 @@ namespace NXWidgets
|
|||||||
* @param pStr The array of characters.
|
* @param pStr The array of characters.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
|
||||||
void newKeyboardEvent(uint8_t nCh, FAR const uint8_t *pStr);
|
void newKeyboardEvent(uint8_t nCh, FAR const uint8_t *pStr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -824,3 +824,4 @@ namespace NXWidgets
|
|||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // __APPS_INCLUDE_GRAPHICS_NXWIDGETS_CWIDGETCONTROLT_HXX
|
#endif // __APPS_INCLUDE_GRAPHICS_NXWIDGETS_CWIDGETCONTROLT_HXX
|
||||||
|
|
||||||
|
@ -148,19 +148,19 @@ namespace NXWidgets
|
|||||||
|
|
||||||
void raiseGeometryEvent(void);
|
void raiseGeometryEvent(void);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_XYINPUT
|
||||||
/**
|
/**
|
||||||
* Raise an NX mouse window input event.
|
* Raise an NX mouse window input event.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
void raiseMouseEvent(void);
|
void raiseMouseEvent(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_KBD
|
||||||
/**
|
/**
|
||||||
* Raise an NX keybord input event
|
* Raise an NX keybord input event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
|
||||||
void raiseKeyboardEvent(void);
|
void raiseKeyboardEvent(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ namespace Twm4Nx
|
|||||||
private:
|
private:
|
||||||
FAR CTwm4Nx *m_twm4nx; /**< Cached instance of CTwm4Nx */
|
FAR CTwm4Nx *m_twm4nx; /**< Cached instance of CTwm4Nx */
|
||||||
mqd_t m_eventq; /**< NxWidget event message queue */
|
mqd_t m_eventq; /**< NxWidget event message queue */
|
||||||
|
FAR void *m_object; /**< Window object (context specific) */
|
||||||
bool m_isBackground; /**< True if this serves the background window */
|
bool m_isBackground; /**< True if this serves the background window */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,14 +87,14 @@ namespace Twm4Nx
|
|||||||
|
|
||||||
// Override CWidgetEventHandler virtual methods ///////////////////////
|
// Override CWidgetEventHandler virtual methods ///////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a NX window redraw request event
|
* Handle a NX window redraw request event
|
||||||
*
|
*
|
||||||
* @param nxRect The region in the window to be redrawn
|
* @param nxRect The region in the window to be redrawn
|
||||||
* @param more More redraw requests will follow
|
* @param more More redraw requests will follow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void handleRedrawEvent(FAR const nxgl_rect_s *nxRect, bool more);
|
void handleRedrawEvent(FAR const nxgl_rect_s *nxRect, bool more);
|
||||||
|
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
#ifdef CONFIG_NX_XYINPUT
|
||||||
/**
|
/**
|
||||||
@ -115,7 +116,7 @@ namespace Twm4Nx
|
|||||||
* Handle a NX window blocked event
|
* Handle a NX window blocked event
|
||||||
*
|
*
|
||||||
* @param arg - User provided argument (see nx_block or nxtk_block)
|
* @param arg - User provided argument (see nx_block or nxtk_block)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void handleBlockedEvent(FAR void *arg);
|
void handleBlockedEvent(FAR void *arg);
|
||||||
|
|
||||||
@ -124,14 +125,16 @@ namespace Twm4Nx
|
|||||||
/**
|
/**
|
||||||
* CWindowEvent Constructor
|
* CWindowEvent Constructor
|
||||||
*
|
*
|
||||||
* @param twm4nx. The Twm4Nx session instance.
|
* @param twm4nx The Twm4Nx session instance.
|
||||||
* @param isBackground. True is this for the background window.
|
* @param obj Contextual object (Usually 'this' of instantiator)
|
||||||
|
* @param isBackground True is this for the background window.
|
||||||
* @param style The default style that all widgets on this display
|
* @param style The default style that all widgets on this display
|
||||||
* should use. If this is not specified, the widget will use the
|
* should use. If this is not specified, the widget will use the
|
||||||
* values stored in the defaultCWidgetStyle object.
|
* values stored in the defaultCWidgetStyle object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CWindowEvent(FAR CTwm4Nx *twm4nx, bool isBackground = false,
|
CWindowEvent(FAR CTwm4Nx *twm4nx, FAR void *obj,
|
||||||
|
bool isBackground = false,
|
||||||
FAR const NXWidgets::CWidgetStyle *style =
|
FAR const NXWidgets::CWidgetStyle *style =
|
||||||
(const NXWidgets::CWidgetStyle *)NULL);
|
(const NXWidgets::CWidgetStyle *)NULL);
|
||||||
|
|
||||||
@ -140,16 +143,6 @@ namespace Twm4Nx
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
~CWindowEvent(void);
|
~CWindowEvent(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle MSG events.
|
|
||||||
*
|
|
||||||
* @param msg. The received system MSG event message.
|
|
||||||
* @return True if the message was properly handled. false is
|
|
||||||
* return on any failure.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static bool event(FAR struct SEventMsg *msg);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
@ -69,7 +69,7 @@ namespace Twm4Nx
|
|||||||
{
|
{
|
||||||
class CWindow; // Forward reference
|
class CWindow; // Forward reference
|
||||||
class CWindowEvent; // Forward reference
|
class CWindowEvent; // Forward reference
|
||||||
class CTwm4NxEvent; // Forward reference
|
class CTwm4NxEvent; // Forward reference
|
||||||
class CTwm4Nx; // Forward reference
|
class CTwm4Nx; // Forward reference
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -82,17 +82,16 @@ namespace Twm4Nx
|
|||||||
|
|
||||||
enum EEventRecipient
|
enum EEventRecipient
|
||||||
{
|
{
|
||||||
EVENT_RECIPIENT_MSG = 0x0000, /**< Twm4Nx messenging event */
|
EVENT_RECIPIENT_SYSTEM = 0x0000, /**< Twm4Nx system event */
|
||||||
EVENT_RECIPIENT_SYSTEM = 0x1000, /**< Twm4Nx system event */
|
EVENT_RECIPIENT_BACKGROUND = 0x1000, /**< Background window event */
|
||||||
EVENT_RECIPIENT_BACKGROUND = 0x2000, /**< Background window event */
|
EVENT_RECIPIENT_ICONWIDGET = 0x2000, /**< Icon Widget event */
|
||||||
EVENT_RECIPIENT_ICONWIDGET = 0x3000, /**< Icon Widget event */
|
EVENT_RECIPIENT_ICONMGR = 0x3000, /**< Icon Manager event */
|
||||||
EVENT_RECIPIENT_ICONMGR = 0x4000, /**< Icon Manager event */
|
EVENT_RECIPIENT_MENU = 0x4000, /**< Menu related event */
|
||||||
EVENT_RECIPIENT_MENU = 0x5000, /**< Menu related event */
|
EVENT_RECIPIENT_WINDOW = 0x5000, /**< Window related event */
|
||||||
EVENT_RECIPIENT_WINDOW = 0x6000, /**< Window related event */
|
EVENT_RECIPIENT_TOOLBAR = 0x6000, /**< Toolbar related event */
|
||||||
EVENT_RECIPIENT_TOOLBAR = 0x7000, /**< Toolbar related event */
|
EVENT_RECIPIENT_BORDER = 0x7000, /**< Window border related event */
|
||||||
EVENT_RECIPIENT_BORDER = 0x8000, /**< Window border related event */
|
EVENT_RECIPIENT_RESIZE = 0x8000, /**< Window resize event */
|
||||||
EVENT_RECIPIENT_RESIZE = 0x9000, /**< Window resize event */
|
EVENT_RECIPIENT_APP = 0x9000, /**< App received event via CTwn4NxEvent */
|
||||||
EVENT_RECIPIENT_APP = 0xa000, /**< App received event via CTwn4NxEvent */
|
|
||||||
EVENT_RECIPIENT_MASK = 0xf000, /**< Used to isolate recipient */
|
EVENT_RECIPIENT_MASK = 0xf000, /**< Used to isolate recipient */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -102,69 +101,67 @@ namespace Twm4Nx
|
|||||||
|
|
||||||
enum EEventID
|
enum EEventID
|
||||||
{
|
{
|
||||||
// Recipient == MSG
|
|
||||||
|
|
||||||
EVENT_MSG_POLL = 0x0000, /**< Poll widgets for events */
|
|
||||||
|
|
||||||
// Recipient == SYSTEM
|
// Recipient == SYSTEM
|
||||||
|
|
||||||
EVENT_SYSTEM_NOP = 0x1000, /**< Null event */
|
EVENT_SYSTEM_NOP = 0x0000, /**< Null event */
|
||||||
EVENT_SYSTEM_ERROR = 0x1001, /**< Report system error */
|
EVENT_SYSTEM_ERROR = 0x0001, /**< Report system error */
|
||||||
EVENT_SYSTEM_EXIT = 0x1002, /**< Terminate the Twm4Nx session */
|
EVENT_SYSTEM_EXIT = 0x0002, /**< Terminate the Twm4Nx session */
|
||||||
|
|
||||||
// Recipient == BACKGOUND
|
// Recipient == BACKGOUND
|
||||||
|
|
||||||
EVENT_BACKGROUND_REDRAW = 0x2000, /**< Redraw the background */
|
EVENT_BACKGROUND_POLL = 0x1000, /**< Poll background icons for events */
|
||||||
|
EVENT_BACKGROUND_REDRAW = 0x1001, /**< Redraw the background */
|
||||||
|
|
||||||
// Recipient == ICONWIDGET
|
// Recipient == ICONWIDGET
|
||||||
|
|
||||||
EVENT_ICONWIDGET_GRAB = 0x3000, /**< Click on toolbar title */
|
EVENT_ICONWIDGET_GRAB = 0x2000, /**< Click on toolbar title */
|
||||||
EVENT_ICONWIDGET_DRAG = 0x3001, /**< Drag window */
|
EVENT_ICONWIDGET_DRAG = 0x2001, /**< Drag window */
|
||||||
EVENT_ICONWIDGET_UNGRAB = 0x3002, /**< Release click on toolbar */
|
EVENT_ICONWIDGET_UNGRAB = 0x2002, /**< Release click on toolbar */
|
||||||
|
|
||||||
// Recipient == ICONMGR
|
// Recipient == ICONMGR
|
||||||
|
|
||||||
// Recipient == MENU
|
// Recipient == MENU
|
||||||
|
|
||||||
EVENT_MENU_IDENTIFY = 0x5001, /**< Describe the window */
|
EVENT_MENU_IDENTIFY = 0x4000, /**< Describe the window */
|
||||||
EVENT_MENU_VERSION = 0x5002, /**< Show the Twm4Nx version */
|
EVENT_MENU_VERSION = 0x4001, /**< Show the Twm4Nx version */
|
||||||
EVENT_MENU_ICONIFY = 0x5003, /**< Tool bar minimize button pressed */
|
EVENT_MENU_ICONIFY = 0x4002, /**< Tool bar minimize button pressed */
|
||||||
EVENT_MENU_DEICONIFY = 0x5004, /**< Window icon pressed */
|
EVENT_MENU_DEICONIFY = 0x4003, /**< Window icon pressed */
|
||||||
EVENT_MENU_FUNCTION = 0x5005, /**< Perform function on unknown menu */
|
EVENT_MENU_FUNCTION = 0x4004, /**< Perform function on unknown menu */
|
||||||
EVENT_MENU_TITLE = 0x5006, /**< REVISIT: Really an action not an event */
|
EVENT_MENU_TITLE = 0x4005, /**< REVISIT: Really an action not an event */
|
||||||
EVENT_MENU_ROOT = 0x5007, /**< REVISIT: Popup root menu */
|
EVENT_MENU_ROOT = 0x4006, /**< REVISIT: Popup root menu */
|
||||||
|
|
||||||
// Recipient == WINDOW
|
// Recipient == WINDOW
|
||||||
|
|
||||||
EVENT_WINDOW_FOCUS = 0x6000, /**< Enter modal state */
|
EVENT_WINDOW_POLL = 0x5000, /**< Poll window for widget events */
|
||||||
EVENT_WINDOW_UNFOCUS = 0x6001, /**< Exit modal state */
|
EVENT_WINDOW_FOCUS = 0x5001, /**< Enter modal state */
|
||||||
EVENT_WINDOW_RAISE = 0x6002, /**< Raise window to the top of the heirarchy */
|
EVENT_WINDOW_UNFOCUS = 0x5002, /**< Exit modal state */
|
||||||
EVENT_WINDOW_LOWER = 0x6003, /**< Lower window to the bottom of the heirarchy */
|
EVENT_WINDOW_RAISE = 0x5003, /**< Raise window to the top of the heirarchy */
|
||||||
EVENT_WINDOW_DEICONIFY = 0x6004, /**< De-iconify and raise window */
|
EVENT_WINDOW_LOWER = 0x5004, /**< Lower window to the bottom of the heirarchy */
|
||||||
EVENT_WINDOW_DRAG = 0x6005, /**< Drag window */
|
EVENT_WINDOW_DEICONIFY = 0x5005, /**< De-iconify and raise window */
|
||||||
EVENT_WINDOW_DELETE = 0x6006, /**< Delete window */
|
EVENT_WINDOW_DRAG = 0x5006, /**< Drag window */
|
||||||
|
EVENT_WINDOW_DELETE = 0x5007, /**< Delete window */
|
||||||
|
|
||||||
// Recipient == TOOLBAR
|
// Recipient == TOOLBAR
|
||||||
|
|
||||||
EVENT_TOOLBAR_GRAB = 0x7000, /**< Click on title widget */
|
EVENT_TOOLBAR_GRAB = 0x6000, /**< Click on title widget */
|
||||||
EVENT_TOOLBAR_UNGRAB = 0x7001, /**< Release click on title widget */
|
EVENT_TOOLBAR_UNGRAB = 0x6001, /**< Release click on title widget */
|
||||||
EVENT_TOOLBAR_MENU = 0x7002, /**< Toolbar menu button released */
|
EVENT_TOOLBAR_MENU = 0x6002, /**< Toolbar menu button released */
|
||||||
EVENT_TOOLBAR_MINIMIZE = 0x7003, /**< Toolbar minimize button released */
|
EVENT_TOOLBAR_MINIMIZE = 0x6003, /**< Toolbar minimize button released */
|
||||||
EVENT_TOOLBAR_RESIZE = 0x7004, /**< Toolbar resize button released */
|
EVENT_TOOLBAR_RESIZE = 0x6004, /**< Toolbar resize button released */
|
||||||
EVENT_TOOLBAR_TERMINATE = 0x7005, /**< Toolbar delete button released */
|
EVENT_TOOLBAR_TERMINATE = 0x6005, /**< Toolbar delete button released */
|
||||||
|
|
||||||
// Recipient == BORDER
|
// Recipient == BORDER
|
||||||
|
|
||||||
// Recipient == RESIZE
|
// Recipient == RESIZE
|
||||||
|
|
||||||
EVENT_RESIZE_START = 0x9000, /**< Start window resize */
|
EVENT_RESIZE_START = 0x8000, /**< Start window resize */
|
||||||
EVENT_RESIZE_VERTZOOM = 0x9001, /**< Zoom vertically only */
|
EVENT_RESIZE_VERTZOOM = 0x8001, /**< Zoom vertically only */
|
||||||
EVENT_RESIZE_HORIZOOM = 0x9002, /**< Zoom horizontally only */
|
EVENT_RESIZE_HORIZOOM = 0x8002, /**< Zoom horizontally only */
|
||||||
EVENT_RESIZE_FULLZOOM = 0x9003, /**< Zoom both vertically and horizontally */
|
EVENT_RESIZE_FULLZOOM = 0x8003, /**< Zoom both vertically and horizontally */
|
||||||
EVENT_RESIZE_LEFTZOOM = 0x9004, /**< Zoom left only */
|
EVENT_RESIZE_LEFTZOOM = 0x8004, /**< Zoom left only */
|
||||||
EVENT_RESIZE_RIGHTZOOM = 0x9005, /**< Zoom right only */
|
EVENT_RESIZE_RIGHTZOOM = 0x8005, /**< Zoom right only */
|
||||||
EVENT_RESIZE_TOPZOOM = 0x9006, /**< Zoom top only */
|
EVENT_RESIZE_TOPZOOM = 0x8006, /**< Zoom top only */
|
||||||
EVENT_RESIZE_BOTTOMZOOM = 0x9007, /**< Zoom bottom only */
|
EVENT_RESIZE_BOTTOMZOOM = 0x8007, /**< Zoom bottom only */
|
||||||
|
|
||||||
// Recipient == APP
|
// Recipient == APP
|
||||||
// All application defined events must (1) use recepient == EVENT_RECIPIENT_APP,
|
// All application defined events must (1) use recepient == EVENT_RECIPIENT_APP,
|
||||||
@ -221,7 +218,7 @@ namespace Twm4Nx
|
|||||||
{
|
{
|
||||||
uint16_t eventID; /**< Encoded event ID */
|
uint16_t eventID; /**< Encoded event ID */
|
||||||
FAR CWindowEvent *instance; /**< X/Y position */
|
FAR CWindowEvent *instance; /**< X/Y position */
|
||||||
FAR struct SWindow *win; /**< Twm4NX window reference */
|
FAR void *obj; /**< Context specific reference */
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user