graphics/twm4nx/Kconfig: Add configuration disable keyboard/mouse input for testing purposes.
graphics/twm4nx/src/ciconmgr.cxx: Correct initial window size and position in the upper righthand corner; Need to fill draw the button array immediately on window creation. graphics/twm4nx/src/cwindow.cxx: Need to fill the toolbar initially with the widget background color.
This commit is contained in:
parent
e50bbaac3a
commit
b5ae79b8f3
@ -61,6 +61,34 @@ config TWM4NX_NETINIT
|
||||
---help---
|
||||
This option enables/disables all network initialization in Twm4Nx.
|
||||
|
||||
config TWM4NX_VNCSERVER
|
||||
bool "Use VNC Server"
|
||||
default y
|
||||
depends on VNCSERVER
|
||||
select TWM4NX_NOKEYBOARD
|
||||
select TWM4NX_NOMOUSE
|
||||
---help---
|
||||
If selected, then keyboard and positional input will come from the
|
||||
VNC server. In this case all other input settings are ignored.
|
||||
|
||||
config TWM4NX_NOKEYBOARD
|
||||
bool "Disable keyboard"
|
||||
default n
|
||||
---help---
|
||||
Normally you would never disable keyboard input. That would make
|
||||
using many Twm4Nx applications impossible. However, this setting
|
||||
is sometimes useful for debugging Twm4Nx bringup in a simpler
|
||||
environment (it is also used if VNC is selected)
|
||||
|
||||
config TWM4NX_NOMOUSE
|
||||
bool "Disable mouse"
|
||||
default n
|
||||
---help---
|
||||
Normally you would never disable mouse input. That would make using
|
||||
Twm4Nx impossible. However, this setting is sometimes useful for
|
||||
debugging Twm4Nx bringup in a simpler environment (it is also used
|
||||
if VNC is selected)
|
||||
|
||||
config TWM4NX_DEBUG
|
||||
bool "Force debug output"
|
||||
default n
|
||||
|
@ -517,7 +517,6 @@ bool CIconMgr::createWindow(FAR const char *prefix)
|
||||
// Create the icon manager window
|
||||
|
||||
CWindowFactory *factory = m_twm4nx->getWindowFactory();
|
||||
bool success = true;
|
||||
|
||||
m_window = factory->createWindow(name, &CONFIG_TWM4NX_ICONMGR_IMAGE,
|
||||
true, this, false);
|
||||
@ -525,7 +524,7 @@ bool CIconMgr::createWindow(FAR const char *prefix)
|
||||
if (m_window == (FAR CWindow *)0)
|
||||
{
|
||||
twmerr("ERROR: Failed to create icon manager window");
|
||||
success = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Free any temporary name strings
|
||||
@ -535,7 +534,53 @@ bool CIconMgr::createWindow(FAR const char *prefix)
|
||||
std::free(allocName);
|
||||
}
|
||||
|
||||
return success;
|
||||
// Adjust the height of the window (and probably the width too?)
|
||||
// The height of one row is determined (mostly) by the font height
|
||||
|
||||
struct nxgl_size_s windowSize;
|
||||
if (!m_window->getWindowSize(&windowSize))
|
||||
{
|
||||
twmerr("ERROR: Failed to get window size\n");
|
||||
delete m_window;
|
||||
m_window = (FAR CWindow *)0;
|
||||
return false;
|
||||
}
|
||||
|
||||
windowSize.h = getRowHeight();
|
||||
|
||||
// Set the new window size
|
||||
|
||||
if (!m_window->setWindowSize(&windowSize))
|
||||
{
|
||||
twmerr("ERROR: Failed to set window size\n");
|
||||
delete m_window;
|
||||
m_window = (FAR CWindow *)0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the frame size (includes border and toolbar)
|
||||
|
||||
struct nxgl_size_s frameSize;
|
||||
m_window->windowToFrameSize(&windowSize, &frameSize);
|
||||
|
||||
// Position the icon manager at the upper right initially
|
||||
|
||||
struct nxgl_size_s displaySize;
|
||||
m_twm4nx->getDisplaySize(&displaySize);
|
||||
|
||||
struct nxgl_point_s framePos;
|
||||
framePos.x = displaySize.w - frameSize.w - 1;
|
||||
framePos.y = 0;
|
||||
|
||||
if (!m_window->setFramePosition(&framePos))
|
||||
{
|
||||
twmerr("ERROR: Failed to set window position\n");
|
||||
delete m_window;
|
||||
m_window = (FAR CWindow *)0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -553,11 +598,6 @@ bool CIconMgr::createButtonArray(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
// The button must be positioned at the upper left of the window
|
||||
|
||||
struct nxgl_point_s arrayPos;
|
||||
m_window->getWindowPosition(&arrayPos);
|
||||
|
||||
// Create the button array
|
||||
// REVISIT: Hmm.. Button array cannot be dynamically resized!
|
||||
|
||||
@ -578,9 +618,9 @@ bool CIconMgr::createButtonArray(void)
|
||||
}
|
||||
|
||||
// Now we have enough information to create the button array
|
||||
// The button must be positioned at the upper left of the window
|
||||
|
||||
m_buttons = new NXWidgets::CButtonArray(control,
|
||||
arrayPos.x, arrayPos.y,
|
||||
m_buttons = new NXWidgets::CButtonArray(control, 0, 0,
|
||||
m_maxColumns, nrows,
|
||||
buttonWidth, buttonHeight);
|
||||
if (m_buttons == (FAR NXWidgets::CButtonArray *)0)
|
||||
@ -596,8 +636,12 @@ bool CIconMgr::createButtonArray(void)
|
||||
|
||||
m_buttons->setFont(iconManagerFont);
|
||||
m_buttons->setBorderless(true);
|
||||
m_buttons->disableDrawing();
|
||||
m_buttons->setRaisesEvents(false);
|
||||
m_buttons->setRaisesEvents(true);
|
||||
|
||||
// Draw the button array
|
||||
|
||||
m_buttons->enableDrawing();
|
||||
m_buttons->redraw();
|
||||
|
||||
// Register to get events from the mouse clicks on the image
|
||||
|
||||
|
@ -129,7 +129,7 @@ CTwm4Nx::CTwm4Nx(int display)
|
||||
m_fonts = (FAR CFonts *)0;
|
||||
m_resize = (FAR CResize *)0;
|
||||
|
||||
#ifndef CONFIG_VNCSERVER
|
||||
#if !defined(CONFIG_TWM4NX_NOKEYBOARD) && !defined(CONFIG_TWM4NX_NOMOUSE)
|
||||
m_input = (FAR CInput *)0;
|
||||
#endif
|
||||
}
|
||||
@ -221,7 +221,7 @@ bool CTwm4Nx::run(void)
|
||||
m_maxWindow.w = INT16_MAX - m_displaySize.w;
|
||||
m_maxWindow.h = INT16_MAX - m_displaySize.w;
|
||||
|
||||
#ifndef CONFIG_VNCSERVER
|
||||
#if !defined(CONFIG_TWM4NX_NOKEYBOARD) && !defined(CONFIG_TWM4NX_NOMOUSE)
|
||||
// Create the keyboard/mouse input device thread
|
||||
|
||||
m_input = new CInput(this);
|
||||
@ -519,7 +519,7 @@ void CTwm4Nx::cleanup()
|
||||
m_background = (FAR CBackground *)0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_VNCSERVER
|
||||
#if !defined(CONFIG_TWM4NX_NOKEYBOARD) && !defined(CONFIG_TWM4NX_NOMOUSE)
|
||||
// Halt the keyboard/mouse listener and destroy the CInput class
|
||||
|
||||
if (m_input != (CInput *)0)
|
||||
|
@ -711,7 +711,36 @@ bool CWindow::createToolbar(void)
|
||||
|
||||
// 4. Open and initialize the tool bar
|
||||
|
||||
return m_toolbar->open();
|
||||
if (!m_toolbar->open())
|
||||
{
|
||||
delete m_toolbar;
|
||||
m_toolbar = (FAR NXWidgets::CNxToolbar *)0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 5. Fill the entire tool bar with the background color from the
|
||||
// current widget system.
|
||||
|
||||
// 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_toolbar->getSize(&windowSize))
|
||||
{
|
||||
delete m_toolbar;
|
||||
m_toolbar = (FAR NXWidgets::CNxToolbar *)0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the background color of the current widget system.
|
||||
// REVISIT: No widgets yet, using the default widget background color
|
||||
|
||||
port->drawFilledRect(0, 0, windowSize.w, windowSize.h,
|
||||
CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ namespace Twm4Nx
|
||||
FAR CFonts *m_fonts; /**< The cached Cfonts instance */
|
||||
FAR CResize *m_resize; /**< The cached CResize instance */
|
||||
|
||||
#ifndef CONFIG_VNCSERVER
|
||||
#if !defined(CONFIG_TWM4NX_NOKEYBOARD) && !defined(CONFIG_TWM4NX_NOMOUSE)
|
||||
FAR CInput *m_input; /**< Keyboard/mouse input injector */
|
||||
#endif
|
||||
/* Display properties */
|
||||
|
@ -393,8 +393,9 @@
|
||||
/**
|
||||
* Configuration settings
|
||||
*
|
||||
* CONFIG_VNCSERVER - If selected, then keyboard and positional input will
|
||||
* come from the VNC server. In this case all input settings are ignored.
|
||||
* CONFIG_TWM4NX_VNCSERVER - If selected, then keyboard and positional input
|
||||
* will come from the VNC server. In this case all other input settings
|
||||
* are ignored.
|
||||
*
|
||||
* Common input device settings
|
||||
*
|
||||
@ -423,6 +424,7 @@
|
||||
/**
|
||||
* Mouse device settings
|
||||
*
|
||||
* CONFIG_TWM4NX_NOMOUSE - Can be used to disable mouse input.
|
||||
* CONFIG_TWM4NX_MOUSE_DEVPATH - The full path to the mouse device.
|
||||
* Default: "/dev/console"
|
||||
* CONFIG_TWM4NX_MOUSE_USBHOST - Indicates the the mouse is attached via
|
||||
@ -444,6 +446,7 @@
|
||||
/**
|
||||
* Keyboard device settings
|
||||
*
|
||||
* CONFIG_TWM4NX_NOKEYBOARD - Can be used to disable keyboard input.
|
||||
* CONFIG_TWM4NX_KEYBOARD_DEVPATH - The full path to the keyboard device.
|
||||
* Default: "/dev/console"
|
||||
* CONFIG_TWM4NX_KEYBOARD_USBHOST - Indicates the the keyboard is attached via
|
||||
|
Loading…
Reference in New Issue
Block a user