From 7fb45f7b0753769e803bf5de5b2df638b41d07d6 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 3 May 2012 22:31:48 +0000 Subject: Fix an NxWidgets bug; Update NxWM (it kind of works now) git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4693 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/nxwm/src/cnxconsole.cxx | 39 ++++++++++++++++++++++------------- NxWidgets/nxwm/src/glyph_minimize.cxx | 8 +++---- NxWidgets/nxwm/src/glyph_stop.cxx | 8 +++---- 3 files changed, 33 insertions(+), 22 deletions(-) (limited to 'NxWidgets/nxwm') diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx index fb6ca680a..de44ab7f0 100644 --- a/NxWidgets/nxwm/src/cnxconsole.cxx +++ b/NxWidgets/nxwm/src/cnxconsole.cxx @@ -73,11 +73,12 @@ namespace NxWM 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 */ + sem_t sem; /**< Sem that posted when the task is initialized */ + NXTKWINDOW hwnd; /**< Window handle */ + NXCONSOLE nxcon; /**< NxConsole handle */ + int minor; /**< Next device minor number */ + struct nxcon_window_s wndo; /**< Describes the NxConsole window */ + bool result; /**< True if successfully initialized */ }; /******************************************************************************************** @@ -211,6 +212,16 @@ bool CNxConsole::run(void) g_nxconvars.hwnd = control->getWindowHandle(); + // Describe the NxConsole + + g_nxconvars.wndo.wcolor[0] = CONFIG_NXWM_NXCONSOLE_WCOLOR; + g_nxconvars.wndo.fcolor[0] = CONFIG_NXWM_NXCONSOLE_FONTCOLOR; + g_nxconvars.wndo.fontid = CONFIG_NXWM_NXCONSOLE_FONTID; + + // Get the size of the window + + (void)window->getSize(&g_nxconvars.wndo.wsize); + // Start the NxConsole task g_nxconvars.result = false; @@ -235,6 +246,8 @@ bool CNxConsole::run(void) abstime.tv_sec += 2; int ret = sem_timedwait(&g_nxconvars.sem, &abstime); + sched_unlock(); + if (ret == OK && g_nxconvars.result) { // Save the handle to use in the stop method @@ -320,20 +333,15 @@ void CNxConsole::redraw(void) 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' + // 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); + g_nxconvars.nxcon = nxtk_register(g_nxconvars.hwnd, &g_nxconvars.wndo, + g_nxconvars.minor); if (!g_nxconvars.nxcon) { goto errout; @@ -370,6 +378,9 @@ int CNxConsole::nxconsole(int argc, char *argv[]) (void)std::dup2(fd, 1); (void)std::dup2(fd, 2); + (void)std::fdopen(1, "w"); + (void)std::fdopen(2, "w"); + // And we can close our original driver file descriptor std::close(fd); diff --git a/NxWidgets/nxwm/src/glyph_minimize.cxx b/NxWidgets/nxwm/src/glyph_minimize.cxx index 350f188f9..1029ec0b3 100644 --- a/NxWidgets/nxwm/src/glyph_minimize.cxx +++ b/NxWidgets/nxwm/src/glyph_minimize.cxx @@ -72,7 +72,7 @@ using namespace NxWM; static const uint32_t g_minimizeLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 9 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 9 */ 0x2449b6, 0x24496d, 0x244992, 0x242492, 0x496ddb, 0x0024db, 0x0024b6, 0x002492, /* Codes 1-8 */ 0x0000b6, 0x2424b6, 0x0024ff, 0x0000db, 0x4949db, 0x496db6, 0x246db6, 0x4949b6, /* Codes 9-17 */ 0x2449db, 0xb6dbff, 0xb6b6db, 0xdbdbff, 0xdbffff, 0x496dff, 0x246dff, 0x4949ff /* Codes 17-24 */ @@ -84,7 +84,7 @@ static const uint32_t g_minimizeLut[BITMAP_NLUTCODES] = static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 0 */ 0x2256, 0x224d, 0x2252, 0x2132, 0x4b7b, 0x013b, 0x0136, 0x0132, 0x0016, 0x2136, /* Codes 1-10 */ 0x013f, 0x001b, 0x4a5b, 0x4b76, 0x2376, 0x4a56, 0x225b, 0xb6df, 0xb5bb, 0xdedf, /* Codes 11-20 */ 0xdfff, 0x4b7f, 0x237f, 0x4a5f /* Codes 21-24 */ @@ -104,7 +104,7 @@ static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] = static const uint8_t g_minimizeLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 0 */ 0x4a, 0x42, 0x46, 0x30, 0x6e, 0x2e, 0x29, 0x25, 0x14, 0x34, 0x32, 0x18, 0x59, /* Codes 1-13 */ 0x6a, 0x5f, 0x55, 0x4e, 0xd4, 0xba, 0xdf, 0xf4, 0x72, 0x67, 0x5d /* Codes 14-24 */ }; @@ -115,7 +115,7 @@ static const uint8_t g_minimizeLut[BITMAP_NLUTCODES] = static const nxgl_mxpixel_t g_minimizeLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 0 */ 0x2a, 0x29, 0x2a, 0x26, 0x4f, 0x07, 0x06, 0x06, 0x02, 0x26, 0x07, 0x03, 0x4b, /* Codes 1-13 */ 0x4e, 0x2e, 0x4a, 0x2b, 0xbb, 0xb7, 0xdb, 0xdf, 0x4f, 0x2f, 0x4b /* Codes 14-24 */ }; diff --git a/NxWidgets/nxwm/src/glyph_stop.cxx b/NxWidgets/nxwm/src/glyph_stop.cxx index bd11d88e8..828e5266c 100644 --- a/NxWidgets/nxwm/src/glyph_stop.cxx +++ b/NxWidgets/nxwm/src/glyph_stop.cxx @@ -72,7 +72,7 @@ using namespace NxWM; static const uint32_t g_stopLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 0 */ 0xdbdbdb, 0xdbb6db, 0xdbb6b6, 0xdb9292, 0xdb926d, 0xdb6d6d, 0xb66d6d, 0xb64949, /* Codes 1-8 */ 0xb62449, 0xdb246d, 0xdb4949, 0xff496d, 0xffb6b6, 0xffdbff, 0xffdbdb, 0xff9292, /* Codes 9-16 */ 0xff6d6d, 0xdb6d49, 0xff2449, 0xff246d, 0xdb2449, 0xdbdbb6, 0xff4949, 0xff2424, /* Codes 17-24 */ @@ -90,7 +90,7 @@ static const uint32_t g_stopLut[BITMAP_NLUTCODES] = static const uint16_t g_stopLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 0 */ 0xdedb, 0xddbb, 0xddb6, 0xdc92, 0xdc8d, 0xdb6d, 0xb36d, 0xb249, 0xb129, 0xd92d, /* Codes 1-10 */ 0xda49, 0xfa4d, 0xfdb6, 0xfedf, 0xfedb, 0xfc92, 0xfb6d, 0xdb69, 0xf929, 0xf92d, /* Codes 11-20 */ 0xd929, 0xded6, 0xfa49, 0xf924, 0xfffb, 0xddb2, 0xd924, 0xfa44, 0xfdbb, 0xfed6, /* Codes 21-30 */ @@ -114,7 +114,7 @@ static const uint16_t g_stopLut[BITMAP_NLUTCODES] = static const uint8_t g_stopLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 0 */ 0xdb, 0xc5, 0xc1, 0xa7, 0xa3, 0x8d, 0x82, 0x69, 0x53, 0x63, 0x74, 0x83, 0xcb, /* Codes 1-13 */ 0xe9, 0xe5, 0xb2, 0x98, 0x89, 0x69, 0x6d, 0x5e, 0xd6, 0x7f, 0x65, 0xfa, 0xbc, /* Codes 14-26 */ 0x5a, 0x7b, 0xd0, 0xe1, 0x94, 0xc7, 0x70, 0x65, 0xd2, 0x9c, 0x4f, 0x78, 0x98, /* Codes 27-39 */ @@ -129,7 +129,7 @@ static const uint8_t g_stopLut[BITMAP_NLUTCODES] = static const nxgl_mxpixel_t g_stopLut[BITMAP_NLUTCODES] = { - CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + CONFIG_NXTK_BORDERCOLOR1, /* Code 0 */ 0xdb, 0xd7, 0xd6, 0xd2, 0xd1, 0xcd, 0xad, 0xa9, 0xa5, 0xc5, 0xc9, 0xe9, 0xf6, /* Codes 1-13 */ 0xfb, 0xfb, 0xf2, 0xed, 0xcd, 0xe5, 0xe5, 0xc5, 0xda, 0xe9, 0xe4, 0xff, 0xd6, /* Codes 14-26 */ 0xc4, 0xe8, 0xf7, 0xfa, 0xed, 0xf6, 0xc8, 0xa8, 0xda, 0xb2, 0xa4, 0xc9, 0xb1, /* Codes 27-39 */ -- cgit v1.2.3