mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-09 06:25:16 +00:00
Squashed commit of the following:
apps/graphics/twm4nx: Other toolbar buttons need to be disabled while resizing. Lots of problems if you decide to iconify or exit while resizing. CResize now disables all buttons except for the RESIZE button while resizing.
apps/graphics/twm4nx: Add an event and logic to support notification of changes in the size of a window to NxTerm.
Various updates to adapt to change in boardctl() interface.
apps/graphics/twm4nx: Correct an error in the NxTerm resize logic
apps/graphics/twm4nx: Update debug output when failures to send a message occur. The returned value of -1 is not interested, need to show the errno value instead.
apps/graphics/twm4nx: Correct the maximum size of a message. Recent changes caused message send failures because a message exceed that previous maximum size.
apps/graphics/twm4nx: Fix routing of redraw events.
This commit is contained in:
parent
11fc2e4621
commit
e76bfbb74e
17 changed files with 249 additions and 57 deletions
|
|
@ -60,16 +60,17 @@
|
|||
// Window Events
|
||||
|
||||
#define EVENT_NXTERM_REDRAW (EVENT_RECIPIENT_APP | 0x0000)
|
||||
#define EVENT_NXTERM_RESIZE (EVENT_RECIPIENT_APP | 0x0001)
|
||||
#define EVENT_NXTERM_XYINPUT EVENT_SYSTEM_NOP
|
||||
#define EVENT_NXTERM_KBDINPUT EVENT_SYSTEM_NOP
|
||||
|
||||
// Button Events
|
||||
|
||||
#define EVENT_NXTERM_CLOSE (EVENT_RECIPIENT_APP | 0x0001)
|
||||
#define EVENT_NXTERM_CLOSE (EVENT_RECIPIENT_APP | 0x0002)
|
||||
|
||||
// Menu Events
|
||||
|
||||
#define EVENT_NXTERM_START (EVENT_RECIPIENT_APP | 0x0002)
|
||||
#define EVENT_NXTERM_START (EVENT_RECIPIENT_APP | 0x0003)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation Classes
|
||||
|
|
@ -113,6 +114,12 @@ namespace Twm4Nx
|
|||
|
||||
void redraw(void);
|
||||
|
||||
/**
|
||||
* inform NxTerm of a new window size.
|
||||
*/
|
||||
|
||||
void resize(void);
|
||||
|
||||
/**
|
||||
* This is the close window event handler. It will stop the NxTerm
|
||||
* application trhead.
|
||||
|
|
|
|||
|
|
@ -110,6 +110,15 @@
|
|||
#define WFLAGS_IS_MENU(f) (((f) & WFLAGS_MENU) != 0)
|
||||
#define WFLAGS_IS_HIDDEN(f) (((f) & WFLAGS_HIDDEN) != 0)
|
||||
|
||||
// Buttons can be disabled temporarily while in certain absorbing states
|
||||
// (such as resizing the window).
|
||||
|
||||
#define DISABLE_NO_BUTTONS (0)
|
||||
#define DISABLE_MENU_BUTTON (1 << MENU_BUTTON)
|
||||
#define DISABLE_DELETE_BUTTON (1 << DELETE_BUTTON)
|
||||
#define DISABLE_RESIZE_BUTTON (1 << RESIZE_BUTTON)
|
||||
#define DISABLE_MINIMIZE_BUTTON (1 << MINIMIZE_BUTTON)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation Classes
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -167,6 +176,7 @@ namespace Twm4Nx
|
|||
nxgl_coord_t m_tbLeftX; /**< Rightmost position of left buttons */
|
||||
nxgl_coord_t m_tbRightX; /**< Leftmost position of right buttons */
|
||||
uint8_t m_tbFlags; /**< Toolbar button customizations */
|
||||
uint8_t m_tbDisables; /**< Toolbar button disables */
|
||||
|
||||
// List of all toolbar button images
|
||||
|
||||
|
|
@ -849,6 +859,20 @@ namespace Twm4Nx
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable toolbar buttons. Buttons may need to be disabled
|
||||
* temporarily while in certain absorbing states (such as resizing the
|
||||
* window).
|
||||
*
|
||||
* @param disables The set of buttons to enable or disble See
|
||||
* DISABLE_* definitions.
|
||||
*/
|
||||
|
||||
inline void disableToolbarButtons(uint8_t disables)
|
||||
{
|
||||
m_tbDisables = disables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for widget-related toolbar events, typically button presses.
|
||||
* This is called by event handling logic for events that require
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ namespace Twm4Nx
|
|||
FAR void *eventObj; /**< Object reference that accompanies events */
|
||||
nxgl_coord_t minWidth; /**< The minimum width of the window */
|
||||
uint16_t redrawEvent; /**< Redraw event ID */
|
||||
uint16_t resizeEvent; /**< Resize event ID */
|
||||
uint16_t mouseEvent; /**< Mouse/touchscreen event ID */
|
||||
uint16_t kbdEvent; /**< Keyboard event ID */
|
||||
uint16_t closeEvent; /**< Window close event ID */
|
||||
|
|
@ -283,6 +284,7 @@ namespace Twm4Nx
|
|||
{
|
||||
m_appEvents.eventObj = events.eventObj; // Event object reference
|
||||
m_appEvents.redrawEvent = events.redrawEvent; // Redraw event ID
|
||||
m_appEvents.resizeEvent = events.resizeEvent; // Resize event ID
|
||||
m_appEvents.mouseEvent = events.mouseEvent; // Mouse/touchscreen event ID
|
||||
m_appEvents.kbdEvent = events.kbdEvent; // Keyboard event ID
|
||||
m_appEvents.closeEvent = events.closeEvent; // Window close event ID
|
||||
|
|
|
|||
|
|
@ -66,15 +66,15 @@
|
|||
*/
|
||||
|
||||
#ifndef CONFIG_HAVE_CXX
|
||||
# error "C++ support is required (CONFIG_HAVE_CXX)"
|
||||
# error C++ support is required (CONFIG_HAVE_CXX)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NX
|
||||
# error "NX support is required (CONFIG_NX)"
|
||||
# error NX support is required (CONFIG_NX)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NXTERM
|
||||
# warning "NxTerm support is required (CONFIG_NXTERM)"
|
||||
# warning NxTerm support is required (CONFIG_NXTERM)
|
||||
#endif
|
||||
|
||||
// Keyboard input can come from either /dev/console or via Twm4Nx. If
|
||||
|
|
@ -84,9 +84,9 @@
|
|||
// /dev/console for keyboard input.
|
||||
|
||||
#if !defined(CONFIG_TWM4NX_NOKEYBOARD) && !defined(CONFIG_NXTERM_NXKBDIN)
|
||||
# warning "Nxterm needs CONFIG_NXTERM_NXKBDIN for keyboard input"
|
||||
# warning Nxterm needs CONFIG_NXTERM_NXKBDIN for keyboard input
|
||||
#elif defined(CONFIG_TWM4NX_NOKEYBOARD) && defined(CONFIG_NXTERM_NXKBDIN)
|
||||
# warning "Nxterm has no keyboard input. Undefine CONFIG_NXTERM_NXKBDIN
|
||||
# warning Nxterm has no keyboard input. Undefine CONFIG_NXTERM_NXKBDIN
|
||||
#endif
|
||||
|
||||
// NxTerm Window /////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@
|
|||
// Preprocessor Definitions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define MAX_EVENT_MSGSIZE sizeof(struct SEventMsg)
|
||||
// struct SRedrawEventMsg is the largest message as of this writing
|
||||
|
||||
#define MAX_EVENT_MSGSIZE sizeof(struct SRedrawEventMsg)
|
||||
#define MAX_EVENT_PAYLOAD (MAX_EVENT_MSGSIZE - sizeof(uint16_t))
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -197,12 +199,16 @@ namespace Twm4Nx
|
|||
|
||||
struct SEventMsg
|
||||
{
|
||||
// Common fields
|
||||
|
||||
uint16_t eventID; /**< Encoded event ID */
|
||||
FAR void *obj; /**< Context specific reference */
|
||||
FAR void *handler; /**< Context specific handler */
|
||||
|
||||
// Event-specific fields
|
||||
|
||||
struct nxgl_point_s pos; /**< X/Y position */
|
||||
uint8_t context; /**< Button press context */
|
||||
FAR void *handler; /**< Context specific handler */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -211,8 +217,13 @@ namespace Twm4Nx
|
|||
|
||||
struct SRedrawEventMsg
|
||||
{
|
||||
// Common fields
|
||||
|
||||
uint16_t eventID; /**< Encoded event ID */
|
||||
FAR void *obj; /**< Context specific reference */
|
||||
FAR void *handler; /**< Context specific handler */
|
||||
|
||||
// Event-specific fields
|
||||
|
||||
struct nxgl_rect_s rect; /**< Region to be redrawn */
|
||||
bool more; /**< True: More redraw requests will follow */
|
||||
|
|
@ -225,8 +236,13 @@ namespace Twm4Nx
|
|||
|
||||
struct SXyInputEventMsg
|
||||
{
|
||||
// Common fields
|
||||
|
||||
uint16_t eventID; /**< Encoded event ID */
|
||||
FAR void *obj; /**< Context specific reference */
|
||||
FAR void *handler; /**< Context specific handler */
|
||||
|
||||
// Event-specific fields
|
||||
|
||||
struct nxgl_point_s pos; /**< X/Y position */
|
||||
uint8_t buttons; /**< Bit set of button presses */
|
||||
|
|
@ -239,8 +255,13 @@ namespace Twm4Nx
|
|||
|
||||
struct SNxEventMsg
|
||||
{
|
||||
// Common fields
|
||||
|
||||
uint16_t eventID; /**< Encoded event ID */
|
||||
FAR void *obj; /**< Context specific reference */
|
||||
FAR void *handler; /**< Context specific handler */
|
||||
|
||||
// Event-specific fields
|
||||
|
||||
FAR CWindowEvent *instance; /**< X/Y position */
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue