From be05281b7a9a6d0757b8be67eeb5a5cf314968ae Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 11 Jul 2011 13:30:47 +0000 Subject: Correct an NX error that would leave stuff on the display when a window is closed git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3769 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/nxtext/nxtext_bkgd.c | 55 ++++++++++++++++------------------ apps/examples/nxtext/nxtext_internal.h | 1 - apps/examples/nxtext/nxtext_popup.c | 15 ---------- 3 files changed, 26 insertions(+), 45 deletions(-) (limited to 'apps/examples/nxtext') diff --git a/apps/examples/nxtext/nxtext_bkgd.c b/apps/examples/nxtext/nxtext_bkgd.c index d75dfae04..d94f19dc1 100644 --- a/apps/examples/nxtext/nxtext_bkgd.c +++ b/apps/examples/nxtext/nxtext_bkgd.c @@ -115,6 +115,31 @@ NXHANDLE g_bgwnd; * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: nxbg_redrawrect + ****************************************************************************/ + +static void nxbg_redrawrect(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect) +{ + int ret; + int i; + + ret = nx_fill(hwnd, rect, g_bgstate.wcolor); + if (ret < 0) + { + message("nxbg_redrawrect: nx_fill failed: %d\n", errno); + } + + /* Fill each character on the display (Only the characters within rect + * will actually be redrawn). + */ + + for (i = 0; i < g_bgstate.nchars; i++) + { + nxtext_fillchar(hwnd, rect, &g_bgstate, &g_bgstate.bm[i]); + } +} + /**************************************************************************** * Name: nxbg_redraw ****************************************************************************/ @@ -290,7 +315,7 @@ static inline void nxbg_movedisplay(NXWINDOW hwnd, int bottom, int lineheight) ret = nx_move(hwnd, &rect, &offset); if (ret < 0) { - message("nxbg_redrawrect: nx_move failed: %d\n", errno); + message("nxbg_movedisplay: nx_move failed: %d\n", errno); } } #endif @@ -440,31 +465,3 @@ void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen) nxtext_putc(hwnd, &g_bgstate, (uint8_t)*buffer++); } } - -/**************************************************************************** - * Name: nxbg_redrawrect - ****************************************************************************/ - -void nxbg_redrawrect(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect) -{ - int ret; - int i; - - ret = nx_fill(hwnd, rect, g_bgstate.wcolor); - if (ret < 0) - { - message("nxbg_redrawrect: nx_fill failed: %d\n", errno); - } - - /* Fill each character on the display (Only the characters within rect - * will actually be redrawn). - */ - - for (i = 0; i < g_bgstate.nchars; i++) - { - nxtext_fillchar(hwnd, rect, &g_bgstate, &g_bgstate.bm[i]); - } -} - - - diff --git a/apps/examples/nxtext/nxtext_internal.h b/apps/examples/nxtext/nxtext_internal.h index 3bcbb1aa1..b9c2b8d64 100644 --- a/apps/examples/nxtext/nxtext_internal.h +++ b/apps/examples/nxtext/nxtext_internal.h @@ -295,7 +295,6 @@ extern FAR void *nxtext_listener(FAR void *arg); extern FAR struct nxtext_state_s *nxbg_getstate(void); extern void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen); -extern void nxbg_redrawrect(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect); /* Pop-up window interfaces */ diff --git a/apps/examples/nxtext/nxtext_popup.c b/apps/examples/nxtext/nxtext_popup.c index 6397961f7..33170019f 100644 --- a/apps/examples/nxtext/nxtext_popup.c +++ b/apps/examples/nxtext/nxtext_popup.c @@ -395,7 +395,6 @@ errout_with_state: int nxpu_close(NXWINDOW hwnd) { - struct nxgl_rect_s rect; int ret; ret = nx_closewindow(hwnd); @@ -405,19 +404,5 @@ int nxpu_close(NXWINDOW hwnd) g_exitcode = NXEXIT_NXCLOSEWINDOW; return ret; } - - /* NOTE: The following should not be necessary. This is - * a temporary workaround for a bug in the TODO list: - * "When a window is closed, the display is not updated." - */ - - rect.pt1.x = g_pustate.wpos.x; - rect.pt1.y = g_pustate.wpos.y; - rect.pt2.x = g_pustate.wpos.x + g_pustate.wsize.w - 1; - rect.pt2.y = g_pustate.wpos.y + g_pustate.wsize.h - 1; - gvdbg("pt1(%d,%d) pt2(%d,%d)\n", - rect.pt1.x, rect.pt1.y, rect.pt2.x, rect.pt2.y); - - nxbg_redrawrect(g_bgwnd, &rect); return OK; } -- cgit v1.2.3