graphics/nxmu, include/nuttx/nx/nxmu.h, libs/libnx: Add new server->client callback to notify the window client of server events. Remove the old 'blocked' callback and just make it one case of an 'event' callback.

This commit is contained in:
Gregory Nutt
2019-03-25 13:00:13 -06:00
parent 0fab8d014a
commit f5e8dc60f4
5 changed files with 72 additions and 41 deletions
+11 -8
View File
@@ -1,7 +1,8 @@
/****************************************************************************
* libs/libnx/nxtk/nxtk_events.c
*
* Copyright (C) 2008-2009, 2012, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2012, 2017, 2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -68,7 +69,8 @@ static void nxtk_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
static void nxtk_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch,
FAR void *arg);
#endif
static void nxtk_blocked(NXWINDOW hwnd, FAR void *arg1, FAR void *arg2);
static void nxtk_event(NXWINDOW hwnd, enum nx_event_e event,
FAR void *arg1, FAR void *arg2);
/****************************************************************************
* Public Data
@@ -84,7 +86,7 @@ const struct nx_callback_s g_nxtkcb =
#ifdef CONFIG_NX_KBD
, nxtk_kbdin /* kbdin */
#endif
, nxtk_blocked /* blocked */
, nxtk_event /* event */
};
/****************************************************************************
@@ -290,18 +292,19 @@ static void nxtk_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch,
#endif
/****************************************************************************
* Name: nxtk_blocked
* Name: nxtk_event
****************************************************************************/
static void nxtk_blocked(NXWINDOW hwnd, FAR void *arg1, FAR void *arg2)
static void nxtk_event(NXWINDOW hwnd, enum nx_event_e event,
FAR void *arg1, FAR void *arg2)
{
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hwnd;
/* Only the client window gets keyboard input */
/* Forward the event to the window client */
if (fwnd->fwcb->blocked)
if (fwnd->fwcb->event != NULL)
{
fwnd->fwcb->blocked((NXTKWINDOW)fwnd, fwnd->fwarg, arg2);
fwnd->fwcb->event((NXTKWINDOW)fwnd, event, fwnd->fwarg, arg2);
}
}