More NxWM support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4682 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
d4f2f57522
commit
0bab68e8a5
@ -35,6 +35,9 @@ Installing and Building the Unit Tests
|
||||
for the STM3210E-EVAL available. However, the unit test can be run on
|
||||
other configurations (see steps d and e below).
|
||||
|
||||
NOTE: The special configuratin sim/nxwm is recommended for unit-leveling
|
||||
testing of NxWM because the configuration is more complex in that case.
|
||||
|
||||
We will assume the sim/nsh2 configuration in this discussion. The
|
||||
sim/nsh2 configuration is installed as follows:
|
||||
|
||||
@ -48,7 +51,7 @@ Installing and Building the Unit Tests
|
||||
<nuttx-directory-path> is the full, absolute path to the NuttX build directory
|
||||
|
||||
If you are using the sim/nsh2 or stm3210e-eval configurations, then skip
|
||||
to step 2.
|
||||
to step 2 (Hmmm.. better check 1d) too).
|
||||
|
||||
There may be certain requirements for the configuration that you select...
|
||||
for example, certain widget tests may require touchscreen support or special
|
||||
@ -77,7 +80,12 @@ Installing and Building the Unit Tests
|
||||
Then you can run the simulation using GDB or DDD which is a very powerful
|
||||
debugging environment!
|
||||
|
||||
d) Other nuttx/.config changes -- NSH configurations only.
|
||||
d) Special configuration requirements for the nxwm unit test:
|
||||
|
||||
CONFIG_NXCONSOLE=y
|
||||
CONFIG_NX_MULTIUSER=y
|
||||
|
||||
e) Other nuttx/.config changes -- NSH configurations only.
|
||||
|
||||
If the configuration that you are using supports NSH and NSH built-in tasks
|
||||
then all is well. If it is an NSH configuration, then you will have to define
|
||||
@ -89,7 +97,7 @@ Installing and Building the Unit Tests
|
||||
to change anything further in the nuttx/.config file if you are using either
|
||||
of these configurations.
|
||||
|
||||
e) Other apps/.config changes -- NON-NSH configurations only.
|
||||
f) Other apps/.config changes -- NON-NSH configurations only.
|
||||
|
||||
For non-NSH configurations (such as the sim/touchscreen) you will have to
|
||||
remove the CONFIGURED_APPS seting that contains the user_start function so
|
||||
@ -147,7 +155,15 @@ Installing and Building the Unit Tests
|
||||
cd <nxwidgets-directory>/libnxwidgets
|
||||
make TOPDIR=<nuttx-directory-path>
|
||||
|
||||
6. Build NuttX including the unit test and the NXWidgets library
|
||||
6. Build the NxWM library.
|
||||
|
||||
The NxWM library (libnxwm.a) is required only for the NxWM unit test at
|
||||
NxWidgets/UnitTests/nxwm. For other unit tests, skip to step 7.
|
||||
|
||||
cd <nxwidgets-directory>/nxwm
|
||||
make TOPDIR=<nuttx-directory-path>
|
||||
|
||||
7. Build NuttX including the unit test and the NXWidgets library
|
||||
|
||||
cd <nuttx-directory-path>
|
||||
. ./setenv.sh
|
||||
@ -268,6 +284,10 @@ CTextBox
|
||||
Exercises the CTextBox widget
|
||||
Depends on CLabel
|
||||
|
||||
nxwm
|
||||
Exercises the NxWM window manager.
|
||||
Use the special configuration nuttx/configs/sim/nxwm
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
|
@ -54,12 +54,26 @@ else
|
||||
CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
|
||||
endif
|
||||
|
||||
# Add the path to the NxWM include directory to the CFLAGS
|
||||
|
||||
NXWM_DIR="$(TESTDIR)/../../nxwm"
|
||||
NXWM_INC="$(NXWM_DIR)/include"
|
||||
NXWM_LIB="$(NXWM_DIR)/libnxwm$(LIBEXT)"
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWM_INC)"}
|
||||
CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWM_INC)"}
|
||||
else
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWM_INC)"}
|
||||
CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWM_INC)"}
|
||||
endif
|
||||
|
||||
# Get the path to the archiver tool
|
||||
|
||||
TESTTOOL_DIR="$(TESTDIR)/../../tools"
|
||||
ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
|
||||
|
||||
# Hello, World! C++ Example
|
||||
# NxWM unit test
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
@ -92,7 +106,7 @@ STACKSIZE = 2048
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: clean depend context disclean chkcxx chklib
|
||||
.PHONY: clean depend context disclean chkcxx chklibnxwidgets chklibnxwm
|
||||
|
||||
# Object file creation targets
|
||||
|
||||
@ -121,7 +135,7 @@ endif
|
||||
|
||||
# Verify that the NXWidget library has been built
|
||||
|
||||
chklib:
|
||||
chklibnxwidgets:
|
||||
@( \
|
||||
if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
|
||||
echo "$(NXWIDGETS_LIB) does not exist."; \
|
||||
@ -131,18 +145,34 @@ chklib:
|
||||
fi; \
|
||||
)
|
||||
|
||||
# Verify that the NxWM library has been built
|
||||
|
||||
chklibnxwm:
|
||||
@( \
|
||||
if [ ! -e "$(NXWM_LIB)" ]; then \
|
||||
echo "$(NXWM_LIB) does not exist."; \
|
||||
echo "Please go to $(NXWM_LIB)"; \
|
||||
echo "and rebuild the library"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
)
|
||||
|
||||
# Library creation targets
|
||||
|
||||
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
|
||||
$(NXWIDGETS_LIB): # Just to keep make happy. chklibnxwidgets does the work.
|
||||
|
||||
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
|
||||
$(NXWM_LIB): # Just to keep make happy. chklibnxwm does the work.
|
||||
|
||||
.built: chkcxx chklibnxwidgets chklibnxwm $(OBJS) $(NXWIDGETS_LIB)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $(BIN), $${obj}); \
|
||||
done ; )
|
||||
ifeq ($(WINTOOL),y)
|
||||
@$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
|
||||
@$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWM_DIR)
|
||||
else
|
||||
@$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
|
||||
@$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWM_DIR)
|
||||
endif
|
||||
@touch .built
|
||||
|
||||
|
@ -40,8 +40,12 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "ctaskbar.hxx"
|
||||
#include "cstartwindow.hxx"
|
||||
#include "cnxconsole.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Pre-processor Definitions
|
||||
@ -61,7 +65,7 @@
|
||||
// Private Types
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct nxwm_test_s
|
||||
struct SNxWmTest
|
||||
{
|
||||
NxWM::CTaskbar *taskbar; // The task bar
|
||||
NxWM::CStartWindow *startwindow; // The start window
|
||||
@ -71,7 +75,7 @@ struct nxwm_test_s
|
||||
// Private Data
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static struct nxwm_test_s g_nxwmtest;
|
||||
static struct SNxWmTest g_nxwmtest;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public Function Prototypes
|
||||
@ -109,7 +113,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
// 4. Call CTaskBar::startWindowManager to start the display with applications in place
|
||||
|
||||
printf(MAIN_STRING "Create CTaskbar instance\n");
|
||||
g_nxwmtest.taskbar = new CTaskbar();
|
||||
g_nxwmtest.taskbar = new NxWM::CTaskbar();
|
||||
if (!g_nxwmtest.taskbar)
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to instantiate CTaskbar\n");
|
||||
@ -150,7 +154,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
// window application.
|
||||
|
||||
printf(MAIN_STRING "Opening the start window application window\n");
|
||||
CApplicationWindow *window = g_nxwmtest.taskbar->openApplicationWindow();
|
||||
NxWM::CApplicationWindow *window = g_nxwmtest.taskbar->openApplicationWindow();
|
||||
if (!window)
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to create CApplicationWindow for the start window\n");
|
||||
@ -170,7 +174,8 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
|
||||
// Add the NxConsole application to the start window
|
||||
|
||||
#if 0
|
||||
NxWM::CNxConsole *console = (NxWM::CNxConsole *)0; // Avoid compiler complaint
|
||||
|
||||
printf(MAIN_STRING "Opening the NxConsole application window\n");
|
||||
window = g_nxwmtest.taskbar->openApplicationWindow();
|
||||
if (!window)
|
||||
@ -180,7 +185,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Creating the NxConsole application\n");
|
||||
NxWM::CNxConsole *console = new CNxConsole(window);
|
||||
console = new NxWM::CNxConsole(g_nxwmtest.taskbar, window);
|
||||
if (!console)
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to instantiate CNxConsole\n");
|
||||
@ -196,11 +201,12 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
}
|
||||
|
||||
noconsole:
|
||||
#endif
|
||||
|
||||
// Add the calculator application to the start window
|
||||
|
||||
#if 0
|
||||
NxWM::CCalculator *calculator = (NxWM::CCalculator *)0; // Avoid compiler complaint
|
||||
|
||||
printf(MAIN_STRING "Opening the calculator application window\n");
|
||||
window = g_nxwmtest.taskbar->openApplicationWindow();
|
||||
if (!window)
|
||||
@ -210,7 +216,7 @@ noconsole:
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Creating the calculator application\n");
|
||||
NxWM::CCalculator *calculator = new CCalculator(window);
|
||||
calculator = new NxWM::CCalculator(g_nxwmtest.taskbar, window);
|
||||
if (!calculator)
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to instantiate calculator\n");
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
@ -79,21 +80,28 @@ namespace NXWidgets
|
||||
class CNxServer
|
||||
{
|
||||
private:
|
||||
#ifndef CONFIG_NX_MULTIUSER
|
||||
FAR NX_DRIVERTYPE *m_hDevice; /**< LCD/Framebuffer device handle */
|
||||
#endif
|
||||
NXHANDLE m_hNxServer; /**< NX server handle */
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
voilatile bool m_running; /**< True: The listener thread is running */
|
||||
voilatile bool m_connected; /**< True: Connected to the server */
|
||||
volatile bool m_running; /**< True: The listener thread is running */
|
||||
volatile bool m_connected; /**< True: Connected to the server */
|
||||
volatile bool m_stop; /**< True: Waiting for the listener thread to stop */
|
||||
sem_t m_connsem; /**< Wait for server connection */
|
||||
#endif
|
||||
static uint8_t m_nServers; /**< The number of NX server instances */
|
||||
|
||||
/**
|
||||
* This is the entry point of a thread that listeners for and dispatches
|
||||
* events from the NX server.
|
||||
* NX server thread. This is the entry point into the server thread that
|
||||
* serializes the multi-threaded accesses to the display.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
static int server(int argc, char *argv[]);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX listener thread. This is the entry point of a thread that listeners for and
|
||||
* dispatches events from the NX server.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
|
@ -52,13 +52,20 @@
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* NX Configuration *********************************************************/
|
||||
/**
|
||||
* C++ support is required
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_HAVE_CXX
|
||||
# error "C++ support is required (CONFIG_HAVE_CXX)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Required to enabled NX graphics support
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX
|
||||
# error "NX mouse/touchscreen support is required (CONFIG_NX_MOUSE)"
|
||||
# error "NX graphics support is required (CONFIG_NX)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -112,7 +119,19 @@
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_SERVERPRIO
|
||||
# define CONFIG_NXWIDGETS_SERVERPRIO 50
|
||||
# define CONFIG_NXWIDGETS_SERVERPRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_CLIENTPRIO
|
||||
# define CONFIG_NXWIDGETS_CLIENTPRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX server thread stack size (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_SERVERSTACK
|
||||
# define CONFIG_NXWIDGETS_SERVERSTACK 2048
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -120,30 +139,35 @@
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_LISTENERPRIO
|
||||
# define CONFIG_NXWIDGETS_LISTENERPRIO 50
|
||||
# define CONFIG_NXWIDGETS_LISTENERPRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX server/listener thread stack size (in multi-user mode)
|
||||
* NX listener thread stack size (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_STACKSIZE
|
||||
# define CONFIG_NXWIDGETS_STACKSIZE 4096
|
||||
#ifndef CONFIG_NXWIDGETS_LISTENERSTACK
|
||||
# define CONFIG_NXWIDGETS_LISTENERSTACK 2048
|
||||
#endif
|
||||
|
||||
/* NXWidget Configuration ***************************************************/
|
||||
/* NX Server/Device Configuration
|
||||
/**
|
||||
* NX Server/Device Configuration
|
||||
*
|
||||
* CONFIG_NXWIDGETS_DEVNO - LCD device number (in case there are more than
|
||||
* one LCDs connected. Default: 0
|
||||
* CONFIG_NXWIDGETS_VPLANE - Only a single video plane is supported. Default: 0
|
||||
* CONFIG_NXWIDGETS_SERVERPRIO - Priority of the NX server (in multi-user mode).
|
||||
* Default: 50
|
||||
* CONFIG_NXWIDGETS_SERVERPRIO
|
||||
* CONFIG_NXWIDGETS_CLIENTPRIO
|
||||
* CONFIG_NXWIDGETS_LISTENERPRIO - Priority of the NX event listener thread (in
|
||||
* multi-user mode). Default: 50
|
||||
* CONFIG_NXWIDGETS_STACKSIZE - Priority of the NX server/listener thread
|
||||
* stack size (in multi-user mode). Default: 4096
|
||||
* CONFIG_NXWIDGETS_EXTERNINIT - Define to support external display
|
||||
* initialization.
|
||||
* CONFIG_NXWIDGETS_SERVERSTACK - NX server thread stack size (in multi-user
|
||||
* mode). Default 2048
|
||||
* CONFIG_NXWIDGETS_LISTENERSTACK - NX listener thread stack size (in multi-user
|
||||
* mode). Default 2048
|
||||
*
|
||||
* NXWidget Configuration
|
||||
*
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdlib>
|
||||
#include <cerrno>
|
||||
#include <debug.h>
|
||||
|
||||
@ -212,12 +214,12 @@ bool CNxServer::connect(void)
|
||||
|
||||
// Start the server task
|
||||
|
||||
message("NxServer::connect: Starting nx_servertask task\n");
|
||||
gvdbg("NxServer::connect: Starting server task\n");
|
||||
serverId = task_create("NX Server", CONFIG_NXWIDGETS_SERVERPRIO,
|
||||
CONFIG_NXWIDGETS_STACKSIZE, nx_servertask, NULL);
|
||||
CONFIG_NXWIDGETS_SERVERSTACK, server, (FAR const char **)0);
|
||||
if (serverId < 0)
|
||||
{
|
||||
message("NxServer::connect: Failed to create nx_servertask task: %d\n", errno);
|
||||
gdbg("NxServer::connect: Failed to create nx_servertask task: %d\n", errno);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -239,7 +241,7 @@ bool CNxServer::connect(void)
|
||||
(void)pthread_attr_init(&attr);
|
||||
param.sched_priority = CONFIG_NXWIDGETS_LISTENERPRIO;
|
||||
(void)pthread_attr_setschedparam(&attr, ¶m);
|
||||
(void)pthread_attr_setstacksize(&attr, CONFIG_NXWIDGETS_STACKSIZE);
|
||||
(void)pthread_attr_setstacksize(&attr, CONFIG_NXWIDGETS_LISTENERSTACK);
|
||||
|
||||
m_stop = false;
|
||||
m_running = true;
|
||||
@ -247,7 +249,7 @@ bool CNxServer::connect(void)
|
||||
ret = pthread_create(&thread, &attr, listener, (FAR void *)this);
|
||||
if (ret != 0)
|
||||
{
|
||||
printf("NxServer::connect: pthread_create failed: %d\n", ret);
|
||||
gdbg("NxServer::connect: pthread_create failed: %d\n", ret);
|
||||
m_running = false;
|
||||
disconnect();
|
||||
return false;
|
||||
@ -266,7 +268,7 @@ bool CNxServer::connect(void)
|
||||
// In the successful case, the listener is still running (m_running)
|
||||
// and the server is connected (m_connected). Anything else is a failure.
|
||||
|
||||
if (!m_connected !! !m_running)
|
||||
if (!m_connected || !m_running)
|
||||
{
|
||||
disconnect();
|
||||
return false;
|
||||
@ -332,6 +334,75 @@ void CNxServer::disconnect(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX server thread. This is the entry point into the server thread that
|
||||
* serializes the multi-threaded accesses to the display.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
int CNxServer::server(int argc, char *argv[])
|
||||
{
|
||||
FAR NX_DRIVERTYPE *dev;
|
||||
int ret;
|
||||
|
||||
#if defined(CONFIG_NXWIDGETS_EXTERNINIT)
|
||||
/* Use external graphics driver initialization */
|
||||
|
||||
dev = up_nxdrvinit(CONFIG_NXWIDGETS_DEVNO);
|
||||
if (!dev)
|
||||
{
|
||||
gdbg("up_nxdrvinit failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||
/* Initialize the LCD device */
|
||||
|
||||
ret = up_lcdinitialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
gdbg("up_lcdinitialize failed: %d\n", -ret);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Get the device instance */
|
||||
|
||||
dev = up_lcdgetdev(CONFIG_NXWIDGETS_DEVNO);
|
||||
if (!dev)
|
||||
{
|
||||
gdbg("up_lcdgetdev failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Turn the LCD on at 75% power */
|
||||
|
||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||
#else
|
||||
/* Initialize the frame buffer device */
|
||||
|
||||
ret = up_fbinitialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
gdbg("nxcon_server: up_fbinitialize failed: %d\n", -ret);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
dev = up_fbgetvplane(CONFIG_NXWIDGETS_VPLANE);
|
||||
if (!dev)
|
||||
{
|
||||
gdbg("up_fbgetvplane failed, vplane=%d\n", CONFIG_NXWIDGETS_VPLANE);
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then start the server */
|
||||
|
||||
ret = nx_run(dev);
|
||||
gvdbg("nx_run returned: %d\n", errno);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is the entry point of a thread that listeners for and dispatches
|
||||
* events from the NX server.
|
||||
@ -342,7 +413,7 @@ FAR void *CNxServer::listener(FAR void *arg)
|
||||
{
|
||||
// The argument must be the CNxServer instance
|
||||
|
||||
CNxServer *This = (CNxServer*)pvArg;
|
||||
CNxServer *This = (CNxServer*)arg;
|
||||
|
||||
// Process events forever
|
||||
|
||||
@ -361,7 +432,7 @@ FAR void *CNxServer::listener(FAR void *arg)
|
||||
// An error occurred... assume that we have lost connection with
|
||||
// the server.
|
||||
|
||||
gdbg("CNxServer::listener: Lost server connection: %d\n", errno);
|
||||
gdbg("Lost server connection: %d\n", errno);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -371,7 +442,7 @@ FAR void *CNxServer::listener(FAR void *arg)
|
||||
{
|
||||
This->m_connected = true;
|
||||
sem_post(&This->m_connsem);
|
||||
gdbg("CNxServer::listener: Connected\n");
|
||||
gvdbg("Connected\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,27 @@ namespace NxWM
|
||||
{
|
||||
m_callback = callback;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Simulate a mouse click on the minimize icon. This inline method is only
|
||||
* used during automated testing of NxWM.
|
||||
*/
|
||||
|
||||
inline void clickMinimizeIcon(int index)
|
||||
{
|
||||
m_minimizeImage->click(0,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate a mouse click on the stop applicaiton icon. This inline method is only
|
||||
* used during automated testing of NxWM.
|
||||
*/
|
||||
|
||||
inline void clickStopIcon(int index)
|
||||
{
|
||||
m_stopImage->click(0,0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_CNXCONSOLE_NXX
|
||||
#define __INCLUDE_CNXCONSOLE_NXX
|
||||
#ifndef __INCLUDE_CNXCONSOLE_HXX
|
||||
#define __INCLUDE_CNXCONSOLE_HXX
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@ -77,12 +77,19 @@ namespace NxWM
|
||||
|
||||
class CNxConsole : public IApplication, private IApplicationCallback
|
||||
{
|
||||
protected:
|
||||
private:
|
||||
CTaskbar *m_taskbar; /**< Reference to the "parent" taskbar */
|
||||
CApplicationWindow *m_window; /**< Reference to the application window */
|
||||
NXCONSOLE m_nxcon; /**< NxConsole handle */
|
||||
pid_t m_pid; /**< Task ID of the NxConsole thread */
|
||||
|
||||
/**
|
||||
* This is the NxConsole task. This function first redirects output to the
|
||||
* console window.
|
||||
*/
|
||||
|
||||
static int nxconsole(int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* Called when the window minimize button is pressed.
|
||||
*/
|
||||
@ -170,4 +177,4 @@ namespace NxWM
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __INCLUDE_CNXCONSOLE_NXX
|
||||
#endif // __INCLUDE_CNXCONSOLE_HXX
|
||||
|
@ -116,12 +116,6 @@ namespace NxWM
|
||||
|
||||
void handleClickEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
|
||||
/**
|
||||
* CStartWindow Constructor
|
||||
*/
|
||||
|
||||
~CStartWindow(void);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -133,6 +127,12 @@ namespace NxWM
|
||||
|
||||
CStartWindow(CTaskbar *taskbar, CApplicationWindow *window);
|
||||
|
||||
/**
|
||||
* CStartWindow Constructor
|
||||
*/
|
||||
|
||||
~CStartWindow(void);
|
||||
|
||||
/**
|
||||
* Each implementation of IApplication must provide a method to recover
|
||||
* the contained CApplicationWindow instance.
|
||||
@ -185,7 +185,7 @@ namespace NxWM
|
||||
* CTaskbar when the application window must be displayed
|
||||
*/
|
||||
|
||||
virtual void redraw(void) = 0;
|
||||
void redraw(void);
|
||||
|
||||
/**
|
||||
* Add the application to the start window. The general sequence for
|
||||
@ -203,6 +203,19 @@ namespace NxWM
|
||||
*/
|
||||
|
||||
bool addApplication(IApplication *app);
|
||||
|
||||
/**
|
||||
* Simulate a mouse click on the icon at index. This inline method is only
|
||||
* used during automated testing of NxWM.
|
||||
*/
|
||||
|
||||
inline void clickIcon(int index)
|
||||
{
|
||||
if (index < m_slots.size())
|
||||
{
|
||||
m_slots.at(index).image->click(0,0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -100,18 +100,6 @@ namespace NxWM
|
||||
IApplication *m_topapp; /**< The top application in the hierarchy */
|
||||
TNxArray<struct STaskbarSlot> m_slots; /**< List of application slots in the task bar */
|
||||
|
||||
/**
|
||||
* Connect to the server
|
||||
*/
|
||||
|
||||
bool connect(void);
|
||||
|
||||
/**
|
||||
* Disconnect from the server
|
||||
*/
|
||||
|
||||
void disconnect(void);
|
||||
|
||||
/**
|
||||
* Create a raw window.
|
||||
*
|
||||
@ -202,12 +190,6 @@ namespace NxWM
|
||||
|
||||
void handleClickEvent(const NXWidgets::CWidgetEventArgs &e);
|
||||
|
||||
/**
|
||||
* CTaskbar Destructor
|
||||
*/
|
||||
|
||||
~CTaskbar(void);
|
||||
|
||||
public:
|
||||
/**
|
||||
* CTaskbar Constructor
|
||||
@ -217,6 +199,24 @@ namespace NxWM
|
||||
|
||||
CTaskbar(void);
|
||||
|
||||
/**
|
||||
* CTaskbar Destructor
|
||||
*/
|
||||
|
||||
~CTaskbar(void);
|
||||
|
||||
/**
|
||||
* Connect to the server
|
||||
*/
|
||||
|
||||
bool connect(void);
|
||||
|
||||
/**
|
||||
* Disconnect from the server
|
||||
*/
|
||||
|
||||
void disconnect(void);
|
||||
|
||||
/**
|
||||
* Initialize task bar. Task bar initialization is separate from
|
||||
* object instantiation so that failures can be reported. The window
|
||||
@ -341,6 +341,19 @@ namespace NxWM
|
||||
*/
|
||||
|
||||
bool stopApplication(IApplication *app);
|
||||
|
||||
/**
|
||||
* Simulate a mouse click on the icon at index. This inline method is only
|
||||
* used duringautomated testing of NxWM.
|
||||
*/
|
||||
|
||||
inline void clickIcon(int index)
|
||||
{
|
||||
if (index < m_slots.size())
|
||||
{
|
||||
m_slots.at(index).image->click(0,0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,42 @@
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* General Configuration ****************************************************/
|
||||
/**
|
||||
* Required settings:
|
||||
*
|
||||
* CONFIG_HAVE_CXX : C++ support is required
|
||||
* CONFIG_NX : NX must enabled
|
||||
* CONFIG_NX_MULTIUSER=y : NX must be configured in multiuse mode
|
||||
* CONFIG_NXCONSOLE=y : For NxConsole support
|
||||
*
|
||||
* General settings:
|
||||
*
|
||||
* CONFIG_NXWM_DEFAULT_FONTID - the NxWM default font ID. Default:
|
||||
* NXFONT_DEFAULT
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
#ifndef CONFIG_NX_MULTIUSER
|
||||
# warning "NX multi-user support is required (CONFIG_NX_MULTIUSER)"
|
||||
# error "NX multi-user support is required (CONFIG_NX_MULTIUSER)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NxConsole support is (probably) required
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXCONSOLE
|
||||
# warning "NxConsole support may be needed (CONFIG_NXCONSOLE)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -66,6 +96,27 @@
|
||||
#endif
|
||||
|
||||
/* Colors *******************************************************************/
|
||||
/**
|
||||
* Color configuration
|
||||
*
|
||||
* CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
|
||||
* MKRGB(160,160,160)
|
||||
* CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR - Select background color.
|
||||
* Default: MKRGB(120,192,192)
|
||||
* CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR - Normal "foreground" color. Default:
|
||||
* MKRGB(192,192,192)
|
||||
* CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR - Selected "foreground" color.
|
||||
* Default: MKRGB(192,192,192)
|
||||
* CONFIG_NXWM_DEFAULT_SHINEEDGECOLOR - Color of the bright edge of a border.
|
||||
* Default: MKRGB(255,255,255)
|
||||
* CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR - Color of the shadowed edge of a border.
|
||||
* Default: MKRGB(0,0,0)
|
||||
* CONFIG_NXWM_DEFAULT_FONTCOLOR - Default fong color. Default:
|
||||
* MKRGB(0,0,0)
|
||||
* CONFIG_NXWM_TRANSPARENT_COLOR - The "transparent" color. Default:
|
||||
* MKRGB(0,0,0)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Normal background color
|
||||
*/
|
||||
@ -127,6 +178,23 @@
|
||||
#endif
|
||||
|
||||
/* Task Bar Configuation ***************************************************/
|
||||
/**
|
||||
* Horizontal and vertical spacing of icons in the task bar.
|
||||
*
|
||||
* CONFIG_NXWM_TASKBAR_VSPACING - Vertical spacing. Default: 2 pixels
|
||||
* CONFIG_NXWM_TASKBAR_HSPACING - Horizontal spacing. Default: 2 rows
|
||||
*
|
||||
* Task bar location. Default is CONFIG_NXWM_TASKBAR_TOP.
|
||||
*
|
||||
* CONFIG_NXWM_TASKBAR_TOP - Task bar is at the top of the display
|
||||
* CONFIG_NXWM_TASKBAR_BOTTOM - Task bar is at the bottom of the display
|
||||
* CONFIG_NXWM_TASKBAR_LEFT - Task bar is on the left side of the display
|
||||
* CONFIG_NXWM_TASKBAR_RIGHT - Task bar is on the right side of the display
|
||||
*
|
||||
* CONFIG_NXWM_TASKBAR_WIDTH - Task bar thickness (either vertical or
|
||||
* horizontal). Default: 25 + 2*spacing
|
||||
*/
|
||||
|
||||
/**
|
||||
* Horizontal and vertical spacing of icons in the task bar.
|
||||
*/
|
||||
@ -152,7 +220,7 @@
|
||||
# warning "Multiple task bar positions specified"
|
||||
# endif
|
||||
#elif defined(CONFIG_NXWM_TASKBAR_LEFT)
|
||||
# if defined defined (CONFIG_NXWM_TASKBAR_RIGHT)
|
||||
# if defined (CONFIG_NXWM_TASKBAR_RIGHT)
|
||||
# warning "Multiple task bar positions specified"
|
||||
# endif
|
||||
#elif !defined(CONFIG_NXWM_TASKBAR_RIGHT)
|
||||
@ -174,12 +242,20 @@
|
||||
#endif
|
||||
|
||||
/* Tool Bar Configuration ***************************************************/
|
||||
/**
|
||||
* CONFIG_NXWM_TOOLBAR_HEIGHT. The height of the tool bar in each
|
||||
* application window. Default: Same as the thickness of the task bar.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_TOOLBAR_HEIGHT
|
||||
# define CONFIG_NXWM_TOOLBAR_HEIGHT CONFIG_NXWM_TASKBAR_WIDTH
|
||||
#endif
|
||||
|
||||
/* Background Image **********************************************************/
|
||||
/**
|
||||
* CONFIG_NXWM_BACKGROUND_IMAGE - The name of the image to use in the
|
||||
* background window. Default:NXWidgets::g_nuttxBitmap
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_BACKGROUND_IMAGE
|
||||
# define CONFIG_NXWM_BACKGROUND_IMAGE NXWidgets::g_nuttxBitmap
|
||||
@ -188,6 +264,9 @@
|
||||
/* Start Window Configuration ***********************************************/
|
||||
/**
|
||||
* Horizontal and vertical spacing of icons in the task bar.
|
||||
*
|
||||
* CONFIG_NXWM_STARTWINDOW_VSPACING - Vertical spacing. Default: 2 pixels
|
||||
* CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_STARTWINDOW_VSPACING
|
||||
@ -199,6 +278,20 @@
|
||||
#endif
|
||||
|
||||
/* NxConsole Window *********************************************************/
|
||||
/**
|
||||
* NxConsole Window Configuration
|
||||
*
|
||||
* CONFIG_NXWM_NXCONSOLE_PRIO - Priority of the NxConsole task. Default:
|
||||
* SCHED_PRIORITY_DEFAULT
|
||||
* CONFIG_NXWM_NXCONSOLE_STACKSIZE - The stack size to use when starting the
|
||||
* NxConsole task. Default: 2048 bytes.
|
||||
* CONFIG_NXWM_NXCONSOLE_WCOLOR - The color of the NxConsole window background.
|
||||
* Default: MKRGB(192,192,192)
|
||||
* CONFIG_NXWM_NXCONSOLE_FONTCOLOR - The color of the fonts to use in the
|
||||
* NxConsole window. Default: MKRGB(0,0,0)
|
||||
* CONFIG_NXWM_NXCONSOLE_FONTID - The ID of the font to use in the NxConsole
|
||||
* window. Default: CONFIG_NXWM_DEFAULT_FONTID
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_NXCONSOLE_PRIO
|
||||
# define CONFIG_NXWM_NXCONSOLE_PRIO SCHED_PRIORITY_DEFAULT
|
||||
|
@ -41,9 +41,9 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cunistd>
|
||||
#include <ctime>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <semaphore.h>
|
||||
#include <sched.h>
|
||||
@ -53,8 +53,8 @@
|
||||
#include "cwidgetcontrol.hxx"
|
||||
|
||||
#include "nxwmconfig.hxx"
|
||||
#include "cnxconsole.hxx"
|
||||
#include "nxwmglyphs.hxx"
|
||||
#include "cnxconsole.hxx"
|
||||
|
||||
/********************************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -66,119 +66,36 @@
|
||||
|
||||
namespace NxWM
|
||||
{
|
||||
/**
|
||||
* This structure is used to pass start up parameters to nxcon_task and to assure the
|
||||
* the NxConsole is successfully started.
|
||||
*/
|
||||
/**
|
||||
* This structure is used to pass start up parameters to the NxConsole task and to assure the
|
||||
* the NxConsole is successfully started.
|
||||
*/
|
||||
|
||||
struct nxcon_task_s
|
||||
{
|
||||
sem_t sem; // Sem that will be posted when the task is successfully initialized
|
||||
NXTKWINDOW hwnd; // Window handle
|
||||
NXCONSOLE nxcon; // NxConsole handle
|
||||
int minor; // Next device minor number
|
||||
bool result; // True if successfully initialized
|
||||
};
|
||||
struct SNxConsole
|
||||
{
|
||||
sem_t sem; /**< Sem that will be posted when the task is successfully initialized */
|
||||
NXTKWINDOW hwnd; /**< Window handle */
|
||||
NXCONSOLE nxcon; /**< NxConsole handle */
|
||||
int minor; /**< Next device minor number */
|
||||
bool result; /**< True if successfully initialized */
|
||||
};
|
||||
|
||||
/********************************************************************************************
|
||||
* Private Data
|
||||
********************************************************************************************/
|
||||
|
||||
/**
|
||||
* This global data structure is used to pass start parameters to nxcon_task and to
|
||||
* This global data structure is used to pass start parameters to NxConsole task and to
|
||||
* assure that the NxConsole is successfully started.
|
||||
*/
|
||||
|
||||
static struct nxcon_task_s g_nxconvars;
|
||||
static struct SNxConsole g_nxconvars;
|
||||
}
|
||||
|
||||
/********************************************************************************************
|
||||
* Private Functions
|
||||
********************************************************************************************/
|
||||
|
||||
/**
|
||||
* This is the NxConsole task. This function first redirects output to the console window.
|
||||
*/
|
||||
|
||||
static int nxcon_task(int argc, char *argv[])
|
||||
{
|
||||
// Configure NxConsole
|
||||
|
||||
struct nxcon_window_s wndo; /* Describes the window */
|
||||
wndo.wcolor[0] = CONFIG_NXWM_NXCONSOLE_WCOLOR;
|
||||
wndo.fcolor[0] = CONFIG_NXWM_NXCONSOLE_FONTCOLOR;
|
||||
wndo.fontid = CONFIG_NXWM_NXCONSOLE_FONTID;
|
||||
|
||||
// To stop compiler complaining about "jump to label crosses initialization of 'int fd'
|
||||
|
||||
int fd = -1;
|
||||
|
||||
// Use the window handle to create the NX console
|
||||
|
||||
g_nxconvars.nxcon = nxtk_register(g_nxconvars.hwnd, &wndo, g_nxconvars.minor);
|
||||
if (!g_nxconvars.nxcon)
|
||||
{
|
||||
goto errout;
|
||||
}
|
||||
|
||||
// Construct the driver name using this minor number
|
||||
|
||||
char devname[32];
|
||||
snprintf(devname, 32, "/dev/nxcon%d", g_nxconvars.minor);
|
||||
|
||||
// Increment the minor number while it is protect by the semaphore
|
||||
|
||||
g_nxconvars.minor++;
|
||||
|
||||
// Open the NxConsole driver
|
||||
|
||||
fd = open(devname, O_WRONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
goto errout_with_nxcon;
|
||||
}
|
||||
|
||||
// Now re-direct stdout and stderr so that they use the NX console driver.
|
||||
// Note that stdin is retained (file descriptor 0, probably the the serial console).
|
||||
|
||||
(void)fflush(stdout);
|
||||
(void)fflush(stderr);
|
||||
|
||||
(void)fclose(stdout);
|
||||
(void)fclose(stderr);
|
||||
|
||||
(void)dup2(fd, 1);
|
||||
(void)dup2(fd, 2);
|
||||
|
||||
// And we can close our original driver file descriptor
|
||||
|
||||
close(fd);
|
||||
|
||||
// Inform the parent thread that we successfully initialize
|
||||
|
||||
g_nxconvars.result = true;
|
||||
sem_post(&g_nxconvars.sem);
|
||||
|
||||
// Run the NSH console
|
||||
|
||||
#ifdef CONFIG_NSH_CONSOLE
|
||||
(void)nsh_consolemain(argc, argv);
|
||||
#endif
|
||||
|
||||
// We get here if console exits
|
||||
#warning "Missing logic"
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
errout_with_nxcon:
|
||||
nxcon_unregister(g_nxconvars.nxcon);
|
||||
|
||||
errout:
|
||||
g_nxconvars.nxcon = 0;
|
||||
g_nxconvars.result = false;
|
||||
sem_post(&g_nxconvars.sem);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************************
|
||||
* CNxConsole Method Implementations
|
||||
********************************************************************************************/
|
||||
@ -328,7 +245,7 @@ bool CNxConsole::run(void)
|
||||
|
||||
sched_lock();
|
||||
m_pid = TASK_CREATE("NxConsole", CONFIG_NXWM_NXCONSOLE_PRIO,
|
||||
CONFIG_NXWM_NXCONSOLE_STACKSIZE, nxcon_task,
|
||||
CONFIG_NXWM_NXCONSOLE_STACKSIZE, nxconsole,
|
||||
(FAR const char **)0);
|
||||
|
||||
// Did we successfully start the NxConsole task?
|
||||
@ -423,6 +340,90 @@ void CNxConsole::redraw(void)
|
||||
nxcon_redraw(m_nxcon, &rect, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the NxConsole task. This function first redirects output to the
|
||||
* console window.
|
||||
*/
|
||||
|
||||
int CNxConsole::nxconsole(int argc, char *argv[])
|
||||
{
|
||||
// Configure NxConsole
|
||||
|
||||
struct nxcon_window_s wndo; /* Describes the window */
|
||||
wndo.wcolor[0] = CONFIG_NXWM_NXCONSOLE_WCOLOR;
|
||||
wndo.fcolor[0] = CONFIG_NXWM_NXCONSOLE_FONTCOLOR;
|
||||
wndo.fontid = CONFIG_NXWM_NXCONSOLE_FONTID;
|
||||
|
||||
// To stop compiler complaining about "jump to label crosses initialization of 'int fd'
|
||||
|
||||
int fd = -1;
|
||||
|
||||
// Use the window handle to create the NX console
|
||||
|
||||
g_nxconvars.nxcon = nxtk_register(g_nxconvars.hwnd, &wndo, g_nxconvars.minor);
|
||||
if (!g_nxconvars.nxcon)
|
||||
{
|
||||
goto errout;
|
||||
}
|
||||
|
||||
// Construct the driver name using this minor number
|
||||
|
||||
char devname[32];
|
||||
snprintf(devname, 32, "/dev/nxcon%d", g_nxconvars.minor);
|
||||
|
||||
// Increment the minor number while it is protect by the semaphore
|
||||
|
||||
g_nxconvars.minor++;
|
||||
|
||||
// Open the NxConsole driver
|
||||
|
||||
fd = open(devname, O_WRONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
goto errout_with_nxcon;
|
||||
}
|
||||
|
||||
// Now re-direct stdout and stderr so that they use the NX console driver.
|
||||
// Note that stdin is retained (file descriptor 0, probably the the serial console).
|
||||
|
||||
(void)std::fflush(stdout);
|
||||
(void)std::fflush(stderr);
|
||||
|
||||
(void)std::fclose(stdout);
|
||||
(void)std::fclose(stderr);
|
||||
|
||||
(void)std::dup2(fd, 1);
|
||||
(void)std::dup2(fd, 2);
|
||||
|
||||
// And we can close our original driver file descriptor
|
||||
|
||||
std::close(fd);
|
||||
|
||||
// Inform the parent thread that we successfully initialize
|
||||
|
||||
g_nxconvars.result = true;
|
||||
sem_post(&g_nxconvars.sem);
|
||||
|
||||
// Run the NSH console
|
||||
|
||||
#ifdef CONFIG_NSH_CONSOLE
|
||||
(void)nsh_consolemain(argc, argv);
|
||||
#endif
|
||||
|
||||
// We get here if console exits
|
||||
#warning "Missing logic"
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
errout_with_nxcon:
|
||||
nxcon_unregister(g_nxconvars.nxcon);
|
||||
|
||||
errout:
|
||||
g_nxconvars.nxcon = 0;
|
||||
g_nxconvars.result = false;
|
||||
sem_post(&g_nxconvars.sem);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the window minimize button is pressed.
|
||||
*/
|
||||
|
@ -82,6 +82,84 @@ CTaskbar::~CTaskbar(void)
|
||||
disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the server
|
||||
*/
|
||||
|
||||
bool CTaskbar::connect(void)
|
||||
{
|
||||
// Connect to the server
|
||||
|
||||
bool nxConnected = CNxServer::connect();
|
||||
if (nxConnected)
|
||||
{
|
||||
// Set the background color
|
||||
|
||||
if (!setBackgroundColor(CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR))
|
||||
{
|
||||
// Failed
|
||||
}
|
||||
}
|
||||
|
||||
return nxConnected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the server
|
||||
*/
|
||||
|
||||
void CTaskbar::disconnect(void)
|
||||
{
|
||||
// Stop all applications and remove them from the task bar. Clearly, there
|
||||
// are some ordering issues here... On an orderly system shutdown, disconnection
|
||||
// should really occur priority to deleting instances
|
||||
|
||||
while (!m_slots.empty())
|
||||
{
|
||||
IApplication *app = m_slots.at(0).app;
|
||||
stopApplication(app);
|
||||
}
|
||||
|
||||
// Close the windows
|
||||
|
||||
NXWidgets::CWidgetControl *control;
|
||||
if (m_taskbar)
|
||||
{
|
||||
// Delete the contained widget control. We are responsible for it
|
||||
// because we created it
|
||||
|
||||
control = m_taskbar->getWidgetControl();
|
||||
if (control)
|
||||
{
|
||||
delete control;
|
||||
}
|
||||
|
||||
// Then delete the task bar window
|
||||
|
||||
delete m_taskbar;
|
||||
}
|
||||
|
||||
if (m_background)
|
||||
{
|
||||
// Delete the contained widget control. We are responsible for it
|
||||
// because we created it
|
||||
|
||||
control = m_background->getWidgetControl();
|
||||
if (control)
|
||||
{
|
||||
delete control;
|
||||
}
|
||||
|
||||
// Then delete the background
|
||||
|
||||
delete m_background;
|
||||
}
|
||||
|
||||
// And disconnect from the server
|
||||
|
||||
CNxServer::disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize task bar. Task bar initialization is separate from
|
||||
* object instantiation so that failures can be reported. The window
|
||||
@ -426,84 +504,6 @@ bool CTaskbar::stopApplication(IApplication *app)
|
||||
return redrawTaskbarWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the server
|
||||
*/
|
||||
|
||||
bool CTaskbar::connect(void)
|
||||
{
|
||||
// Connect to the server
|
||||
|
||||
bool nxConnected = CNxServer::connect();
|
||||
if (nxConnected)
|
||||
{
|
||||
// Set the background color
|
||||
|
||||
if (!setBackgroundColor(CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR))
|
||||
{
|
||||
// Failed
|
||||
}
|
||||
}
|
||||
|
||||
return nxConnected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the server
|
||||
*/
|
||||
|
||||
void CTaskbar::disconnect(void)
|
||||
{
|
||||
// Stop all applications and remove them from the task bar. Clearly, there
|
||||
// are some ordering issues here... On an orderly system shutdown, disconnection
|
||||
// should really occur priority to deleting instances
|
||||
|
||||
while (!m_slots.empty())
|
||||
{
|
||||
IApplication *app = m_slots.at(0).app;
|
||||
stopApplication(app);
|
||||
}
|
||||
|
||||
// Close the windows
|
||||
|
||||
NXWidgets::CWidgetControl *control;
|
||||
if (m_taskbar)
|
||||
{
|
||||
// Delete the contained widget control. We are responsible for it
|
||||
// because we created it
|
||||
|
||||
control = m_taskbar->getWidgetControl();
|
||||
if (control)
|
||||
{
|
||||
delete control;
|
||||
}
|
||||
|
||||
// Then delete the task bar window
|
||||
|
||||
delete m_taskbar;
|
||||
}
|
||||
|
||||
if (m_background)
|
||||
{
|
||||
// Delete the contained widget control. We are responsible for it
|
||||
// because we created it
|
||||
|
||||
control = m_background->getWidgetControl();
|
||||
if (control)
|
||||
{
|
||||
delete control;
|
||||
}
|
||||
|
||||
// Then delete the background
|
||||
|
||||
delete m_background;
|
||||
}
|
||||
|
||||
// And disconnect from the server
|
||||
|
||||
CNxServer::disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a raw window.
|
||||
*
|
||||
@ -893,7 +893,7 @@ bool CTaskbar::redrawTaskbarWindow(void)
|
||||
// For vertical task bars, the icons will be centered horizontally
|
||||
|
||||
iconPos.x = (windowSize.w - rect.getWidth()) >> 1;
|
||||
iconPos.y = taskbarPos.y
|
||||
iconPos.y = taskbarPos.y;
|
||||
#endif
|
||||
|
||||
// Set the position of the icon bitmap
|
||||
|
@ -170,7 +170,7 @@ static const struct NXWidgets::SRlePaletteBitmapEntry g_minimizeRleEntries[] =
|
||||
* Public Bitmap Structure Defintions
|
||||
********************************************************************************************/
|
||||
|
||||
const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap =
|
||||
const struct NXWidgets::SRlePaletteBitmap NxWM::g_minimizeBitmap =
|
||||
{
|
||||
CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
|
||||
CONFIG_NXWIDGETS_FMT, // fmt - Color format
|
||||
|
@ -196,7 +196,7 @@ static const struct NXWidgets::SRlePaletteBitmapEntry g_nshRleEntries[] =
|
||||
* Public Bitmap Structure Defintions
|
||||
********************************************************************************************/
|
||||
|
||||
const struct NXWidgets::SRlePaletteBitmap g_nshBitmap =
|
||||
const struct NXWidgets::SRlePaletteBitmap NxWM::g_nshBitmap =
|
||||
{
|
||||
CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
|
||||
CONFIG_NXWIDGETS_FMT, // fmt - Color format
|
||||
|
@ -197,7 +197,7 @@ static const struct NXWidgets::SRlePaletteBitmapEntry g_startRleEntries[] =
|
||||
* Public Bitmap Structure Defintions
|
||||
********************************************************************************************/
|
||||
|
||||
const struct NXWidgets::SRlePaletteBitmap g_startBitmap =
|
||||
const struct NXWidgets::SRlePaletteBitmap NxWM::g_startBitmap =
|
||||
{
|
||||
CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
|
||||
CONFIG_NXWIDGETS_FMT, // fmt - Color format
|
||||
|
@ -209,7 +209,7 @@ static const struct NXWidgets::SRlePaletteBitmapEntry g_stopRleEntries[] =
|
||||
* Public Bitmap Structure Defintions
|
||||
********************************************************************************************/
|
||||
|
||||
const struct NXWidgets::SRlePaletteBitmap g_stopBitmap =
|
||||
const struct NXWidgets::SRlePaletteBitmap NxWM::g_stopBitmap =
|
||||
{
|
||||
CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
|
||||
CONFIG_NXWIDGETS_FMT, // fmt - Color format
|
||||
|
Loading…
Reference in New Issue
Block a user