summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-02 14:38:54 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-02 14:38:54 +0000
commitaddae64d8c028ffd2c3bb05ec7ebdd1a73720998 (patch)
tree1b921ee8364e6156ee58ee1b85b34a91a69aa435 /NxWidgets/libnxwidgets
parent1c9fc6cb19e21749c86389b13196075b97deab73 (diff)
downloadnuttx-addae64d8c028ffd2c3bb05ec7ebdd1a73720998.tar.gz
nuttx-addae64d8c028ffd2c3bb05ec7ebdd1a73720998.tar.bz2
nuttx-addae64d8c028ffd2c3bb05ec7ebdd1a73720998.zip
NxWM initial displays come up okay
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4687 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets')
-rw-r--r--NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx6
-rw-r--r--NxWidgets/libnxwidgets/include/nxconfig.hxx166
-rw-r--r--NxWidgets/libnxwidgets/src/cnxtkwindow.cxx19
-rw-r--r--NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx23
4 files changed, 108 insertions, 106 deletions
diff --git a/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx b/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
index 0a894eae8..7725dec2c 100644
--- a/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
+++ b/NxWidgets/libnxwidgets/include/cwidgetcontrol.hxx
@@ -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
}
diff --git a/NxWidgets/libnxwidgets/include/nxconfig.hxx b/NxWidgets/libnxwidgets/include/nxconfig.hxx
index 1c7b6a3f0..5d3752fd0 100644
--- a/NxWidgets/libnxwidgets/include/nxconfig.hxx
+++ b/NxWidgets/libnxwidgets/include/nxconfig.hxx
@@ -53,6 +53,90 @@
****************************************************************************/
/* NX 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
+ * 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. This applies
+ * only if NX is configured in multi-user mode (CONFIG_NX_MULTIUSER=y).
+ * Default: SCHED_PRIORITY_DEFAULT+1. NOTE: Of the three priority
+ * definitions here, CONFIG_NXWIDGETS_SERVERPRIO should have the highest
+ * priority to avoid data overrun race conditions. Such errors would most
+ * likely appear as duplicated rows of data on the display.
+ * CONFIG_NXWIDGETS_CLIENTPRIO - The thread that calls CNxServer::connect()
+ * will be re-prioritized to this priority. This applies only if NX is
+ * configured in multi-user mode (CONFIG_NX_MULTIUSER=y). Default:
+ * SCHED_PRIORITY_DEFAULT
+ * CONFIG_NXWIDGETS_LISTENERPRIO - Priority of the NX event listener thread.
+ * This applies only if NX is configured in multi-user mode
+ * (CONFIG_NX_MULTIUSER=y). Default: SCHED_PRIORITY_DEFAULT
+ * 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
+ *
+ * CONFIG_NXWIDGETS_BPP - Supported bits-per-pixel {8, 16, 24, 32}. Default:
+ * The smallest BPP configuration supported by NX.
+ * CONFIG_NXWIDGETS_SIZEOFCHAR - Size of character {1 or 2 bytes}. Default
+ * Determined by CONFIG_NXWIDGETS_SIZEOFCHAR
+ *
+ * NXWidget Default Values
+ *
+ * CONFIG_NXWIDGETS_DEFAULT_FONTID - Default font ID. Default: NXFONT_DEFAULT
+ * CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE, CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT -
+ * Default dynamic array parameters. Default: 16, 8
+ *
+ * CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
+ * MKRGB(160,160,160)
+ * CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR - Default selected background
+ * color. Default: MKRGB(120,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR - Shiny side boarder color. Default
+ * MKRGB(248,248,248)
+ * CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR - Shadowed side border color.
+ * Default: MKRGB(0,0,0)
+ * CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR - Highlight color. Default:
+ * MKRGB(192,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a disabled widget:
+ * Default: MKRGB(192,192,192)
+ * CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR - Text color on a enabled widget:
+ * Default: MKRGB(248,248,248)
+ * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a selected widget:
+ * Default: MKRGB(0,0,0)
+ * CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR - Default font color: Default:
+ * MKRGB(255,255,255)
+ * CONFIG_NXWIDGETS_TRANSPARENT_COLOR - Transparent color: Default: MKRGB(0,0,0)
+ *
+ * Keypad behavior
+ *
+ * CONFIG_NXWIDGETS_FIRST_REPEAT_TIME - Time taken before a key starts
+ * repeating (in milliseconds). Default: 500
+ * CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME - Time taken before a repeating key
+ * repeats again (in milliseconds). Default: 200
+ * CONFIG_NXWIDGETS_DOUBLECLICK_TIME - Left button release-press time for
+ * double click (in milliseconds). Default: 350
+ * CONFIG_NXWIDGETS_KBDBUFFER_SIZE - Size of incoming character buffer, i.e.,
+ * the maximum number of characters that can be entered between NX polling
+ * cycles without losing data.
+ * CONFIG_NXWIDGETS_CURSORCONTROL_SIZE - Size of incoming cursor control
+ * buffer, i.e., the maximum number of cursor controls that can between
+ * entered by NX polling cycles without losing data. Default: 4
+ */
+
+/* Prerequisites ************************************************************/
+/**
* C++ support is required
*/
@@ -61,7 +145,7 @@
#endif
/**
- * Required to enabled NX graphics support
+ * NX graphics support must be enabled
*/
#ifndef CONFIG_NX
@@ -69,7 +153,7 @@
#endif
/**
- * Required to enabled NX mouse/touchscreen support
+ * Required to enable NX mouse/touchscreen support
*/
#ifndef CONFIG_NX_MOUSE
@@ -97,7 +181,6 @@
#endif
/* NX Server/Device Configuration *******************************************/
-
/**
* LCD device number (in case there are more than one LCDs connected)
*/
@@ -162,81 +245,6 @@
/* NXWidget 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. This applies
- * only if NX is configured in multi-user mode (CONFIG_NX_MULTIUSER=y).
- * Default: SCHED_PRIORITY_DEFAULT+1. NOTE: Of the three priority
- * definitions here, CONFIG_NXWIDGETS_SERVERPRIO should have the highest
- * priority to avoid data overrun race conditions. Such errors would most
- * likely appear as duplicated rows of data on the display.
- * CONFIG_NXWIDGETS_CLIENTPRIO - The thread that calls CNxServer::connect()
- * will be re-prioritized to this priority. This applies only if NX is
- * configured in multi-user mode (CONFIG_NX_MULTIUSER=y). Default:
- * SCHED_PRIORITY_DEFAULT
- * CONFIG_NXWIDGETS_LISTENERPRIO - Priority of the NX event listener thread.
- * This applies only if NX is configured in multi-user mode
- * (CONFIG_NX_MULTIUSER=y). Default: SCHED_PRIORITY_DEFAULT
- * 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
- *
- * CONFIG_NXWIDGETS_BPP - Supported bits-per-pixel {8, 16, 24, 32}. Default:
- * The smallest BPP configuration supported by NX.
- * CONFIG_NXWIDGETS_SIZEOFCHAR - Size of character {1 or 2 bytes}. Default
- * Determined by CONFIG_NXWIDGETS_SIZEOFCHAR
- *
- * NXWidget Default Values
- *
- * CONFIG_NXWIDGETS_DEFAULT_FONTID - Default font ID. Default: NXFONT_DEFAULT
- * CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE, CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT -
- * Default dynamic array parameters. Default: 16, 8
- *
- * CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
- * MKRGB(160,160,160)
- * CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR - Default selected background
- * color. Default: MKRGB(120,192,192)
- * CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR - Shiny side boarder color. Default
- * MKRGB(248,248,248)
- * CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR - Shadowed side border color.
- * Default: MKRGB(0,0,0)
- * CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR - Highlight color. Default:
- * MKRGB(192,192,192)
- * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a disabled widget:
- * Default: MKRGB(192,192,192)
- * CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR - Text color on a enabled widget:
- * Default: MKRGB(248,248,248)
- * CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - Text color on a selected widget:
- * Default: MKRGB(0,0,0)
- * CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR - Default font color: Default:
- * MKRGB(255,255,255)
- * CONFIG_NXWIDGETS_TRANSPARENT_COLOR - Transparent color: Default: MKRGB(0,0,0)
- *
- * Keypad behavior
- *
- * CONFIG_NXWIDGETS_FIRST_REPEAT_TIME - Time taken before a key starts
- * repeating (in milliseconds). Default: 500
- * CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME - Time taken before a repeating key
- * repeats again (in milliseconds). Default: 200
- * CONFIG_NXWIDGETS_DOUBLECLICK_TIME - Left button release-press time for
- * double click (in milliseconds). Default: 350
- * CONFIG_NXWIDGETS_KBDBUFFER_SIZE - Size of incoming character buffer, i.e.,
- * the maximum number of characters that can be entered between NX polling
- * cycles without losing data.
- * CONFIG_NXWIDGETS_CURSORCONTROL_SIZE - Size of incoming cursor control
- * buffer, i.e., the maximum number of cursor controls that can between
- * entered by NX polling cycles without losing data. Default: 4
- */
-
-/**
* 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).
*/
diff --git a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
index ba62ee435..bae9cb815 100644
--- a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
@@ -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;
}
diff --git a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
index a6807dad5..1e1c9ce87 100644
--- a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
+++ b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
@@ -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
-
- sem_init(&m_modalsem, 0, 0);
+ // 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);
+#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);
}