libs/libnx/nxtk: Add logic to re-draw the frame when the toolbar is added or removed.

This commit is contained in:
Gregory Nutt 2019-03-18 12:12:33 -06:00
parent a51b52ffac
commit 5fda638cf0
5 changed files with 47 additions and 12 deletions

View File

@ -8,6 +8,7 @@
# CONFIG_EXAMPLES_PWFB_DEFAULT_COLORS is not set # CONFIG_EXAMPLES_PWFB_DEFAULT_COLORS is not set
# CONFIG_EXAMPLES_PWFB_DEFAULT_FONT is not set # CONFIG_EXAMPLES_PWFB_DEFAULT_FONT is not set
# CONFIG_NXFONTS_DISABLE_16BPP is not set # CONFIG_NXFONTS_DISABLE_16BPP is not set
# CONFIG_NXTK_DEFAULT_BORDERCOLORS is not set
# CONFIG_NX_DISABLE_16BPP is not set # CONFIG_NX_DISABLE_16BPP is not set
CONFIG_ARCH="arm" CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="open1788" CONFIG_ARCH_BOARD="open1788"
@ -26,7 +27,7 @@ CONFIG_EXAMPLES_PWFB_COLOR2=0xdefb
CONFIG_EXAMPLES_PWFB_COLOR3=0xff76 CONFIG_EXAMPLES_PWFB_COLOR3=0xff76
CONFIG_EXAMPLES_PWFB_FONTCOLOR=0x0000 CONFIG_EXAMPLES_PWFB_FONTCOLOR=0x0000
CONFIG_EXAMPLES_PWFB_FONTID=1 CONFIG_EXAMPLES_PWFB_FONTID=1
CONFIG_EXPERIMENTAL=y CONFIG_EXAMPLES_PWFB_TBCOLOR=0xad55
CONFIG_INTELHEX_BINARY=y CONFIG_INTELHEX_BINARY=y
CONFIG_LPC17_EXTDRAM=y CONFIG_LPC17_EXTDRAM=y
CONFIG_LPC17_EXTDRAMHEAP_OFFSET=393216 CONFIG_LPC17_EXTDRAMHEAP_OFFSET=393216
@ -47,6 +48,9 @@ CONFIG_NSH_LIBRARY=y
CONFIG_NSH_READLINE=y CONFIG_NSH_READLINE=y
CONFIG_NX=y CONFIG_NX=y
CONFIG_NXFONT_SANS23X27=y CONFIG_NXFONT_SANS23X27=y
CONFIG_NXTK_BORDERCOLOR1=0xad55
CONFIG_NXTK_BORDERCOLOR2=0x6b4d
CONFIG_NXTK_BORDERCOLOR3=0xdedb
CONFIG_NX_BLOCKING=y CONFIG_NX_BLOCKING=y
CONFIG_PREALLOC_TIMERS=4 CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_WDOGS=4

View File

@ -45,7 +45,6 @@ config NX_NPLANES
config NX_RAMBACKED config NX_RAMBACKED
bool "RAM backed windows" bool "RAM backed windows"
default n default n
depends on EXPERIMENTAL
---help--- ---help---
If this option is selected, then windows may be optionally created If this option is selected, then windows may be optionally created
with a RAM frambuffer backing up the window content. Rending into with a RAM frambuffer backing up the window content. Rending into

View File

@ -68,7 +68,8 @@
int nxtk_closetoolbar(NXTKWINDOW hfwnd) int nxtk_closetoolbar(NXTKWINDOW hfwnd)
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; FAR struct nxtk_framedwindow_s *fwnd =
(FAR struct nxtk_framedwindow_s *)hfwnd;
/* Un-initialize the toolbar info */ /* Un-initialize the toolbar info */
@ -80,10 +81,25 @@ int nxtk_closetoolbar(NXTKWINDOW hfwnd)
nxtk_setsubwindows(fwnd); nxtk_setsubwindows(fwnd);
/* Then redraw the entire window, even the client window must be #ifdef CONFIG_NX_RAMBACKED
* redrawn because it has changed its vertical position and size. /* The redraw request has no effect if a framebuffer is used with the
* window. For that type of window, the application must perform the
* window update itself and not rely on a redraw notification.
*/
if (NXBE_ISRAMBACKED(&fwnd->wnd))
{
(void)nxtk_drawframe(fwnd, &fwnd->wnd.bounds); /* Does not fail */
}
else
#endif
{
/* Redraw the entire window, even the client window must be redrawn
* because it has changed its vertical position and size.
*/ */
nx_redrawreq(&fwnd->wnd, &fwnd->wnd.bounds); nx_redrawreq(&fwnd->wnd, &fwnd->wnd.bounds);
}
return OK; return OK;
} }

View File

@ -97,7 +97,7 @@ static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
FAR struct nxtk_framedwindow_s *fwnd; FAR struct nxtk_framedwindow_s *fwnd;
struct nxgl_rect_s intersection; struct nxgl_rect_s intersection;
DEBUGASSERT(hwnd != NULL && rect != NULL && fwnd->fwcb != NULL); DEBUGASSERT(hwnd != NULL && rect != NULL);
fwnd = (FAR struct nxtk_framedwindow_s *)hwnd; fwnd = (FAR struct nxtk_framedwindow_s *)hwnd;
ginfo("hwnd=%p rect={(%d,%d),(%d,%d)} more=%d\n", ginfo("hwnd=%p rect={(%d,%d),(%d,%d)} more=%d\n",
@ -109,6 +109,7 @@ static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
* forward the redraw callback. * forward the redraw callback.
*/ */
DEBUGASSERT(fwnd->fwcb != NULL);
if (fwnd->fwcb->redraw) if (fwnd->fwcb->redraw)
{ {
/* Clip the redraw rectangle so that it lies within the client sub-window /* Clip the redraw rectangle so that it lies within the client sub-window

View File

@ -74,10 +74,11 @@ int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
FAR const struct nx_callback_s *cb, FAR const struct nx_callback_s *cb,
FAR void *arg) FAR void *arg)
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; FAR struct nxtk_framedwindow_s *fwnd =
(FAR struct nxtk_framedwindow_s *)hfwnd;
#ifdef CONFIG_DEBUG_FEATURES #ifdef CONFIG_DEBUG_FEATURES
if (!hfwnd || !cb) if (hfwnd == NULL || cb == NULL)
{ {
set_errno(EINVAL); set_errno(EINVAL);
return ERROR; return ERROR;
@ -94,11 +95,25 @@ int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
nxtk_setsubwindows(fwnd); nxtk_setsubwindows(fwnd);
/* Then redraw the entire window, even the client window must be #ifdef CONFIG_NX_RAMBACKED
* redrawn because it has changed its vertical position and size. /* The redraw request has no effect if a framebuffer is used with the
* window. For that type of window, the application must perform the
* toolbar update itself and not rely on a redraw notification.
*/
if (NXBE_ISRAMBACKED(&fwnd->wnd))
{
(void)nxtk_drawframe(fwnd, &fwnd->wnd.bounds); /* Does not fail */
}
else
#endif
{
/* Redraw the entire window, even the client window must be redrawn
* because it has changed its vertical position and size.
*/ */
nx_redrawreq(&fwnd->wnd, &fwnd->wnd.bounds); nx_redrawreq(&fwnd->wnd, &fwnd->wnd.bounds);
}
return OK; return OK;
} }