diff --git a/include/nuttx/nx/nxbe.h b/include/nuttx/nx/nxbe.h index b3b6a982ede..806ac7adc41 100644 --- a/include/nuttx/nx/nxbe.h +++ b/include/nuttx/nx/nxbe.h @@ -127,7 +127,7 @@ struct nxbe_window_s * absolute screen coordinate system (0,0)->(xres,yres) */ - struct nxgl_rect_s bounds; /* The bounding rectangle of window */ + struct nxgl_rect_s bounds; /* The bounding rectangle of the window */ /* Window flags (see the NXBE_* bit definitions above) */ diff --git a/libs/libnx/nxtk/nxtk_events.c b/libs/libnx/nxtk/nxtk_events.c index 42c6f5d77c6..a5461d195d8 100644 --- a/libs/libnx/nxtk/nxtk_events.c +++ b/libs/libnx/nxtk/nxtk_events.c @@ -94,10 +94,11 @@ const struct nx_callback_s g_nxtkcb = static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, bool more, FAR void *arg) { - FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hwnd; + FAR struct nxtk_framedwindow_s *fwnd; struct nxgl_rect_s intersection; - DEBUGASSERT(hwnd && rect && fwnd->fwcb); + DEBUGASSERT(hwnd != NULL && rect != NULL && fwnd->fwcb != NULL); + fwnd = (FAR struct nxtk_framedwindow_s *)hwnd; ginfo("hwnd=%p rect={(%d,%d),(%d,%d)} more=%d\n", hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, more); diff --git a/libs/libnx/nxtk/nxtk_opentoolbar.c b/libs/libnx/nxtk/nxtk_opentoolbar.c index 745cd6b3885..68dcde1f91b 100644 --- a/libs/libnx/nxtk/nxtk_opentoolbar.c +++ b/libs/libnx/nxtk/nxtk_opentoolbar.c @@ -100,7 +100,5 @@ int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height, nx_redrawreq(&fwnd->wnd, &fwnd->wnd.bounds); - /* Return the initialized toolbar reference */ - return OK; } diff --git a/libs/libnx/nxtk/nxtk_setsize.c b/libs/libnx/nxtk/nxtk_setsize.c index a801cff2501..7afa291a501 100644 --- a/libs/libnx/nxtk/nxtk_setsize.c +++ b/libs/libnx/nxtk/nxtk_setsize.c @@ -1,7 +1,7 @@ /**************************************************************************** * libs/libnx/nxtk/nxtk_setsize.c * - * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013, 2019 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -71,17 +71,20 @@ int nxtk_setsize(NXTKWINDOW hfwnd, FAR const struct nxgl_size_s *size) { - FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; + FAR struct nxtk_framedwindow_s *fwnd; struct nxgl_size_s newsize; + int ret; #ifdef CONFIG_DEBUG_FEATURES - if (!hfwnd || !size) + if (hfwnd == NULL || size == NULL) { set_errno(EINVAL); return ERROR; } #endif + fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; + /* Add the sizes need for the toolbar and the borders */ newsize.w = size->w + 2 * CONFIG_NXTK_BORDERWIDTH; @@ -89,5 +92,23 @@ int nxtk_setsize(NXTKWINDOW hfwnd, FAR const struct nxgl_size_s *size) /* Then set the window size */ - return nx_setsize((NXWINDOW)hfwnd, &newsize); + ret = nx_setsize((NXWINDOW)hfwnd, &newsize); + +#ifdef CONFIG_NX_RAMBACKED + /* Windows backed with per-window framebuffers do not get redraw + * callbacks. Normally the frame is updated with every redraw callback. + * However, as a minimum, the frame only has to but updated after the + * window or toolbar sizes change. + * + * REVISIT: Since this works for RAM backed windows, it should work for + * all windows. Why not simplify? + */ + + if (ret >= 0 && NXBE_ISRAMBACKED(&fwnd->wnd)) + { + ret = nxtk_drawframe(fwnd, &fwnd->wnd.bounds); + } +#endif + + return ret; }