forked from Archive/PX4-Autopilot
NxWM initial displays come up okay
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4687 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
0bb02729f1
commit
d7c6496584
|
@ -162,9 +162,18 @@ int MAIN_NAME(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
|
||||
if (!window->open())
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
|
||||
delete window;
|
||||
delete g_nxwmtest.taskbar;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Creating the start window application\n");
|
||||
g_nxwmtest.startwindow = new NxWM::CStartWindow(g_nxwmtest.taskbar, window);
|
||||
if (!g_nxwmtest.taskbar)
|
||||
if (!g_nxwmtest.startwindow)
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to instantiate CStartWindow\n");
|
||||
delete window;
|
||||
|
@ -195,6 +204,15 @@ int MAIN_NAME(int argc, char *argv[])
|
|||
goto noconsole;
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
|
||||
if (!window->open())
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
|
||||
delete window;
|
||||
delete g_nxwmtest.taskbar;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Creating the NxConsole application\n");
|
||||
console = new NxWM::CNxConsole(g_nxwmtest.taskbar, window);
|
||||
if (!console)
|
||||
|
@ -226,6 +244,15 @@ noconsole:
|
|||
goto nocalculator;
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
|
||||
if (!window->open())
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
|
||||
delete window;
|
||||
delete g_nxwmtest.taskbar;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf(MAIN_STRING "Creating the calculator application\n");
|
||||
calculator = new NxWM::CCalculator(g_nxwmtest.taskbar, window);
|
||||
if (!calculator)
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace NXWidgets
|
|||
TNxArray<CNxWidget*> m_widgets; /**< List of controlled
|
||||
widgets. */
|
||||
bool m_modal; /**< True: in modal loop */
|
||||
sem_t m_modalsem; /**< Modal loops waits for
|
||||
sem_t m_modalSem; /**< Modal loops waits for
|
||||
events on this semaphore */
|
||||
/**
|
||||
* I/O
|
||||
|
@ -194,7 +194,7 @@ namespace NXWidgets
|
|||
struct nxgl_point_s m_pos; /**< Position in display space */
|
||||
struct nxgl_rect_s m_bounds; /**< Size of the display */
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
sem_t m_geosem; /**< Posted when geometry is valid */
|
||||
sem_t m_geoSem; /**< Posted when geometry is valid */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -299,7 +299,7 @@ namespace NXWidgets
|
|||
inline void giveGeoSem(void)
|
||||
{
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
sem_post(&m_geosem);
|
||||
sem_post(&m_geoSem);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -53,115 +53,14 @@
|
|||
****************************************************************************/
|
||||
/* 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 graphics support is required (CONFIG_NX)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Required to enabled NX mouse/touchscreen support
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX_MOUSE
|
||||
# warning "NX mouse/touchscreen support is required (CONFIG_NX_MOUSE)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Required to enabled NX keyboard support
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX_KBD
|
||||
# warning "NX keyboard support is required (CONFIG_NX_KBD)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Only a single video plane is supported
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX_NPLANES
|
||||
# define CONFIG_NX_NPLANES 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_NX_NPLANES != 1
|
||||
# error "Only a single color plane is supported (CONFIG_NX_NPLANES)"
|
||||
#endif
|
||||
|
||||
/* NX Server/Device Configuration *******************************************/
|
||||
|
||||
/**
|
||||
* LCD device number (in case there are more than one LCDs connected)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_DEVNO
|
||||
# define CONFIG_NXWIDGETS_DEVNO 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Only a single video plane is supported
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_VPLANE
|
||||
# define CONFIG_NXWIDGETS_VPLANE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Priority of the NX server (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_SERVERPRIO
|
||||
# define CONFIG_NXWIDGETS_SERVERPRIO (SCHED_PRIORITY_DEFAULT+1)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_CLIENTPRIO
|
||||
# define CONFIG_NXWIDGETS_CLIENTPRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
#if CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_CLIENTPRIO
|
||||
# warning "CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_CLIENTPRIO"
|
||||
# warning" -- This can result in data overrun errors"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX server thread stack size (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_SERVERSTACK
|
||||
# define CONFIG_NXWIDGETS_SERVERSTACK 2048
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Priority of the NX event listener thread (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_LISTENERPRIO
|
||||
# define CONFIG_NXWIDGETS_LISTENERPRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
#if CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_LISTENERPRIO
|
||||
# warning "CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_LISTENERPRIO"
|
||||
# warning" -- This can result in data overrun errors"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX listener thread stack size (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_LISTENERSTACK
|
||||
# define CONFIG_NXWIDGETS_LISTENERSTACK 2048
|
||||
#endif
|
||||
|
||||
/* NXWidget Configuration ***************************************************/
|
||||
/**
|
||||
* Prerequisites:
|
||||
*
|
||||
* CONFIG_HAVE_CXX=y : C++ support is required
|
||||
* CONFIG_NX=y : NX graphics support must be enabled
|
||||
* CONFIG_NX_MOUSE=y : Required to enable NX mouse/touchscreen support
|
||||
* CONFIG_NX_KBD=y : Required to enabled NX keyboard support
|
||||
* CONFIG_NX_NPLANES=1 : Only a single video plane is supported
|
||||
*
|
||||
* NX Server/Device Configuration
|
||||
*
|
||||
* CONFIG_NXWIDGETS_DEVNO - LCD device number (in case there are more than
|
||||
|
@ -236,6 +135,115 @@
|
|||
* entered by NX polling cycles without losing data. Default: 4
|
||||
*/
|
||||
|
||||
/* Prerequisites ************************************************************/
|
||||
/**
|
||||
* C++ support is required
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_HAVE_CXX
|
||||
# error "C++ support is required (CONFIG_HAVE_CXX)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX graphics support must be enabled
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX
|
||||
# error "NX graphics support is required (CONFIG_NX)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Required to enable NX mouse/touchscreen support
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX_MOUSE
|
||||
# warning "NX mouse/touchscreen support is required (CONFIG_NX_MOUSE)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Required to enabled NX keyboard support
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX_KBD
|
||||
# warning "NX keyboard support is required (CONFIG_NX_KBD)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Only a single video plane is supported
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NX_NPLANES
|
||||
# define CONFIG_NX_NPLANES 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_NX_NPLANES != 1
|
||||
# error "Only a single color plane is supported (CONFIG_NX_NPLANES)"
|
||||
#endif
|
||||
|
||||
/* NX Server/Device Configuration *******************************************/
|
||||
/**
|
||||
* LCD device number (in case there are more than one LCDs connected)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_DEVNO
|
||||
# define CONFIG_NXWIDGETS_DEVNO 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Only a single video plane is supported
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_VPLANE
|
||||
# define CONFIG_NXWIDGETS_VPLANE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Priority of the NX server (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_SERVERPRIO
|
||||
# define CONFIG_NXWIDGETS_SERVERPRIO (SCHED_PRIORITY_DEFAULT+1)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_CLIENTPRIO
|
||||
# define CONFIG_NXWIDGETS_CLIENTPRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
#if CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_CLIENTPRIO
|
||||
# warning "CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_CLIENTPRIO"
|
||||
# warning" -- This can result in data overrun errors"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX server thread stack size (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_SERVERSTACK
|
||||
# define CONFIG_NXWIDGETS_SERVERSTACK 2048
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Priority of the NX event listener thread (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_LISTENERPRIO
|
||||
# define CONFIG_NXWIDGETS_LISTENERPRIO SCHED_PRIORITY_DEFAULT
|
||||
#endif
|
||||
|
||||
#if CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_LISTENERPRIO
|
||||
# warning "CONFIG_NXWIDGETS_SERVERPRIO <= CONFIG_NXWIDGETS_LISTENERPRIO"
|
||||
# warning" -- This can result in data overrun errors"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NX listener thread stack size (in multi-user mode)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWIDGETS_LISTENERSTACK
|
||||
# define CONFIG_NXWIDGETS_LISTENERSTACK 2048
|
||||
#endif
|
||||
|
||||
/* NXWidget Configuration ***************************************************/
|
||||
/**
|
||||
* Bits per pixel
|
||||
*/
|
||||
|
@ -317,7 +325,6 @@
|
|||
#endif
|
||||
|
||||
/* NXWidget Default Values **************************************************/
|
||||
|
||||
/**
|
||||
* Default font ID
|
||||
*/
|
||||
|
@ -409,7 +416,6 @@
|
|||
#endif
|
||||
|
||||
/* Keypad behavior **********************************************************/
|
||||
|
||||
/**
|
||||
* Time taken before a key starts repeating (in milliseconds).
|
||||
*/
|
||||
|
|
|
@ -133,23 +133,12 @@ CNxToolbar *CNxTkWindow::openToolbar(nxgl_coord_t height)
|
|||
{
|
||||
if (m_hNxTkWindow && !m_toolbar)
|
||||
{
|
||||
// Get current window style from the widget control
|
||||
|
||||
CWidgetStyle style;
|
||||
m_widgetControl->getWidgetStyle(&style);
|
||||
|
||||
// Create a new controlling widget for the window
|
||||
|
||||
CWidgetControl *widgetControl = new CWidgetControl(&style);
|
||||
|
||||
// And create the toolcar
|
||||
// Create the toolbar. Note that we use the SAME underlying
|
||||
// widget control. That is because the tool bar really resides
|
||||
// in the same "physical" window.
|
||||
|
||||
m_toolbar = new CNxToolbar(this, m_hNxTkWindow,
|
||||
widgetControl, height);
|
||||
if (!m_toolbar)
|
||||
{
|
||||
delete widgetControl;
|
||||
}
|
||||
m_widgetControl, height);
|
||||
}
|
||||
return m_toolbar;
|
||||
}
|
||||
|
|
|
@ -104,10 +104,17 @@ CWidgetControl::CWidgetControl(FAR const CWidgetStyle *style)
|
|||
m_nCh = 0;
|
||||
m_nCc = 0;
|
||||
|
||||
// Enable the semaphore that will wake up the modal loop on mouse or
|
||||
// keypress events
|
||||
// Intialize semaphores:
|
||||
//
|
||||
// m_modalSem. The semaphore that will wake up the modal loop on mouse or
|
||||
// keypress events
|
||||
// m_geoSem. The semaphore that will synchronize window size and position
|
||||
// informatin.
|
||||
|
||||
sem_init(&m_modalsem, 0, 0);
|
||||
sem_init(&m_modalSem, 0, 0);
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
sem_init(&m_geoSem, 0, 0);
|
||||
#endif
|
||||
|
||||
// Do we need to fetch the default style?
|
||||
|
||||
|
@ -197,7 +204,7 @@ void CWidgetControl::waitForModalEvent(void)
|
|||
{
|
||||
// Wait for an interesting event (like a mouse or keyboard event)
|
||||
|
||||
(void)sem_wait(&m_modalsem);
|
||||
(void)sem_wait(&m_modalSem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +216,7 @@ void CWidgetControl::wakeupModalLoop(void)
|
|||
{
|
||||
if (m_modal)
|
||||
{
|
||||
(void)sem_post(&m_modalsem);
|
||||
(void)sem_post(&m_modalSem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +234,7 @@ void CWidgetControl::stopModal(void)
|
|||
|
||||
// Wake up the modal loop so that it can terminate properly
|
||||
|
||||
(void)sem_post(&m_modalsem);
|
||||
(void)sem_post(&m_modalSem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -885,7 +892,7 @@ void CWidgetControl::takeGeoSem(void)
|
|||
int ret;
|
||||
do
|
||||
{
|
||||
ret = sem_wait(&m_geosem);
|
||||
ret = sem_wait(&m_geoSem);
|
||||
}
|
||||
while (ret < 0 && errno == EINTR);
|
||||
}
|
||||
|
|
|
@ -165,6 +165,14 @@ namespace NxWM
|
|||
|
||||
bool redrawTaskbarWindow(void);
|
||||
|
||||
/**
|
||||
* Redraw the window at the top of the heirarchy.
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool redrawTopWindow(void);
|
||||
|
||||
/**
|
||||
* (Re-)draw the background window.
|
||||
*
|
||||
|
@ -177,10 +185,11 @@ namespace NxWM
|
|||
* Redraw the last application in the list of application maintained by
|
||||
* the task bar.
|
||||
*
|
||||
* @param app. The new top application to draw
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool redrawApplicationWindow(void);
|
||||
bool redrawApplicationWindow(IApplication *app);
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
|
|
|
@ -100,13 +100,9 @@
|
|||
* Color configuration
|
||||
*
|
||||
* CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
|
||||
* MKRGB(160,160,160)
|
||||
* MKRGB(148,189,215)
|
||||
* 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)
|
||||
* Default: MKRGB(206,227,241)
|
||||
* 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.
|
||||
|
@ -122,7 +118,7 @@
|
|||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR
|
||||
# define CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR MKRGB(160,160,160)
|
||||
# define CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR MKRGB(148,189,215)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -130,23 +126,7 @@
|
|||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR
|
||||
# define CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(120,192,192)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Default foreground color
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR
|
||||
# define CONFIG_NXWM_DEFAULT_FOREGROUNDCOLOR MKRGB(192,192,192)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Default selected foreground color
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR
|
||||
# define CONFIG_NXWM_DEFAULT_SELECTEDFOREGROUNDCOLOR MKRGB(248,248,248)
|
||||
# define CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(206,227,241)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -168,7 +168,7 @@ bool CApplicationWindow::open(void)
|
|||
// Get the CWidgetControl associated with this window
|
||||
|
||||
NXWidgets::CWidgetControl *control = m_toolbar->getWidgetControl();
|
||||
if (control)
|
||||
if (!control)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -232,9 +232,9 @@ bool CTaskbar::startWindowManager(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Draw the application window
|
||||
// Draw the top application window
|
||||
|
||||
return redrawApplicationWindow();
|
||||
return redrawTopWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -368,27 +368,9 @@ bool CTaskbar::topApplication(IApplication *app)
|
|||
|
||||
if (!app->isMinimized())
|
||||
{
|
||||
// Every application provides a method to obtain its application window
|
||||
// It is not... Make the application the top application and redraw it
|
||||
|
||||
CApplicationWindow *appWindow = app->getWindow();
|
||||
|
||||
// Each application window provides a method to get the underlying NX window
|
||||
|
||||
NXWidgets::CNxTkWindow *window = appWindow->getWindow();
|
||||
|
||||
// Mark the window as the top application
|
||||
|
||||
m_topapp = app;
|
||||
app->setTopApplication(true);
|
||||
|
||||
// Raise the window to the top of the hierarchy
|
||||
|
||||
window->raise();
|
||||
|
||||
// And re-draw it
|
||||
|
||||
app->redraw();
|
||||
return true;
|
||||
return redrawApplicationWindow(app);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -441,7 +423,7 @@ bool CTaskbar::minimizeApplication(IApplication *app)
|
|||
app->setMinimized(true);
|
||||
|
||||
// And it certainly is no longer the top application. If it was before
|
||||
// then redrawApplicationWindow() will pick a new one (rather arbitrarily).
|
||||
// then redrawTopWindow() will pick a new one (rather arbitrarily).
|
||||
|
||||
if (app->isTopApplication())
|
||||
{
|
||||
|
@ -453,9 +435,9 @@ bool CTaskbar::minimizeApplication(IApplication *app)
|
|||
|
||||
window->lower();
|
||||
|
||||
// And re-draw the next non-minimized application
|
||||
// And re-draw the new top, non-minimized application
|
||||
|
||||
return redrawApplicationWindow();
|
||||
return redrawTopWindow();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -708,10 +690,6 @@ bool CTaskbar::createTaskbarWindow(void)
|
|||
|
||||
m_taskbar->setPosition(&pos);
|
||||
m_taskbar->setSize(&size);
|
||||
|
||||
/* And raise the window to the top of the display */
|
||||
|
||||
m_taskbar->raise();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -734,10 +712,6 @@ bool CTaskbar::createBackgroundWindow(void)
|
|||
// Set the geometry to fit in the application window space
|
||||
|
||||
setApplicationGeometry(static_cast<NXWidgets::INxWindow*>(m_background));
|
||||
|
||||
/* The background window starts at the top display */
|
||||
|
||||
m_background->raise();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -932,49 +906,12 @@ bool CTaskbar::redrawTaskbarWindow(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* (Re-)draw the background window.
|
||||
* Redraw the window at the top of the heirarchy.
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool CTaskbar::redrawBackgroundWindow(void)
|
||||
{
|
||||
// Get the widget control from the background window
|
||||
|
||||
NXWidgets::CWidgetControl *control = m_background->getWidgetControl();
|
||||
|
||||
// Get the graphics port for drawing on the background window
|
||||
|
||||
NXWidgets::CGraphicsPort *port = control->getGraphicsPort();
|
||||
|
||||
// Get the size of the window
|
||||
|
||||
struct nxgl_size_s windowSize;
|
||||
if (!m_background->getSize(&windowSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fill the entire window with the background color
|
||||
|
||||
port->drawFilledRect(0, 0, windowSize.w, windowSize.h,
|
||||
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR);
|
||||
|
||||
// Then re-draw the background image on the window
|
||||
|
||||
m_backImage->enableDrawing();
|
||||
m_backImage->redraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraw the last application in the list of application maintained by
|
||||
* the task bar.
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool CTaskbar::redrawApplicationWindow(void)
|
||||
bool CTaskbar::redrawTopWindow(void)
|
||||
{
|
||||
// Check if there is already a top application
|
||||
|
||||
|
@ -998,29 +935,103 @@ bool CTaskbar::redrawApplicationWindow(void)
|
|||
|
||||
if (app)
|
||||
{
|
||||
// Yes.. Then this is the new top application
|
||||
// Yes.. make it the top application window and redraw it
|
||||
|
||||
m_topapp = app;
|
||||
app->setTopApplication(true);
|
||||
|
||||
// Disable drawing of the background image.
|
||||
|
||||
m_backImage->disableDrawing();
|
||||
|
||||
// And.. Draw the application
|
||||
|
||||
app->redraw();
|
||||
return redrawApplicationWindow(app);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, re-draw the background image
|
||||
// Otherwise, there is no top application. Re-draw the background image.
|
||||
|
||||
m_topapp = (IApplication *)0;
|
||||
return redrawBackgroundWindow();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re-)draw the background window.
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool CTaskbar::redrawBackgroundWindow(void)
|
||||
{
|
||||
// Get the widget control from the background window
|
||||
|
||||
NXWidgets::CWidgetControl *control = m_background->getWidgetControl();
|
||||
|
||||
// Get the graphics port for drawing on the background window
|
||||
|
||||
NXWidgets::CGraphicsPort *port = control->getGraphicsPort();
|
||||
|
||||
// Get the size of the window
|
||||
|
||||
struct nxgl_size_s windowSize;
|
||||
if (!m_background->getSize(&windowSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Raise the background window to the top of the display
|
||||
|
||||
m_background->raise();
|
||||
|
||||
// Fill the entire window with the background color
|
||||
|
||||
port->drawFilledRect(0, 0, windowSize.w, windowSize.h,
|
||||
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR);
|
||||
|
||||
// Add a border to the task bar to delineate it from the task bar
|
||||
|
||||
port->drawBevelledRect(0, 0, windowSize.w, windowSize.h,
|
||||
CONFIG_NXWM_DEFAULT_SHINEEDGECOLOR,
|
||||
CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR);
|
||||
|
||||
// Then re-draw the background image on the window
|
||||
|
||||
m_backImage->enableDrawing();
|
||||
m_backImage->redraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraw the last application in the list of application maintained by
|
||||
* the task bar.
|
||||
*
|
||||
* @param app. The new top application to draw
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool CTaskbar::redrawApplicationWindow(IApplication *app)
|
||||
{
|
||||
// Every application provides a method to obtain its application window
|
||||
|
||||
CApplicationWindow *appWindow = app->getWindow();
|
||||
|
||||
// Each application window provides a method to get the underlying NX window
|
||||
|
||||
NXWidgets::CNxTkWindow *window = appWindow->getWindow();
|
||||
|
||||
// Mark the window as the top application
|
||||
|
||||
m_topapp = app;
|
||||
app->setTopApplication(true);
|
||||
|
||||
// Disable drawing of the background image.
|
||||
|
||||
m_backImage->disableDrawing();
|
||||
|
||||
// Raise the window to the top of the hierarchy
|
||||
|
||||
window->raise();
|
||||
|
||||
// And re-draw it
|
||||
|
||||
app->redraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a mouse button click event.
|
||||
*
|
||||
|
|
|
@ -547,8 +547,14 @@ CONFIG_NX_MXCLIENTMSGS=16
|
|||
#
|
||||
# NxWidgets
|
||||
#
|
||||
# Use all defaults except
|
||||
# 1. Need an especially big server stack size to work with X
|
||||
# 2. Make the NxWidgets background color match the NxWM back color
|
||||
#
|
||||
CONFIG_NXWIDGETS_SERVERSTACK=16384
|
||||
CONFIG_NXWIDGETS_LISTENERSTACK=8192
|
||||
CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215)
|
||||
CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241)
|
||||
|
||||
#
|
||||
# NxConsole Configuration Settings:
|
||||
|
|
Loading…
Reference in New Issue