This commit incorporates the NxTerm window hosting NSH. This is just code complete and just compiles with no errors. The NxTerm item does not appear in the Main Menu, however, selecting the menu item does not yet bring up the NxTerm window.
Squashed commit of the following: apps/graphics/twm4nx: Revamp the event system to support notification of external applications when the window is being closed. apps/graphics/twm4nx: A little NxTerm progress apps/graphics/twm4nx: Clean up some logic associated with use of multiple Icon Managers. apps/graphics/twm4nx: Add CNxterm to the build. It is a long way from compiling.
This commit is contained in:
parent
77d10f9028
commit
abd7c9a165
@ -122,4 +122,12 @@ config TWM4NX_DEBUG
|
||||
and CONFIG_DEBUG_ERROR (but not the corresponding
|
||||
CONFIG_DEBUG_GRAPHICS_* settings)
|
||||
|
||||
config TWM4NX_NXTERM
|
||||
bool "NxTerm Window"
|
||||
default y
|
||||
depends on NXTERM && NSH_LIBRARY
|
||||
---help---
|
||||
Enable support for the NxTerm window which provides a text window
|
||||
in which you can interact with NSH.
|
||||
|
||||
endif # GRAPHICS_TWM4NX
|
||||
|
@ -58,6 +58,7 @@ CXXSRCS = cbackground.cxx cfonts.cxx ciconmgr.cxx ciconwidget.cxx
|
||||
CXXSRCS += cmenus.cxx cmainmenu.cxx
|
||||
CXXSRCS += cwindow.cxx cwindowevent.cxx cresize.cxx cwindowfactory.cxx
|
||||
CXXSRCS += cinput.cxx twm4nx_cursor.cxx
|
||||
CXXSRCS += cnxterm.cxx
|
||||
MAINSRC = ctwm4nx.cxx
|
||||
|
||||
VPATH = src
|
||||
|
@ -363,9 +363,14 @@ bool CBackground::createBackgroundWindow(void)
|
||||
// 3. Create a Widget control instance for the window using the default
|
||||
// style for now. CWindowEvent derives from CWidgetControl.
|
||||
|
||||
FAR CWindowEvent *control =
|
||||
new CWindowEvent(m_twm4nx, (FAR void *)this, EVENT_BACKGROUND_REDRAW,
|
||||
EVENT_BACKGROUND_XYINPUT, EVENT_SYSTEM_NOP);
|
||||
struct SAppEvents events;
|
||||
events.eventObj = (FAR void *)this;
|
||||
events.redrawEvent = EVENT_BACKGROUND_REDRAW;
|
||||
events.mouseEvent = EVENT_BACKGROUND_XYINPUT;
|
||||
events.kbdEvent = EVENT_SYSTEM_NOP;
|
||||
events.closeEvent = EVENT_SYSTEM_NOP;
|
||||
|
||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, events);
|
||||
|
||||
// Create the background window (CTwm4Nx inherits from CNxServer)
|
||||
|
||||
|
@ -624,9 +624,14 @@ bool CIconMgr::createIconManagerWindow(FAR const char *prefix)
|
||||
|
||||
// Configure mouse events needed by the button array.
|
||||
|
||||
bool success =
|
||||
m_window->configureEvents((FAR void *)this, EVENT_SYSTEM_NOP,
|
||||
EVENT_ICONMGR_XYINPUT, EVENT_SYSTEM_NOP);
|
||||
struct SAppEvents events;
|
||||
events.eventObj = (FAR void *)this;
|
||||
events.redrawEvent = EVENT_SYSTEM_NOP;
|
||||
events.mouseEvent = EVENT_ICONMGR_XYINPUT;
|
||||
events.kbdEvent = EVENT_SYSTEM_NOP;
|
||||
events.closeEvent = EVENT_SYSTEM_NOP;
|
||||
|
||||
bool success = m_window->configureEvents(events);
|
||||
if (!success)
|
||||
{
|
||||
delete m_window;
|
||||
|
@ -564,9 +564,14 @@ bool CMenus::createMenuWindow(void)
|
||||
|
||||
// Configure mouse events needed by the button array.
|
||||
|
||||
bool success =
|
||||
m_menuWindow->configureEvents((FAR void *)this, EVENT_SYSTEM_NOP,
|
||||
EVENT_MENU_XYINPUT, EVENT_SYSTEM_NOP);
|
||||
struct SAppEvents events;
|
||||
events.eventObj = (FAR void *)this;
|
||||
events.redrawEvent = EVENT_SYSTEM_NOP;
|
||||
events.mouseEvent = EVENT_MENU_XYINPUT;
|
||||
events.kbdEvent = EVENT_SYSTEM_NOP;
|
||||
events.closeEvent = EVENT_SYSTEM_NOP;
|
||||
|
||||
bool success = m_menuWindow->configureEvents(events);
|
||||
if (!success)
|
||||
{
|
||||
delete m_menuWindow;
|
||||
|
@ -43,13 +43,12 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cunistd>
|
||||
#include <cfcntl>
|
||||
#include <ctime>
|
||||
#include <cassert>
|
||||
|
||||
#include <sys/boardctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <semaphore.h>
|
||||
#include <sched.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "nshlib/nshlib.h"
|
||||
@ -58,7 +57,11 @@
|
||||
|
||||
#include "graphics/nxglyphs.hxx"
|
||||
#include "graphics/twm4nx/twm4nx_config.hxx"
|
||||
#include "graphics/twm4nx/twm4nx.hxx"
|
||||
#include "graphics/twm4nx/nxterm_config.hxx"
|
||||
#include "graphics/twm4nx/ctwm4nx.hxx"
|
||||
#include "graphics/twm4nx/cwindow.hxx"
|
||||
#include "graphics/twm4nx/cwindowfactory.hxx"
|
||||
#include "graphics/twm4nx/cmainmenu.hxx"
|
||||
#include "graphics/twm4nx/cnxterm.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -101,7 +104,7 @@ namespace Twm4Nx
|
||||
NXTERM nxterm; /**< NxTerm handle */
|
||||
int minor; /**< Next device minor number */
|
||||
struct nxterm_window_s wndo; /**< Describes the NxTerm window */
|
||||
bool result; /**< True if successfully initialized */
|
||||
bool success; /**< True if successfully initialized */
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -125,29 +128,20 @@ using namespace Twm4Nx;
|
||||
/**
|
||||
* CNxTerm constructor
|
||||
*
|
||||
* @param cwin. The application window
|
||||
* @param twm4nx. The Twm4Nx session instance
|
||||
*/
|
||||
|
||||
CNxTerm::CNxTerm(CTwm4Nx *twm4nx, CWindow *cwin)
|
||||
CNxTerm::CNxTerm(FAR CTwm4Nx *twm4nx)
|
||||
{
|
||||
// Save the constructor data
|
||||
// Save the context data
|
||||
|
||||
m_twm4nx = twm4nx;
|
||||
m_appWindow = cwin;
|
||||
m_twm4nx = twm4nx;
|
||||
m_nxtermWindow = (FAR CWindow *)0;
|
||||
|
||||
// The NxTerm is not runing
|
||||
|
||||
m_pid = -1;
|
||||
m_nxterm = 0;
|
||||
|
||||
// Add our personalized window label
|
||||
|
||||
NXWidgets::CNxString myName = getName();
|
||||
cwin->setWindowLabel(myName);
|
||||
|
||||
// Add our callbacks with the application window
|
||||
|
||||
cwin->registerCallbacks(static_cast<IApplicationCallback *>(this));
|
||||
m_pid = (pid_t)-1;
|
||||
m_NxTerm = (NXTERM)0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,33 +158,56 @@ CNxTerm::~CNxTerm(void)
|
||||
// Although we didn't create it, we are responsible for deleting the
|
||||
// application window
|
||||
|
||||
delete m_appWindow;
|
||||
delete m_nxtermWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Each implementation of IApplication must provide a method to recover
|
||||
* the contained CWindow instance.
|
||||
*/
|
||||
|
||||
IApplicationWindow *CNxTerm::getWindow(void) const
|
||||
{
|
||||
return static_cast<IApplicationWindow*>(m_appWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon associated with the application
|
||||
* CNxTerm initializers. Perform miscellaneous post-construction
|
||||
* initialization that may fail (and hence is not appropriate to be
|
||||
* done in the constructor)
|
||||
*
|
||||
* @return An instance if IBitmap that may be used to rend the
|
||||
* application's icon. This is an new IBitmap instance that must
|
||||
* be deleted by the caller when it is no long needed.
|
||||
* @return True if the NxTerm application was successfully initialized.
|
||||
*/
|
||||
|
||||
NXWidgets::IBitmap *CNxTerm::getIcon(void)
|
||||
bool CNxTerm::initialize(void)
|
||||
{
|
||||
NXWidgets::CRlePaletteBitmap *bitmap =
|
||||
new NXWidgets::CRlePaletteBitmap(&CONFIG_TWM4NX_NXTERM_ICON);
|
||||
// Call CWindowFactory::createWindow() to create a window for the NxTerm
|
||||
// application. Customizations:
|
||||
//
|
||||
// Flags: WFLAGS_NO_MENU_BUTTON indicates that there is no menu associated
|
||||
// with the NxTerm application window
|
||||
// Null Icon mager means to use the system, common Icon Manager
|
||||
|
||||
return bitmap;
|
||||
NXWidgets::CNxString name("NuttShell");
|
||||
|
||||
FAR CWindowFactory *factory = m_twm4nx->getWindowFactory();
|
||||
m_nxtermWindow = factory->createWindow(name, &CONFIG_TWM4NX_NXTERM_ICON,
|
||||
(FAR CIconMgr *)0,
|
||||
WFLAGS_NO_MENU_BUTTON);
|
||||
if (m_nxtermWindow == (FAR CWindow *)0)
|
||||
{
|
||||
twmerr("ERROR: Failed to create CWindow\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Configure events needed by the NxTerm applications
|
||||
|
||||
struct SAppEvents events;
|
||||
events.eventObj = (FAR void *)this;
|
||||
events.redrawEvent = EVENT_NXTERM_REDRAW;
|
||||
events.mouseEvent = EVENT_NXTERM_XYINPUT;
|
||||
events.kbdEvent = EVENT_NXTERM_KBDINPUT;
|
||||
events.closeEvent = EVENT_NXTERM_CLOSE;
|
||||
|
||||
bool success = m_nxtermWindow->configureEvents(events);
|
||||
if (!success)
|
||||
{
|
||||
delete m_nxtermWindow;
|
||||
m_nxtermWindow = (FAR CWindow *)0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,7 +220,7 @@ bool CNxTerm::run(void)
|
||||
{
|
||||
// Some sanity checking
|
||||
|
||||
if (m_pid >= 0 || m_nxterm != 0)
|
||||
if (m_pid >= 0 || m_NxTerm != 0)
|
||||
{
|
||||
twmerr("ERROR: All ready running or connected\n");
|
||||
return false;
|
||||
@ -219,13 +236,9 @@ bool CNxTerm::run(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Recover the NXTK window instance contained in the application window
|
||||
|
||||
NXWidgets::INxWindow *inxWindow = m_appWindow->getWindow();
|
||||
|
||||
// Get the widget control associated with the NXTK window
|
||||
|
||||
NXWidgets::CWidgetControl *control = inxWindow->getWidgetControl();
|
||||
NXWidgets::CWidgetControl *control = m_nxtermWindow->getWidgetControl();
|
||||
|
||||
// Get the window handle from the widget control
|
||||
|
||||
@ -243,13 +256,17 @@ bool CNxTerm::run(void)
|
||||
|
||||
// Get the size of the window
|
||||
|
||||
(void)inxWindow->getSize(&g_nxtermvars.wndo.wsize);
|
||||
if (!m_nxtermWindow->getWindowSize(&g_nxtermvars.wndo.wsize))
|
||||
{
|
||||
twmerr("ERROR: getWindowSize() failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start the NxTerm task
|
||||
|
||||
g_nxtermvars.console = (FAR void *)this;
|
||||
g_nxtermvars.result = false;
|
||||
g_nxtermvars.nxterm = 0;
|
||||
g_nxtermvars.success = false;
|
||||
g_nxtermvars.nxterm = 0;
|
||||
|
||||
sched_lock();
|
||||
m_pid = task_create("NxTerm", CONFIG_TWM4NX_NXTERM_PRIO,
|
||||
@ -258,11 +275,11 @@ bool CNxTerm::run(void)
|
||||
|
||||
// Did we successfully start the NxTerm task?
|
||||
|
||||
bool result = true;
|
||||
bool success = true;
|
||||
if (m_pid < 0)
|
||||
{
|
||||
twmerr("ERROR: Failed to create the NxTerm task\n");
|
||||
result = false;
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -275,17 +292,17 @@ bool CNxTerm::run(void)
|
||||
int ret = sem_timedwait(&g_nxtermvars.waitSem, &abstime);
|
||||
sched_unlock();
|
||||
|
||||
if (ret == OK && g_nxtermvars.result)
|
||||
if (ret == OK && g_nxtermvars.success)
|
||||
{
|
||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||
// Re-direct NX keyboard input to the new NxTerm driver
|
||||
|
||||
DEBUGASSERT(g_nxtermvars.nxterm != 0);
|
||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||
inxWindow->redirectNxTerm(g_nxtermvars.nxterm);
|
||||
m_nxtermWindow->redirectNxTerm(g_nxtermvars.nxterm);
|
||||
#endif
|
||||
// Save the handle to use in the stop method
|
||||
|
||||
m_nxterm = g_nxtermvars.nxterm;
|
||||
m_NxTerm = g_nxtermvars.nxterm;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -294,33 +311,28 @@ bool CNxTerm::run(void)
|
||||
|
||||
twmerr("ERROR: Failed start the NxTerm task\n");
|
||||
stop();
|
||||
result = false;
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
sem_post(&g_nxtermvars.exclSem);
|
||||
return result;
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the application.
|
||||
* This is the close windoe event handler. It will stop the NxTerm
|
||||
* application trhead.
|
||||
*/
|
||||
|
||||
void CNxTerm::stop(void)
|
||||
{
|
||||
// Delete the NxTerm task if it is still running (this could strand
|
||||
// resources). If we get here due to CTwm4Nx::stopApplication() processing
|
||||
// initialed by CNxTerm::exitHandler, then do *not* delete the task (it
|
||||
// is already being deleted).
|
||||
// resources).
|
||||
|
||||
if (m_pid >= 0)
|
||||
{
|
||||
// Calling task_delete() will also invoke the on_exit() handler. We se
|
||||
// m_pid = -1 before calling task_delete() to let the on_exit() handler,
|
||||
// CNxTerm::exitHandler(), know that it should not do anything
|
||||
|
||||
pid_t pid = m_pid;
|
||||
m_pid = -1;
|
||||
m_pid = (pid_t)-1;
|
||||
|
||||
// Then delete the NSH task, possibly stranding resources
|
||||
|
||||
@ -329,13 +341,12 @@ void CNxTerm::stop(void)
|
||||
|
||||
// Destroy the NX console device
|
||||
|
||||
if (m_nxterm)
|
||||
if (m_NxTerm)
|
||||
{
|
||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||
// Re-store NX keyboard input routing
|
||||
|
||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||
NXWidgets::INxWindow *inxWindow = m_appWindow->getWindow();
|
||||
inxWindow->redirectNxTerm((NXTERM)0);
|
||||
m_nxtermWindow->redirectNxTerm((NXTERM)0);
|
||||
#endif
|
||||
|
||||
// Unlink the NxTerm driver
|
||||
@ -345,84 +356,10 @@ void CNxTerm::stop(void)
|
||||
snprintf(devname, 32, "/dev/nxterm%d", m_minor);
|
||||
|
||||
(void)unlink(devname);
|
||||
m_nxterm = 0;
|
||||
m_NxTerm = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the application and free all of its resources. This method
|
||||
* will initiate blocking of messages from the NX server. The server
|
||||
* will flush the window message queue and reply with the blocked
|
||||
* message. When the block message is received by CWindowMessenger,
|
||||
* it will send the destroy message to the start window task which
|
||||
* will, finally, safely delete the application.
|
||||
*/
|
||||
|
||||
void CNxTerm::destroy(void)
|
||||
{
|
||||
// Block any further window messages
|
||||
|
||||
m_appWindow->block(this);
|
||||
|
||||
// Make sure that the application is stopped
|
||||
|
||||
stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* The application window is hidden (either it is minimized or it is
|
||||
* maximized, but not at the top of the hierarchy
|
||||
*/
|
||||
|
||||
void CNxTerm::hide(void)
|
||||
{
|
||||
// Disable drawing and events
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraw the entire window. The application has been maximized or
|
||||
* otherwise moved to the top of the hierarchy. This method is call from
|
||||
* CTwm4Nx when the application window must be displayed
|
||||
*/
|
||||
|
||||
void CNxTerm::redraw(void)
|
||||
{
|
||||
// Recover the NXTK window instance contained in the application window
|
||||
|
||||
NXWidgets::INxWindow *inxWindow = m_appWindow->getWindow();
|
||||
|
||||
// Get the size of the window
|
||||
|
||||
struct nxgl_size_s windowSize;
|
||||
(void)inxWindow->getSize(&windowSize);
|
||||
|
||||
// Redraw the entire NxTerm window
|
||||
|
||||
struct boardioc_nxterm_redraw_s redraw;
|
||||
|
||||
redraw.handle = m_nxterm;
|
||||
redraw.rect.pt1.x = 0;
|
||||
redraw.rect.pt1.y = 0;
|
||||
redraw.rect.pt2.x = windowSize.w - 1;
|
||||
redraw.rect.pt2.y = windowSize.h - 1;
|
||||
redraw.more = false;
|
||||
|
||||
(void)boardctl(BOARDIOC_NXTERM_KBDIN, (uintptr_t)&redraw);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report of this is a "normal" window or a full screen window. The
|
||||
* primary purpose of this method is so that window manager will know
|
||||
* whether or not it show draw the task bar.
|
||||
*
|
||||
* @return True if this is a full screen window.
|
||||
*/
|
||||
|
||||
bool CNxTerm::isFullScreen(void) const
|
||||
{
|
||||
return m_appWindow->isFullScreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the NxTerm task. This function first redirects output to the
|
||||
* console window then calls to start the NSH logic.
|
||||
@ -436,14 +373,6 @@ int CNxTerm::nxterm(int argc, char *argv[])
|
||||
int fd = -1;
|
||||
int ret = OK;
|
||||
|
||||
// Set up an on_exit() event that will be called when this task exits
|
||||
|
||||
if (on_exit(exitHandler, g_nxtermvars.console) != 0)
|
||||
{
|
||||
twmerr("ERROR: on_exit failed\n");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
// Use the window handle to create the NX console
|
||||
|
||||
struct boardioc_nxterm_create_s nxcreate;
|
||||
@ -522,7 +451,7 @@ int CNxTerm::nxterm(int argc, char *argv[])
|
||||
|
||||
// Inform the parent thread that we successfully initialized
|
||||
|
||||
g_nxtermvars.result = true;
|
||||
g_nxtermvars.success = true;
|
||||
sem_post(&g_nxtermvars.waitSem);
|
||||
|
||||
// Run the NSH console
|
||||
@ -539,7 +468,7 @@ int CNxTerm::nxterm(int argc, char *argv[])
|
||||
|
||||
errout:
|
||||
g_nxtermvars.nxterm = 0;
|
||||
g_nxtermvars.result = false;
|
||||
g_nxtermvars.success = false;
|
||||
sem_post(&g_nxtermvars.waitSem);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@ -558,6 +487,14 @@ bool CNxTerm::event(FAR struct SEventMsg *eventmsg)
|
||||
|
||||
switch (eventmsg->eventID)
|
||||
{
|
||||
case EVENT_NXTERM_REDRAW: // Redraw event (should not happen)
|
||||
redraw(); // Redraw the whole window
|
||||
break;
|
||||
|
||||
case EVENT_NXTERM_CLOSE: // Window close event
|
||||
stop(); // Stop the NxTerm thread
|
||||
break;
|
||||
|
||||
default:
|
||||
success = false;
|
||||
break;
|
||||
@ -567,47 +504,30 @@ bool CNxTerm::event(FAR struct SEventMsg *eventmsg)
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the NxTerm task exit handler. It registered with on_exit()
|
||||
* and called automatically when the nxterm task exits.
|
||||
* Redraw the entire window. The application has been maximized or
|
||||
* otherwise moved to the top of the hierarchy. This method is call from
|
||||
* CTwm4Nx when the application window must be displayed
|
||||
*/
|
||||
|
||||
void CNxTerm::exitHandler(int code, FAR void *arg)
|
||||
void CNxTerm::redraw(void)
|
||||
{
|
||||
CNxTerm *This = (CNxTerm *)arg;
|
||||
// Get the size of the window
|
||||
|
||||
// If we got here because of the task_delete() call in CNxTerm::stop(),
|
||||
// then m_pid will be set to -1 to let us know that we do not need to do
|
||||
// anything
|
||||
struct nxgl_size_s windowSize;
|
||||
(void)m_nxtermWindow->getWindowSize(&windowSize);
|
||||
|
||||
if (This->m_pid >= 0)
|
||||
{
|
||||
// Set m_pid to -1 to prevent calling detlete_task() in CNxTerm::stop().
|
||||
// CNxTerm::stop() is called by the processing initiated by the following
|
||||
// call to CTwm4Nx::stopApplication()
|
||||
// Redraw the entire NxTerm window
|
||||
|
||||
This->m_pid = -1;
|
||||
struct boardioc_nxterm_redraw_s redraw;
|
||||
|
||||
// Remove the NxTerm application from the Start Menu
|
||||
#warning Missing logic
|
||||
}
|
||||
}
|
||||
redraw.handle = m_NxTerm;
|
||||
redraw.rect.pt1.x = 0;
|
||||
redraw.rect.pt1.y = 0;
|
||||
redraw.rect.pt2.x = windowSize.w - 1;
|
||||
redraw.rect.pt2.y = windowSize.h - 1;
|
||||
redraw.more = false;
|
||||
|
||||
/**
|
||||
* Called when the window minimize button is pressed.
|
||||
*/
|
||||
|
||||
void CNxTerm::minimize(void)
|
||||
{
|
||||
m_twm4nx->minimizeApplication(static_cast<IApplication*>(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the window close button is pressed.
|
||||
*/
|
||||
|
||||
void CNxTerm::close(void)
|
||||
{
|
||||
m_twm4nx->stopApplication(static_cast<IApplication*>(this));
|
||||
(void)boardctl(BOARDIOC_NXTERM_KBDIN, (uintptr_t)&redraw);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -682,35 +602,32 @@ bool CNxTermFactory::nshlibInitialize(void)
|
||||
|
||||
bool CNxTermFactory::startFunction(FAR CTwm4Nx *twm4nx)
|
||||
{
|
||||
// Call CTaskBar::openFullScreenWindow to create a full screen window for
|
||||
// the NxTerm application
|
||||
// Instantiate the Nxterm application, providing only the session session
|
||||
// instance to the constructor
|
||||
|
||||
FAR CWindowFactory *factory = twm4nx->getWindowFactory();
|
||||
CWindow *cwin = factory->createWindow(twm4nx);
|
||||
if (!cwin )
|
||||
{
|
||||
twmerr("ERROR: Failed to create CWindow\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the window
|
||||
|
||||
if (!cwin->initialize(..arguments...))
|
||||
{
|
||||
twmerr("ERROR: Failed to open CWindow\n");
|
||||
delete cwin;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Instantiate the application, providing the session and the window to
|
||||
// the application's constructor
|
||||
|
||||
CNxTerm *nxterm = new CNxTerm(twm4nx, cwin);
|
||||
CNxTerm *nxterm = new CNxTerm(twm4nx);
|
||||
if (!nxterm)
|
||||
{
|
||||
twmerr("ERROR: Failed to instantiate CNxTerm\n");
|
||||
delete cwin;
|
||||
return (IApplication *)0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the NxTerm application
|
||||
|
||||
if (!nxterm->initialize())
|
||||
{
|
||||
twmerr("ERROR: Failed to initialize CNxTerm instance\n");
|
||||
delete nxterm;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start the NxTerm application instance
|
||||
|
||||
if (!nxterm->run())
|
||||
{
|
||||
twmerr("ERROR: Failed to start the NxTerm application\n");
|
||||
delete nxterm;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -963,9 +963,14 @@ bool CResize::createSizeWindow(void)
|
||||
// 3. Create a Widget control instance for the window using the default
|
||||
// style for now. CWindowEvent derives from CWidgetControl.
|
||||
|
||||
FAR CWindowEvent *control =
|
||||
new CWindowEvent(m_twm4nx, (FAR void *)this, EVENT_SYSTEM_NOP,
|
||||
EVENT_RESIZE_XYINPUT, EVENT_SYSTEM_NOP);
|
||||
struct SAppEvents events;
|
||||
events.eventObj = (FAR void *)this;
|
||||
events.redrawEvent = EVENT_SYSTEM_NOP;
|
||||
events.mouseEvent = EVENT_RESIZE_XYINPUT;
|
||||
events.kbdEvent = EVENT_SYSTEM_NOP;
|
||||
events.closeEvent = EVENT_SYSTEM_NOP;
|
||||
|
||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, events);
|
||||
|
||||
// 4. Create the main window
|
||||
|
||||
|
@ -65,6 +65,8 @@
|
||||
#include "platform/cxxinitialize.h"
|
||||
#include "netutils/netinit.h"
|
||||
|
||||
// Core Twm4Nx Definitions
|
||||
|
||||
#include "graphics/twm4nx/twm4nx_config.hxx"
|
||||
#include "graphics/twm4nx/ctwm4nx.hxx"
|
||||
#include "graphics/twm4nx/cbackground.hxx"
|
||||
@ -80,6 +82,10 @@
|
||||
#include "graphics/twm4nx/cfonts.hxx"
|
||||
#include "graphics/twm4nx/twm4nx_widgetevents.hxx"
|
||||
|
||||
// Applications
|
||||
|
||||
#include "graphics/twm4nx/cnxterm.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Pre-processor Definitions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -144,17 +150,18 @@ CTwm4Nx::~CTwm4Nx(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the main, controlling thread of the window manager. It is
|
||||
* called only from the extern "C" main() entry point.
|
||||
* Perform initialization additional, post-construction initialization
|
||||
* that may fail. This initialization logic fully initialized the
|
||||
* Twm4Nx session. Upon return, the session is ready for use.
|
||||
*
|
||||
* NOTE: In the event of truly abnormal conditions, this function will
|
||||
* not return. It will exit via the abort() method.
|
||||
* After Twm4Nx is initialized, external applications should register
|
||||
* themselves into the Main Menu in order to be a part of the desktop.
|
||||
*
|
||||
* @return True if the window manager was terminated properly. false is
|
||||
* return on any failure.
|
||||
* @return True if the Twm4Nx was properly initialized. false is
|
||||
* returned on any failure.
|
||||
*/
|
||||
|
||||
bool CTwm4Nx::run(void)
|
||||
bool CTwm4Nx::initialize(void)
|
||||
{
|
||||
// Open a message queue to receive NxWidget-related events. We need to
|
||||
// do this early so that the messasge queue name will be available to
|
||||
@ -176,12 +183,6 @@ bool CTwm4Nx::run(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
// Call all C++ static constructors
|
||||
|
||||
up_cxxinitialize();
|
||||
#endif
|
||||
|
||||
// Connect to the NX server
|
||||
|
||||
if (!connect())
|
||||
@ -328,6 +329,18 @@ bool CTwm4Nx::run(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the main, event loop of the Twm4Nx session.
|
||||
*
|
||||
* @return True if the Twm4Nxr was terminated noramly. false is returned
|
||||
* on any failure.
|
||||
*/
|
||||
|
||||
bool CTwm4Nx::eventLoop(void)
|
||||
{
|
||||
// Enter the event loop
|
||||
|
||||
twminfo("Entering event loop\n");
|
||||
@ -671,7 +684,13 @@ int twm4nx_main(int argc, char *argv[])
|
||||
|
||||
UNUSED(ret);
|
||||
|
||||
/* Create an instance of CTwm4Nx and and run it */
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
// Call all C++ static constructors
|
||||
|
||||
up_cxxinitialize();
|
||||
#endif
|
||||
|
||||
/* Create an instance of CTwm4Nx and initialize it */
|
||||
|
||||
FAR CTwm4Nx *twm4nx = new CTwm4Nx(display);
|
||||
if (twm4nx == (FAR CTwm4Nx *)0)
|
||||
@ -680,12 +699,32 @@ int twm4nx_main(int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Start the window manager
|
||||
|
||||
bool success = twm4nx->run();
|
||||
bool success = twm4nx->initialize();
|
||||
if (!success)
|
||||
{
|
||||
twmerr(" ERROR: Terminating due to failure\n");
|
||||
twmerr(" ERROR: Failed to initialize CTwm4Nx\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Twm4Nx is fully initialized and we may now register applications
|
||||
// Revisit. This is currently hardward coded here for testing. There
|
||||
// needs to be a more flexible method if adding applications at run
|
||||
// time.
|
||||
|
||||
CNxTermFactory factory;
|
||||
success = factory.initialize(twm4nx);
|
||||
if (!success)
|
||||
{
|
||||
twmerr(" ERROR: Failed to initialize CNxTermFactory\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Start the Twm4Nx event loop
|
||||
|
||||
success = twm4nx->eventLoop();
|
||||
if (!success)
|
||||
{
|
||||
twmerr(" ERROR: Event loop terminating due to failure\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -132,45 +132,49 @@ struct SToolbarInfo GToolBarInfo[NTOOLBAR_BUTTONS] =
|
||||
|
||||
CWindow::CWindow(CTwm4Nx *twm4nx)
|
||||
{
|
||||
m_twm4nx = twm4nx; // Save the Twm4Nx session
|
||||
m_eventq = (mqd_t)-1; // No widget message queue yet
|
||||
m_twm4nx = twm4nx; // Save the Twm4Nx session
|
||||
m_eventq = (mqd_t)-1; // No widget message queue yet
|
||||
|
||||
// Windows
|
||||
|
||||
m_nxWin = (FAR NXWidgets::CNxTkWindow *)0;
|
||||
m_toolbar = (FAR NXWidgets::CNxToolbar *)0;
|
||||
m_windowEvent = (FAR CWindowEvent *)0;
|
||||
m_eventObj = (FAR void *)0;
|
||||
m_minWidth = 1;
|
||||
m_redrawEvent = EVENT_SYSTEM_NOP; // Redraw event ID
|
||||
m_mouseEvent = EVENT_SYSTEM_NOP; // Mouse/touchscreen event ID
|
||||
m_kbdEvent = EVENT_SYSTEM_NOP; // Keyboard event ID
|
||||
m_zoom = ZOOM_NONE;
|
||||
m_modal = false;
|
||||
m_nxWin = (FAR NXWidgets::CNxTkWindow *)0;
|
||||
m_toolbar = (FAR NXWidgets::CNxToolbar *)0;
|
||||
m_windowEvent = (FAR CWindowEvent *)0;
|
||||
m_minWidth = 1;
|
||||
m_zoom = ZOOM_NONE;
|
||||
m_modal = false;
|
||||
|
||||
// Events
|
||||
|
||||
m_appEvents.eventObj = (FAR void *)0;
|
||||
m_appEvents.redrawEvent = EVENT_SYSTEM_NOP; // Redraw event ID
|
||||
m_appEvents.mouseEvent = EVENT_SYSTEM_NOP; // Mouse/touchscreen event ID
|
||||
m_appEvents.kbdEvent = EVENT_SYSTEM_NOP; // Keyboard event ID
|
||||
m_appEvents.closeEvent = EVENT_SYSTEM_NOP; // Window close event ID
|
||||
|
||||
// Toolbar
|
||||
|
||||
m_tbTitle = (FAR NXWidgets::CLabel *)0;
|
||||
m_tbHeight = 0; // Height of the toolbar
|
||||
m_tbLeftX = 0; // Offset to end of left buttons
|
||||
m_tbRightX = 0; // Offset to start of right buttons
|
||||
m_tbFlags = 0; // No customizations
|
||||
m_tbTitle = (FAR NXWidgets::CLabel *)0;
|
||||
m_tbHeight = 0; // Height of the toolbar
|
||||
m_tbLeftX = 0; // Offset to end of left buttons
|
||||
m_tbRightX = 0; // Offset to start of right buttons
|
||||
m_tbFlags = 0; // No customizations
|
||||
|
||||
// Icons/Icon Manager
|
||||
|
||||
m_iconBitMap = (FAR NXWidgets::CRlePaletteBitmap *)0;
|
||||
m_iconWidget = (FAR CIconWidget *)0;
|
||||
m_iconMgr = (FAR CIconMgr *)0;
|
||||
m_iconified = false;
|
||||
m_iconBitMap = (FAR NXWidgets::CRlePaletteBitmap *)0;
|
||||
m_iconWidget = (FAR CIconWidget *)0;
|
||||
m_iconMgr = (FAR CIconMgr *)0;
|
||||
m_iconified = false;
|
||||
|
||||
// Dragging
|
||||
|
||||
m_clicked = false;
|
||||
m_dragging = false;
|
||||
m_dragPos.x = 0;
|
||||
m_dragPos.y = 0;
|
||||
m_dragCSize.w = 0;
|
||||
m_dragCSize.h = 0;
|
||||
m_clicked = false;
|
||||
m_dragging = false;
|
||||
m_dragPos.x = 0;
|
||||
m_dragPos.y = 0;
|
||||
m_dragCSize.w = 0;
|
||||
m_dragCSize.h = 0;
|
||||
|
||||
// Toolbar buttons
|
||||
|
||||
@ -197,7 +201,8 @@ CWindow::~CWindow(void)
|
||||
* @param pos The initial position of the window
|
||||
* @param size The initial size of the window
|
||||
* @param sbitmap The Icon bitmap image. null if no icon.
|
||||
* @param iconMgr Pointer to icon manager instance
|
||||
* @param iconMgr Pointer to icon manager instance. To support
|
||||
* multiple Icon Managers.
|
||||
* @param flags Toolbar customizations see WFLAGS_NO_* definition
|
||||
* @return True if the window was successfully initialize; false on
|
||||
* any failure,
|
||||
@ -221,7 +226,16 @@ bool CWindow::initialize(FAR const NXWidgets::CNxString &name,
|
||||
return false;
|
||||
}
|
||||
|
||||
m_iconMgr = iconMgr;
|
||||
// If no Icon Manager was provided, we will use the standard Icon Manager
|
||||
|
||||
if (iconMgr == (FAR CIconMgr *)0)
|
||||
{
|
||||
m_iconMgr = m_twm4nx->getIconMgr();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iconMgr = iconMgr;
|
||||
}
|
||||
|
||||
if (name.getLength() == 0)
|
||||
{
|
||||
@ -367,28 +381,19 @@ bool CWindow::initialize(FAR const NXWidgets::CNxString &name,
|
||||
/**
|
||||
* Configure application window events.
|
||||
*
|
||||
* @param obj An object reference that will be provided with the event
|
||||
* to assist in handling the event. This may be NULL is not needed
|
||||
* @param redrawEvent The event to send on window redraw events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all rdraw events.
|
||||
* @param mouseEvent The event to send on mouse/touchscreen input
|
||||
* events. This may be EVENT_SYSTEM_NOP to ignore all mouse/
|
||||
* touchscreen input events.
|
||||
* @param kbdEvent The event to send on keyboard input events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all keyboard input events.
|
||||
* @param events Describes the application event configuration
|
||||
* @return True is returned on success
|
||||
*/
|
||||
|
||||
bool CWindow::configureEvents(FAR void *obj, uint16_t redrawEvent,
|
||||
uint16_t mouseEvent, uint16_t kbdEvent)
|
||||
bool CWindow::configureEvents(FAR const struct SAppEvents &events)
|
||||
{
|
||||
m_eventObj = obj; // Event object
|
||||
m_redrawEvent = redrawEvent; // Redraw event ID
|
||||
m_mouseEvent = mouseEvent; // Mouse/touchscreen event ID
|
||||
m_kbdEvent = kbdEvent; // Keyboard event ID
|
||||
m_appEvents.eventObj = events.eventObj; // Event object
|
||||
m_appEvents.redrawEvent = events.redrawEvent; // Redraw 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 event ID
|
||||
|
||||
return m_windowEvent->configureEvents(m_eventObj, m_redrawEvent,
|
||||
m_mouseEvent, m_kbdEvent);
|
||||
return m_windowEvent->configureEvents(events);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -686,10 +691,7 @@ bool CWindow::event(FAR struct SEventMsg *eventmsg)
|
||||
{
|
||||
// Don't terminate the Icon manager, just hide it
|
||||
|
||||
CIconMgr *iconMgr = m_twm4nx->getIconMgr();
|
||||
DEBUGASSERT(iconMgr != (CIconMgr *)0);
|
||||
|
||||
iconMgr->hide();
|
||||
m_iconMgr->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -769,8 +771,7 @@ bool CWindow::createMainWindow(FAR const nxgl_size_s *winsize,
|
||||
// Setup the the CWindowEvent instance to use our inherited drag event
|
||||
// handler
|
||||
|
||||
m_windowEvent = new CWindowEvent(m_twm4nx, m_eventObj, m_redrawEvent,
|
||||
m_mouseEvent, m_kbdEvent);
|
||||
m_windowEvent = new CWindowEvent(m_twm4nx, m_appEvents);
|
||||
m_windowEvent->registerDragEventHandler(this, (uintptr_t)1);
|
||||
|
||||
// 4. Create the window. Handling provided flags. NOTE: that menu windows
|
||||
@ -868,9 +869,14 @@ bool CWindow::createToolbar(void)
|
||||
// 2. Create a Widget control instance for the window using the default
|
||||
// style for now. CWindowEvent derives from CWidgetControl.
|
||||
|
||||
FAR CWindowEvent *control =
|
||||
new CWindowEvent(m_twm4nx, (FAR void *)this, EVENT_SYSTEM_NOP,
|
||||
EVENT_TOOLBAR_XYINPUT, EVENT_SYSTEM_NOP);
|
||||
struct SAppEvents events;
|
||||
events.eventObj = (FAR void *)this;
|
||||
events.redrawEvent = EVENT_SYSTEM_NOP;
|
||||
events.mouseEvent = EVENT_TOOLBAR_XYINPUT;
|
||||
events.kbdEvent = EVENT_SYSTEM_NOP;
|
||||
events.closeEvent = EVENT_SYSTEM_NOP;
|
||||
|
||||
FAR CWindowEvent *control = new CWindowEvent(m_twm4nx, events);
|
||||
control->registerDragEventHandler(this, (uintptr_t)0);
|
||||
|
||||
// 3. Get the toolbar sub-window from the framed window
|
||||
@ -1546,9 +1552,14 @@ bool CWindow::toolbarGrab(FAR struct SEventMsg *eventmsg)
|
||||
// to handle cases where the drag that starts in the toolbar is moved
|
||||
// into the application window area.
|
||||
|
||||
bool success =
|
||||
m_windowEvent->configureEvents((FAR void *)this, EVENT_SYSTEM_NOP,
|
||||
EVENT_TOOLBAR_XYINPUT, EVENT_SYSTEM_NOP);
|
||||
struct SAppEvents events;
|
||||
events.eventObj = (FAR void *)this;
|
||||
events.redrawEvent = EVENT_SYSTEM_NOP;
|
||||
events.mouseEvent = EVENT_TOOLBAR_XYINPUT;
|
||||
events.kbdEvent = EVENT_SYSTEM_NOP;
|
||||
events.closeEvent = m_appEvents.closeEvent;
|
||||
|
||||
bool success = m_windowEvent->configureEvents(events);
|
||||
if (!success)
|
||||
{
|
||||
return false;
|
||||
@ -1714,8 +1725,7 @@ bool CWindow::toolbarUngrab(FAR struct SEventMsg *eventmsg)
|
||||
|
||||
// Restore normal application event handling.
|
||||
|
||||
return m_windowEvent->configureEvents(m_eventObj, m_redrawEvent,
|
||||
m_mouseEvent, m_kbdEvent);
|
||||
return m_windowEvent->configureEvents(m_appEvents);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,39 +95,35 @@ using namespace Twm4Nx;
|
||||
* CWindowEvent Constructor
|
||||
*
|
||||
* @param twm4nx The Twm4Nx session instance.
|
||||
* @param obj Contextual object (Usually 'this' of instantiator)
|
||||
* @param redrawEvent The event to send on window redraw events. This may
|
||||
* be EVENT_SYSTEM_NOP to ignore all rdraw events.
|
||||
* @param mouseEvent The event to send on mouse/touchscreen input events.
|
||||
* This may be EVENT_SYSTEM_NOP to ignore all mouse/touchscreen input
|
||||
* events.
|
||||
* @param kbdEvent The event to send on keyboard input events. This may be
|
||||
* EVENT_SYSTEM_NOP to ignore all keyboard input events.
|
||||
* @param events Describes the application event configuration
|
||||
* @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.
|
||||
*/
|
||||
|
||||
CWindowEvent::CWindowEvent(FAR CTwm4Nx *twm4nx, FAR void *obj,
|
||||
uint16_t redrawEvent, uint16_t mouseEvent,
|
||||
uint16_t kbdEvent,
|
||||
CWindowEvent::CWindowEvent(FAR CTwm4Nx *twm4nx,
|
||||
FAR const struct SAppEvents &events,
|
||||
FAR const NXWidgets::CWidgetStyle *style)
|
||||
: NXWidgets::CWidgetControl(style)
|
||||
{
|
||||
m_twm4nx = twm4nx; // Cache the Twm4Nx session
|
||||
m_object = obj; // Used for event message construction
|
||||
m_redrawEvent = redrawEvent; // Redraw event ID
|
||||
m_mouseEvent = mouseEvent; // Mouse/touchscreen event ID
|
||||
m_kbdEvent = kbdEvent; // Keyboard event ID
|
||||
m_twm4nx = twm4nx; // Cache the Twm4Nx session
|
||||
|
||||
// Events
|
||||
|
||||
m_appEvents.eventObj = events.eventObj; // Event object reference
|
||||
m_appEvents.redrawEvent = events.redrawEvent; // Redraw 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
|
||||
|
||||
// Dragging
|
||||
|
||||
m_dragHandler = (FAR IDragEvent *)0; // No drag handler callbacks
|
||||
m_dragArg = (uintptr_t)0; // No callback argument
|
||||
m_dragHandler = (FAR IDragEvent *)0; // No drag handler callbacks
|
||||
m_dragArg = (uintptr_t)0; // No callback argument
|
||||
|
||||
// Open a message queue to send raw NX events. This cannot fail!
|
||||
|
||||
FAR const char *mqname = twm4nx->getEventQueueName();
|
||||
FAR const char *mqname = twm4nx->getEventQueueName();
|
||||
m_eventq = mq_open(mqname, O_WRONLY);
|
||||
if (m_eventq == (mqd_t)-1)
|
||||
{
|
||||
@ -173,10 +169,10 @@ void CWindowEvent::handleRedrawEvent(FAR const nxgl_rect_s *nxRect,
|
||||
|
||||
// Does the user need redraw events?
|
||||
|
||||
if (m_redrawEvent != EVENT_SYSTEM_NOP)
|
||||
if (m_appEvents.redrawEvent != EVENT_SYSTEM_NOP)
|
||||
{
|
||||
struct SRedrawEventMsg msg;
|
||||
msg.eventID = m_redrawEvent;
|
||||
msg.eventID = m_appEvents.redrawEvent;
|
||||
msg.rect.pt1.x = nxRect->pt1.x;
|
||||
msg.rect.pt1.y = nxRect->pt1.y;
|
||||
msg.rect.pt2.x = nxRect->pt2.x;
|
||||
@ -295,15 +291,15 @@ void CWindowEvent::handleMouseEvent(FAR const struct nxgl_point_s *pos,
|
||||
|
||||
// Does the user want to know about mouse input?
|
||||
|
||||
if (m_mouseEvent != EVENT_SYSTEM_NOP)
|
||||
if (m_appEvents.mouseEvent != EVENT_SYSTEM_NOP)
|
||||
{
|
||||
// Stimulate an XY input poll
|
||||
|
||||
twminfo("Mouse Input...\n");
|
||||
|
||||
struct SXyInputEventMsg msg;
|
||||
msg.eventID = m_mouseEvent;
|
||||
msg.obj = m_object;
|
||||
msg.eventID = m_appEvents.mouseEvent;
|
||||
msg.obj = m_appEvents.eventObj;
|
||||
msg.pos.x = pos->x;
|
||||
msg.pos.y = pos->y;
|
||||
msg.buttons = buttons;
|
||||
@ -327,15 +323,15 @@ void CWindowEvent::handleKeyboardEvent(void)
|
||||
{
|
||||
// Does the user want to know about keyboard input?
|
||||
|
||||
if (m_kbdEvent != EVENT_SYSTEM_NOP)
|
||||
if (m_appEvents.kbdEvent != EVENT_SYSTEM_NOP)
|
||||
{
|
||||
twminfo("Keyboard input...\n");
|
||||
|
||||
// Stimulate an keyboard event widget poll
|
||||
|
||||
struct SNxEventMsg msg;
|
||||
msg.eventID = m_kbdEvent;
|
||||
msg.obj = m_object;
|
||||
msg.eventID = m_appEvents.kbdEvent;
|
||||
msg.obj = m_appEvents.eventObj;
|
||||
msg.instance = this;
|
||||
|
||||
int ret = mq_send(m_eventq, (FAR const char *)&msg,
|
||||
|
@ -217,7 +217,7 @@ FAR CWindow *
|
||||
|
||||
if (!WFLAGS_IS_ICONMGR(flags) && !WFLAGS_IS_MENU(flags))
|
||||
{
|
||||
CIconMgr *iconmgr = m_twm4nx->getIconMgr();
|
||||
CIconMgr *iconmgr = win->cwin->getIconMgr();
|
||||
DEBUGASSERT(iconmgr != (CIconMgr *)0);
|
||||
|
||||
(void)iconmgr->addWindow(win->cwin);
|
||||
@ -265,7 +265,7 @@ void CWindowFactory::destroyWindow(FAR CWindow *cwin)
|
||||
|
||||
// Add the window to the icon manager
|
||||
|
||||
CIconMgr *iconmgr = m_twm4nx->getIconMgr();
|
||||
CIconMgr *iconmgr = cwin->getIconMgr();
|
||||
DEBUGASSERT(iconmgr != (CIconMgr *)0);
|
||||
|
||||
(void)iconmgr->removeWindow(cwin);
|
||||
|
@ -49,8 +49,24 @@
|
||||
|
||||
#include "graphics/twm4nx/ctwm4nx.hxx"
|
||||
#include "graphics/twm4nx/ctwm4nxevent.hxx"
|
||||
#include "graphics/twm4nx/twm4nx_widgetevents.hxx"
|
||||
#include "graphics/twm4nx/iapplication.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Pre-processor Definitions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CNxTerm application events
|
||||
// Window Events
|
||||
|
||||
#define EVENT_NXTERM_REDRAW (EVENT_RECIPIENT_APP | 0x0000)
|
||||
#define EVENT_NXTERM_XYINPUT EVENT_SYSTEM_NOP
|
||||
#define EVENT_NXTERM_KBDINPUT EVENT_SYSTEM_NOP
|
||||
|
||||
// Button Events
|
||||
|
||||
#define EVENT_NXTERM_CLOSE (EVENT_RECIPIENT_APP | 0x0001)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation Classes
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -64,11 +80,11 @@ namespace Twm4Nx
|
||||
class CNxTerm : public CTwm4NxEvent
|
||||
{
|
||||
private:
|
||||
CTaskbar *m_twm4nx; /**< Reference to the Twm4Nx session instance */
|
||||
CApplicationWindow *m_window; /**< Reference to the application window */
|
||||
NXTERM m_nxterm; /**< NxTerm handle */
|
||||
pid_t m_pid; /**< Task ID of the NxTerm thread */
|
||||
int m_minor; /**< Terminal device minor number */
|
||||
CTwm4Nx *m_twm4nx; /**< Reference to the Twm4Nx session instance */
|
||||
CWindow *m_nxtermWindow; /**< Reference to the NxTerm application window */
|
||||
NXTERM m_NxTerm; /**< NxTerm handle */
|
||||
pid_t m_pid; /**< Task ID of the NxTerm thread */
|
||||
int m_minor; /**< Terminal device minor number */
|
||||
|
||||
/**
|
||||
* This is the NxTerm task. This function first redirects output to the
|
||||
@ -88,73 +104,51 @@ namespace Twm4Nx
|
||||
bool event(FAR struct SEventMsg *eventmsg);
|
||||
|
||||
/**
|
||||
* This is the NxTerm task exit handler. It is registered with on_exit()
|
||||
* and called automatically when the nxterm task exits.
|
||||
*/
|
||||
|
||||
static void exitHandler(int code, FAR void *arg);
|
||||
|
||||
/**
|
||||
* Called when the window minimize button is pressed.
|
||||
*/
|
||||
|
||||
void minimize(void);
|
||||
|
||||
/**
|
||||
* Called when the window close button is pressed.
|
||||
*/
|
||||
|
||||
void close(void);
|
||||
|
||||
/**
|
||||
* Start the application (perhaps in the minimized state).
|
||||
*
|
||||
* @return True if the application was successfully started.
|
||||
*/
|
||||
|
||||
bool run(void);
|
||||
|
||||
/**
|
||||
* Stop the application.
|
||||
*/
|
||||
|
||||
void stop(void);
|
||||
|
||||
/**
|
||||
* Destroy the application and free all of its resources. This method
|
||||
* will initiate blocking of messages from the NX server. The server
|
||||
* will flush the window message queue and reply with the blocked
|
||||
* message. When the block message is received by CWindowMessenger,
|
||||
* it will send the destroy message to the start window task which
|
||||
* will, finally, safely delete the application.
|
||||
*/
|
||||
|
||||
void destroy(void);
|
||||
|
||||
/**
|
||||
* The application window is hidden (either it is minimized or it is
|
||||
* maximized, but not at the top of the hierarchy
|
||||
*/
|
||||
|
||||
void hide(void);
|
||||
|
||||
/**
|
||||
* Redraw the entire window. The application has been maximized or
|
||||
* otherwise moved to the top of the hierarchy. This method is call from
|
||||
* CTaskbar when the application window must be displayed
|
||||
* Handle the NxTerm redraw event.
|
||||
*/
|
||||
|
||||
void redraw(void);
|
||||
|
||||
/**
|
||||
* Report of this is a "normal" window or a full screen window. The
|
||||
* primary purpose of this method is so that window manager will know
|
||||
* whether or not it show draw the task bar.
|
||||
*
|
||||
* @return True if this is a full screen window.
|
||||
* This is the close window event handler. It will stop the NxTerm
|
||||
* application trhead.
|
||||
*/
|
||||
|
||||
bool isFullScreen(void) const;
|
||||
void stop(void);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* CNxTerm constructor
|
||||
*
|
||||
* @param twm4nx. The Twm4Nx session instance
|
||||
*/
|
||||
|
||||
CNxTerm(FAR CTwm4Nx *twm4nx);
|
||||
|
||||
/**
|
||||
* CNxTerm destructor
|
||||
*/
|
||||
|
||||
~CNxTerm(void);
|
||||
|
||||
/**
|
||||
* CNxTerm initializers. Perform miscellaneous post-construction
|
||||
* initialization that may fail (and hence is not appropriate to be
|
||||
* done in the constructor)
|
||||
*
|
||||
* @return True if the NxTerm application was successfully initialized.
|
||||
*/
|
||||
|
||||
bool initialize(void);
|
||||
|
||||
/**
|
||||
* Start the NxTerm.
|
||||
*
|
||||
* @return True if the NxTerm application was successfully started.
|
||||
*/
|
||||
|
||||
bool run(void);
|
||||
};
|
||||
|
||||
class CNxTermFactory : public IApplication, public IApplicationFactory
|
||||
@ -265,7 +259,7 @@ namespace Twm4Nx
|
||||
* @param twm4nx. The Twm4Nx session instance
|
||||
*/
|
||||
|
||||
bool CNxTermFactory::initialize(FAR CTwm4Nx *twm4nx);
|
||||
bool initialize(FAR CTwm4Nx *twm4nx);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -175,17 +175,27 @@ namespace Twm4Nx
|
||||
~CTwm4Nx(void);
|
||||
|
||||
/**
|
||||
* This is the main, controlling thread of the window manager. It is
|
||||
* called only from the extern "C" main() entry point.
|
||||
* Perform initialization additional, post-construction initialization
|
||||
* that may fail. This initialization logic fully initialized the
|
||||
* Twm4Nx session. Upon return, the session is ready for use.
|
||||
*
|
||||
* NOTE: In the event of truly abnormal conditions, this function will
|
||||
* not return. It will exit via the abort() method.
|
||||
* After Twm4Nx is initialized, external applications should register
|
||||
* themselves into the Main Menu in order to be a part of the desktop.
|
||||
*
|
||||
* @return True if the window manager was terminated properly. false is
|
||||
* return on any failure.
|
||||
* @return True if the Twm4Nx was properly initialized. false is
|
||||
* returned on any failure.
|
||||
*/
|
||||
|
||||
bool run(void);
|
||||
bool initialize(void);
|
||||
|
||||
/**
|
||||
* This is the main, event loop of the Twm4Nx session.
|
||||
*
|
||||
* @return True if the Twm4Nxr was terminated noramly. false is returned
|
||||
* on any failure.
|
||||
*/
|
||||
|
||||
bool eventLoop(void);
|
||||
|
||||
/**
|
||||
* Return a reference to the randomly generated event messageq queue
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include <mqueue.h>
|
||||
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nxterm.h>
|
||||
|
||||
#include "graphics/nxwidgets/cnxtoolbar.hxx"
|
||||
#include "graphics/nxwidgets/cwidgeteventhandler.hxx"
|
||||
@ -147,9 +148,7 @@ namespace Twm4Nx
|
||||
FAR CWindowEvent *m_windowEvent; /**< Cached window event reference */
|
||||
FAR void *m_eventObj; /**< Object reference that accompanies events */
|
||||
nxgl_coord_t m_minWidth; /**< The minimum width of the window */
|
||||
uint16_t m_redrawEvent; /**< Redraw event ID */
|
||||
uint16_t m_mouseEvent; /**< Mouse/touchscreen event ID */
|
||||
uint16_t m_kbdEvent; /**< Keyboard event ID */
|
||||
struct SAppEvents m_appEvents; /**< Application event information */
|
||||
uint16_t m_zoom; /**< Window zoom: ZOOM_NONE or EVENT_RESIZE_* */
|
||||
bool m_modal; /**< Window zoom: ZOOM_NONE or EVENT_RESIZE_* */
|
||||
|
||||
@ -407,7 +406,8 @@ namespace Twm4Nx
|
||||
* @param pos The initial position of the window
|
||||
* @param size The initial size of the window
|
||||
* @param sbitmap The Icon bitmap image. null if no icon.
|
||||
* @param iconMgr Pointer to icon manager instance
|
||||
* @param iconMgr Pointer to icon manager instance. To support
|
||||
* multiple Icon Managers.
|
||||
* @param flags Toolbar customizations see WFLAGS_NO_* definitions
|
||||
* @return True if the window was successfully initialize; false on
|
||||
* any failure,
|
||||
@ -422,20 +422,11 @@ namespace Twm4Nx
|
||||
/**
|
||||
* Configure application window events.
|
||||
*
|
||||
* @param obj An object reference that will be provided with the event
|
||||
* to assist in handling the event. This may be NULL is not needed
|
||||
* @param redrawEvent The event to send on window redraw events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all rdraw events.
|
||||
* @param mouseEvent The event to send on mouse/touchscreen input
|
||||
* events. This may be EVENT_SYSTEM_NOP to ignore all mouse/
|
||||
* touchscreen input events.
|
||||
* @param kbdEvent The event to send on keyboard input events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all keyboard input events.
|
||||
* @param events Describes the application event configuration
|
||||
* @return True is returned on success
|
||||
*/
|
||||
|
||||
bool configureEvents(FAR void *obj, uint16_t redrawEvent,
|
||||
uint16_t mouseEvent, uint16_t kbdEvent);
|
||||
bool configureEvents(FAR const struct SAppEvents &events);
|
||||
|
||||
/**
|
||||
* Synchronize the window with the NX server. This function will delay
|
||||
@ -459,6 +450,26 @@ namespace Twm4Nx
|
||||
return m_nxWin->getWidgetControl();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NXTERM_NXKBDIN
|
||||
/**
|
||||
* By default, NX forwards keyboard input to the various widgets residing
|
||||
* in the window. But NxTerm is a different usage model; In this case,
|
||||
* keyboard input needs to be directed to the NxTerm character driver.
|
||||
* This method can be used to enable (or disable) redirection of NX
|
||||
* keyboard input from the window widgets to the NxTerm
|
||||
*
|
||||
* @param handle. The NXTERM handle. If non-NULL, NX keyboard
|
||||
* input will be directed to the NxTerm driver using this
|
||||
* handle; If NULL (the default), NX keyboard input will be
|
||||
* directed to the widgets within the window.
|
||||
*/
|
||||
|
||||
inline void redirectNxTerm(NXTERM handle)
|
||||
{
|
||||
m_nxWin->redirectNxTerm(handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the name of the window
|
||||
*/
|
||||
@ -478,7 +489,10 @@ namespace Twm4Nx
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Icon Manager Window instance
|
||||
* Return the Icon Manager Window instance. Supports multiple
|
||||
* Icon Managers.
|
||||
*
|
||||
* @return The Icon Manager to which this window belongs.
|
||||
*/
|
||||
|
||||
inline FAR CIconMgr *getIconMgr(void)
|
||||
|
@ -59,6 +59,18 @@
|
||||
|
||||
namespace Twm4Nx
|
||||
{
|
||||
// This structure provides information to support application events
|
||||
|
||||
struct SAppEvents
|
||||
{
|
||||
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 mouseEvent; /**< Mouse/touchscreen event ID */
|
||||
uint16_t kbdEvent; /**< Keyboard event ID */
|
||||
uint16_t closeEvent; /**< Window close event ID */
|
||||
};
|
||||
|
||||
/**
|
||||
* This abstract base class provides add on methods to support dragging
|
||||
* of a window.
|
||||
@ -141,10 +153,7 @@ namespace Twm4Nx
|
||||
private:
|
||||
FAR CTwm4Nx *m_twm4nx; /**< Cached instance of CTwm4Nx */
|
||||
mqd_t m_eventq; /**< NxWidget event message queue */
|
||||
FAR void *m_object; /**< Window object (context specific) */
|
||||
uint16_t m_redrawEvent; /**< Redraw event ID */
|
||||
uint16_t m_mouseEvent; /**< Mouse/touchscreen event ID */
|
||||
uint16_t m_kbdEvent; /**< Keyboard event ID */
|
||||
struct SAppEvents m_appEvents; /**< Appliation event information */
|
||||
|
||||
// Dragging
|
||||
|
||||
@ -193,22 +202,13 @@ namespace Twm4Nx
|
||||
* CWindowEvent Constructor
|
||||
*
|
||||
* @param twm4nx The Twm4Nx session instance.
|
||||
* @param obj Contextual object (Usually 'this' of instantiator)
|
||||
* @param redrawEvent The event to send on window redraw events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all rdraw events.
|
||||
* @param mouseEvent The event to send on mouse/touchscreen input
|
||||
* events. This may be EVENT_SYSTEM_NOP to ignore all mouse/
|
||||
* touchscreen input events.
|
||||
* @param kbdEvent The event to send on keyboard input events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all keyboard input events.
|
||||
* @param events Describes the application event configuration
|
||||
* @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.
|
||||
*/
|
||||
|
||||
CWindowEvent(FAR CTwm4Nx *twm4nx, FAR void *obj,
|
||||
uint16_t redrawEvent, uint16_t mouseEvent,
|
||||
uint16_t kbdEvent,
|
||||
CWindowEvent(FAR CTwm4Nx *twm4nx, FAR const struct SAppEvents &events,
|
||||
FAR const NXWidgets::CWidgetStyle *style =
|
||||
(const NXWidgets::CWidgetStyle *)NULL);
|
||||
|
||||
@ -238,26 +238,17 @@ namespace Twm4Nx
|
||||
/**
|
||||
* Modify event handlers.
|
||||
*
|
||||
* One use for this is by the window drag logic to temporarily capture
|
||||
* application mouse/touchscreen inputs to handle cases where the drag
|
||||
* position enters the application window area.
|
||||
*
|
||||
* @param redrawEvent The event to send on window redraw events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all rdraw events.
|
||||
* @param mouseEvent The event to send on mouse/touchscreen input
|
||||
* events. This may be EVENT_SYSTEM_NOP to ignore all mouse/
|
||||
* touchscreen input events.
|
||||
* @param kbdEvent The event to send on keyboard input events. This
|
||||
* may be EVENT_SYSTEM_NOP to ignore all keyboard input events.
|
||||
* @param events Describes the application event configuration
|
||||
* @return True is returned on success
|
||||
*/
|
||||
|
||||
inline bool configureEvents(FAR void *obj, uint16_t redrawEvent,
|
||||
uint16_t mouseEvent, uint16_t kbdEvent)
|
||||
inline bool configureEvents(FAR const struct SAppEvents &events)
|
||||
{
|
||||
m_object = obj; // Event object reference
|
||||
m_redrawEvent = redrawEvent; // Redraw event ID
|
||||
m_mouseEvent = mouseEvent; // Mouse/touchscreen event ID
|
||||
m_kbdEvent = kbdEvent; // Keyboard event ID
|
||||
m_appEvents.eventObj = events.eventObj; // Event object reference
|
||||
m_appEvents.redrawEvent = events.redrawEvent; // Redraw 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
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
138
include/graphics/twm4nx/nxterm_config.hxx
Normal file
138
include/graphics/twm4nx/nxterm_config.hxx
Normal file
@ -0,0 +1,138 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// apps/graphics/twm4nx/include/nxterm_config.hxx
|
||||
// NxTerm configuration settings
|
||||
//
|
||||
// Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
// Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// 3. Neither the name NuttX nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __APPS_INCLUDE_GRAPHICS_TWM4NX_NXTERM_CONFIG_HXX
|
||||
#define __APPS_INCLUDE_GRAPHICS_TWM4NX_NXTERM_CONFIG_HXX
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Included Files
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "graphics/nxglyphs.hxx"
|
||||
#include "graphics/nxwidgets/crlepalettebitmap.hxx"
|
||||
#include "graphics/twm4nx/twm4nx_config.hxx"
|
||||
|
||||
#ifdef CONFIG_TWM4NX_NXTERM
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Pre-Processor Definitions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// General Configuration ////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Required settings:
|
||||
*
|
||||
* CONFIG_HAVE_CXX : C++ support is required
|
||||
* CONFIG_NX : NX must enabled
|
||||
* CONFIG_NXTERM=y : For NxTerm support
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_HAVE_CXX
|
||||
# error "C++ support is required (CONFIG_HAVE_CXX)"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NX
|
||||
# error "NX support is required (CONFIG_NX)"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NXTERM
|
||||
# warning "NxTerm support is required (CONFIG_NXTERM)"
|
||||
#endif
|
||||
|
||||
// NxTerm Window /////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* NxTerm Window Configuration
|
||||
*
|
||||
* CONFIG_TWM4NX_NXTERM_PRIO - Priority of the NxTerm task. Default:
|
||||
* SCHED_PRIORITY_DEFAULT. NOTE: This priority should be less than
|
||||
* CONFIG_NXSTART_SERVERPRIO or else there may be data overrun errors.
|
||||
* Such errors would most likely appear as duplicated rows of data on the
|
||||
* display.
|
||||
* CONFIG_TWM4NX_NXTERM_STACKSIZE - The stack size to use when starting the
|
||||
* NxTerm task. Default: 2048 bytes.
|
||||
* CONFIG_TWM4NX_NXTERM_WCOLOR - The color of the NxTerm window background.
|
||||
* Default: MKRGB(192,192,192)
|
||||
* CONFIG_TWM4NX_NXTERM_FONTCOLOR - The color of the fonts to use in the
|
||||
* NxTerm window. Default: MKRGB(0,0,0)
|
||||
* CONFIG_TWM4NX_NXTERM_FONTID - The ID of the font to use in the NxTerm
|
||||
* window. Default: CONFIG_TWM4NX_DEFAULT_FONTID
|
||||
* CONFIG_TWM4NX_NXTERM_ICON - The glyph to use as the NxTerm icon
|
||||
*/
|
||||
|
||||
// Tasking
|
||||
|
||||
#ifndef CONFIG_TWM4NX_NXTERM_PRIO
|
||||
# define CONFIG_TWM4NX_NXTERM_PRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
#if CONFIG_NXSTART_SERVERPRIO <= CONFIG_TWM4NX_NXTERM_PRIO
|
||||
# warning "CONFIG_NXSTART_SERVERPRIO <= CONFIG_TWM4NX_NXTERM_PRIO"
|
||||
# warning" -- This can result in data overrun errors"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TWM4NX_NXTERM_STACKSIZE
|
||||
# define CONFIG_TWM4NX_NXTERM_STACKSIZE 2048
|
||||
#endif
|
||||
|
||||
// Colors
|
||||
|
||||
#ifndef CONFIG_TWM4NX_NXTERM_WCOLOR
|
||||
# define CONFIG_TWM4NX_NXTERM_WCOLOR CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TWM4NX_NXTERM_FONTCOLOR
|
||||
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
|
||||
#endif
|
||||
|
||||
// Font ID
|
||||
|
||||
#ifndef CONFIG_TWM4NX_NXTERM_FONTID
|
||||
# define CONFIG_TWM4NX_NXTERM_FONTID NXFONT_DEFAULT
|
||||
#endif
|
||||
|
||||
// The NxTerm window glyph
|
||||
|
||||
#ifndef CONFIG_TWM4NX_NXTERM_ICON
|
||||
# define CONFIG_TWM4NX_NXTERM_ICON NXWidgets::g_cmdBitmap
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_TWM4NX_NXTERM
|
||||
#endif // __APPS_INCLUDE_GRAPHICS_TWM4NX_NXTERM_CONFIG_HXX
|
@ -71,29 +71,16 @@
|
||||
*
|
||||
* CONFIG_HAVE_CXX : C++ support is required
|
||||
* CONFIG_NX : NX must enabled
|
||||
* CONFIG_NXTERM=y : For NxTerm support
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_HAVE_CXX
|
||||
# error "C++ support is required (CONFIG_HAVE_CXX)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX Multi-user support is required
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX
|
||||
# error "NX support is required (CONFIG_NX)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NxTerm support is (probably) required to support NxTWM terminals
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_TWM4NX_NXTERM) && !defined(CONFIG_NXTERM)
|
||||
# warning "NxTerm support may be needed (CONFIG_NXTERM)"
|
||||
#endif
|
||||
|
||||
// Background ///////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@ -189,8 +176,6 @@
|
||||
|
||||
// Colors ///////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Colors *******************************************************************/
|
||||
|
||||
/**
|
||||
* Color configuration
|
||||
*
|
||||
@ -348,62 +333,6 @@
|
||||
# define CONFIG_TWM4NX_DEFAULT_FONTCOLOR MKRGB(0,64,0)
|
||||
#endif
|
||||
|
||||
// NxTerm Window /////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* NxTerm Window Configuration
|
||||
*
|
||||
* CONFIG_TWM4NX_NXTERM_PRIO - Priority of the NxTerm task. Default:
|
||||
* SCHED_PRIORITY_DEFAULT. NOTE: This priority should be less than
|
||||
* CONFIG_NXSTART_SERVERPRIO or else there may be data overrun errors.
|
||||
* Such errors would most likely appear as duplicated rows of data on the
|
||||
* display.
|
||||
* CONFIG_TWM4NX_NXTERM_STACKSIZE - The stack size to use when starting the
|
||||
* NxTerm task. Default: 2048 bytes.
|
||||
* CONFIG_TWM4NX_NXTERM_WCOLOR - The color of the NxTerm window background.
|
||||
* Default: MKRGB(192,192,192)
|
||||
* CONFIG_TWM4NX_NXTERM_FONTCOLOR - The color of the fonts to use in the
|
||||
* NxTerm window. Default: MKRGB(0,0,0)
|
||||
* CONFIG_TWM4NX_NXTERM_FONTID - The ID of the font to use in the NxTerm
|
||||
* window. Default: CONFIG_TWM4NX_DEFAULT_FONTID
|
||||
* CONFIG_TWM4NX_NXTERM_ICON - The glyph to use as the NxTerm icon
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_TWM4NX_NXTERM
|
||||
# ifndef CONFIG_TWM4NX_NXTERM_PRIO
|
||||
# define CONFIG_TWM4NX_NXTERM_PRIO SCHED_PRIORITY_DEFAULT
|
||||
# endif
|
||||
|
||||
# if CONFIG_NXSTART_SERVERPRIO <= CONFIG_TWM4NX_NXTERM_PRIO
|
||||
# warning "CONFIG_NXSTART_SERVERPRIO <= CONFIG_TWM4NX_NXTERM_PRIO"
|
||||
# warning" -- This can result in data overrun errors"
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_TWM4NX_NXTERM_STACKSIZE
|
||||
# define CONFIG_TWM4NX_NXTERM_STACKSIZE 2048
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_TWM4NX_NXTERM_WCOLOR
|
||||
# define CONFIG_TWM4NX_NXTERM_WCOLOR CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_TWM4NX_NXTERM_FONTCOLOR
|
||||
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_TWM4NX_NXTERM_FONTID
|
||||
# define CONFIG_TWM4NX_NXTERM_FONTID CONFIG_TWM4NX_DEFAULT_FONTID
|
||||
# endif
|
||||
|
||||
/**
|
||||
* The NxTerm window glyph
|
||||
*/
|
||||
|
||||
# ifndef CONFIG_TWM4NX_NXTERM_ICON
|
||||
# define CONFIG_TWM4NX_NXTERM_ICON NXWidgets::g_cmdBitmap
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Input Devices /////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user