apps/examples/nxterm, graphics/NxWidgets: Replace illegal direct calls to nxterm_redraw() and nxterm_kbdin() with new boardctl() calls.

This commit is contained in:
Gregory Nutt 2019-03-06 15:23:02 -06:00
parent 6529a8444a
commit 53e6f4bf13
3 changed files with 31 additions and 14 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/nxterm/nxterm_wndo.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <sys/boardctl.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
@ -50,6 +51,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxglib.h>
#include <nuttx/nx/nxfonts.h>
#include "nxterm_internal.h"
@ -125,9 +127,15 @@ static void nxwndo_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
if (g_nxterm_vars.hdrvr)
{
struct boardioc_nxterm_redraw_s redraw;
/* Inform the NX console of the redraw request */
nxterm_redraw(g_nxterm_vars.hdrvr, rect, more);
redraw.handle = g_nxterm_vars.hdrvr;
redraw.more = more;
nxgl_rectcopy(&redraw.rect, rect);
(void)boardctl(BOARDIOC_NXTERM_REDRAW, (uintptr_t)&redraw);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* apps/graphics/NxWidgets/nxwidgets/src/ccallback.cxx
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -40,14 +40,14 @@
#include <nuttx/config.h>
#include <sys/types.h>
#ifdef CONFIG_NXTERM_NXKBDIN
# include <sys/boardctl.h>
#endif
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#ifdef CONFIG_NXTERM_NXKBDIN
# include <nuttx/nx/nxterm.h>
#endif
#include "graphics/nxwidgets/cwidgetcontrol.hxx"
#include "graphics/nxwidgets/ccallback.hxx"
@ -212,9 +212,15 @@ void CCallback::newKeyboardEvent(NXHANDLE hwnd, uint8_t nCh,
#ifdef CONFIG_NXTERM_NXKBDIN
if (This->m_nxterm)
{
struct boardioc_nxterm_kbdin_s kbdin;
// Keyboard input is going to an NxTerm
nxterm_kbdin(This->m_nxterm, str, nCh);
kbdin.handle = This->m_nxterm;
kbdin.buffer = str;
kbdin.buflen = nCh;
(void)boardctl(BOARDIOC_NXTERM_KBDIN, (uintptr_t)&kbin);
}
else
#endif

View File

@ -403,13 +403,16 @@ void CNxTerm::redraw(void)
// Redraw the entire NxTerm window
struct nxgl_rect_s rect;
rect.pt1.x = 0;
rect.pt1.y = 0;
rect.pt2.x = windowSize.w - 1;
rect.pt2.y = windowSize.h - 1;
struct boardioc_nxterm_redraw_s redraw;
nxterm_redraw(m_nxterm, &rect, false);
redraw.handle = m_nxterm;
redraw.rect.pt1.x = 0;
redraw.rect.pt1.y = 0;
redraw.rect.pt2.x = windowSize.w - 1;
redraw.rect.pt2.y = windowSize.h - 1;
redraw.more = false;
(void)boardctl(BOARDIOC_NXTERM_KBDIN, (uintptr_t)&redraw);
}
/**