libs/libnx/nxtk/nxtk_setsize.c: Add logic to redraw NXTK borders for the case of per-window framebuffers. There are no redraw callbacks in this case, so we cannot rely on the callbacks to redraw the borders.

This commit is contained in:
Gregory Nutt 2019-03-17 14:37:57 -06:00
parent a90364d14f
commit 4d4ae87cb7
4 changed files with 29 additions and 9 deletions

View File

@ -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) */

View File

@ -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);

View File

@ -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;
}

View File

@ -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 <gnutt@nuttx.org>
*
* 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;
}