Decoupling NX user interfaces to support NX kernel build (phase 2)
This commit is contained in:
parent
2507017695
commit
425d0cccaf
@ -35,14 +35,11 @@
|
||||
|
||||
NX_ASRCS =
|
||||
|
||||
NXAPI_CSRCS = nx_bitmap.c nx_eventhandler.c nx_eventnotify.c nx_fill.c
|
||||
NXAPI_CSRCS += nx_filltrapezoid.c nx_getposition.c nx_getrectangle.c
|
||||
NXAPI_CSRCS += nx_lower.c nx_move.c nx_openwindow.c nx_raise.c
|
||||
NXAPI_CSRCS += nx_setpixel.c nx_setsize.c nx_setposition.c nx_drawcircle.c
|
||||
NXAPI_CSRCS += nx_drawline.c nx_fillcircle.c
|
||||
NXAPI_CSRCS = nx_eventhandler.c nx_eventnotify.c
|
||||
NXAPI_CSRCS += nx_drawcircle.c nx_drawline.c nx_fillcircle.c
|
||||
|
||||
NXMU_CSRCS = nxmu_kbdin.c nxmu_mouse.c nxmu_openwindow.c nxmu_redrawreq.c
|
||||
NXMU_CSRCS += nxmu_releasebkgd.c nxmu_requestbkgd.c nxmu_reportposition.c
|
||||
NXMU_CSRCS += nxmu_sendclient.c nxmu_sendwindow.c nxmu_semtake.c nxmu_server.c
|
||||
NXMU_CSRCS += nxmu_sendclient.c nxmu_sendclientwindow.c nxmu_server.c
|
||||
|
||||
NX_CSRCS = $(NXAPI_CSRCS) $(NXMU_CSRCS)
|
||||
|
@ -55,9 +55,6 @@
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* Handy macros */
|
||||
|
||||
#define nxmu_semgive(sem) sem_post(sem) /* To match nxmu_semtake() */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
113
graphics/nxmu/nxmu_sendclientwindow.c
Normal file
113
graphics/nxmu/nxmu_sendclientwindow.c
Normal file
@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nxmu_sendclientwindow.c
|
||||
*
|
||||
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxmu_sendclientwindow
|
||||
*
|
||||
* Description:
|
||||
* Send a message to the client at NX_CLIMSG_PRIO priority
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - A pointer to the back-end window structure
|
||||
* msg - A pointer to the message to send
|
||||
* msglen - The length of the message in bytes.
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nxmu_sendclientwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
|
||||
size_t msglen)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
/* Sanity checking */
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !wnd->conn)
|
||||
{
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ignore messages destined to a blocked window (no errors reported) */
|
||||
|
||||
if (!NXBE_ISBLOCKED(wnd))
|
||||
{
|
||||
/* Send the message to the server */
|
||||
|
||||
ret = nxmu_sendclient(wnd->conn, msg, msglen);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,158 +0,0 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nxmu_sendserver.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxmu_sendwindow
|
||||
*
|
||||
* Description:
|
||||
* Send a message to the server destined for a specific window at
|
||||
* NX_SVRMSG_PRIO priority
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - A pointer to the back-end window structure
|
||||
* msg - A pointer to the message to send
|
||||
* msglen - The length of the message in bytes.
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nxmu_sendwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
|
||||
size_t msglen)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
/* Sanity checking */
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !wnd->conn)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ignore messages destined to a blocked window (no errors reported) */
|
||||
|
||||
if (!NXBE_ISBLOCKED(wnd))
|
||||
{
|
||||
/* Send the message to the server */
|
||||
|
||||
ret = nxmu_sendserver(wnd->conn, msg, msglen);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxmu_sendclientwindow
|
||||
*
|
||||
* Description:
|
||||
* Send a message to the client at NX_CLIMSG_PRIO priority
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - A pointer to the back-end window structure
|
||||
* msg - A pointer to the message to send
|
||||
* msglen - The length of the message in bytes.
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nxmu_sendclientwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
|
||||
size_t msglen)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
/* Sanity checking */
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !wnd->conn)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ignore messages destined to a blocked window (no errors reported) */
|
||||
|
||||
if (!NXBE_ISBLOCKED(wnd))
|
||||
{
|
||||
/* Send the message to the server */
|
||||
|
||||
ret = nxmu_sendclient(wnd->conn, msg, msglen);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -83,6 +83,10 @@
|
||||
#define NX_CLIMSG_PRIO 42
|
||||
#define NX_SVRMSG_PRIO 42
|
||||
|
||||
/* Handy macros */
|
||||
|
||||
#define nxmu_semgive(sem) sem_post(sem) /* To match nxmu_semtake() */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -42,10 +42,15 @@ ifeq ($(CONFIG_NX),y)
|
||||
# build (single use mode cannot be used with the kernel build)
|
||||
|
||||
ifeq ($(CONFIG_NX_MULTIUSER),y)
|
||||
CSRCS += lib_nxmu_sendserver.c lib_nx_connect.c lib_nx_disconnect.c lib_nx_block.c
|
||||
CSRCS += lib_nxmu_sendserver.c lib_nx_connect.c lib_nx_disconnect.c
|
||||
CSRCS += lib_nxmu_semtake.c lib_nx_block.c
|
||||
CSRCS += lib_nx_kbdchin.c lib_nx_kbdin.c lib_nx_mousein.c
|
||||
CSRCS += lib_nx_closewindow.c lib_nxmu_constructwindow.c lib_nx_releasebkgd.c
|
||||
CSRCS += lib_nx_requestbkgd.c lib_nx_setbgcolor.c
|
||||
CSRCS += lib_nx_releasebkgd.c lib_nx_requestbkgd.c lib_nx_setbgcolor.c
|
||||
|
||||
CSRCS += lib_nxmu_sendwindow.c lib_nx_closewindow.c lib_nxmu_constructwindow.c
|
||||
CSRCS += lib_nx_bitmap.c lib_nx_fill.c lib_nx_filltrapezoid.c lib_nx_getposition.c
|
||||
CSRCS += lib_nx_getrectangle.c lib_nx_lower.c lib_nx_move.c lib_nx_openwindow.c
|
||||
CSRCS += lib_nx_raise.c lib_nx_setpixel.c lib_nx_setposition.c lib_nx_setsize.c
|
||||
endif
|
||||
|
||||
# Add the nx/ directory to the build
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_bitmap.c
|
||||
* libc/nx/lib_nx_bitmap.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,9 +43,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#include "nxbe.h"
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -106,7 +105,7 @@ int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !dest || !src || !origin)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_fill.c
|
||||
* libc/nx/lib_nx_fill.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -45,8 +45,8 @@
|
||||
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -97,7 +97,7 @@ int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !rect || !color)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_filltrapezoid.c
|
||||
* libc/nx/lib_nx_filltrapezoid.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -45,8 +45,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -102,7 +102,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !trap || !color)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_getposition.c
|
||||
* libc/nx/lib_nx_getposition.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,7 +43,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -93,7 +94,7 @@ int nx_getposition(NXWINDOW hwnd)
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_getrectangle.c
|
||||
* libc/nx/lib_nx_getrectangle.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -44,8 +44,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_lower.c
|
||||
* libc/nx/lib_nx_lower.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,7 +43,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_move.c
|
||||
* libc/nx/lib_nx_move.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,7 +43,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -94,7 +95,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_openwindow.c
|
||||
* libc/nx/lib_nx_openwindow.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,9 +43,10 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
#include "lib_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -97,17 +98,17 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!handle || !cb)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Pre-allocate the window structure */
|
||||
|
||||
wnd = (FAR struct nxbe_window_s *)kzalloc(sizeof(struct nxbe_window_s));
|
||||
wnd = (FAR struct nxbe_window_s *)lib_zalloc(sizeof(struct nxbe_window_s));
|
||||
if (!wnd)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
set_errno(ENOMEM);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_raise.c
|
||||
* libc/nx/lib_nx_raise.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,7 +43,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_setpixel.c
|
||||
* libc/nx/lib_nx_setpixel.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -45,8 +45,8 @@
|
||||
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_setposition.c
|
||||
* libc/nx/lib_nx_setposition.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,7 +43,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -92,7 +93,7 @@ int nx_setposition(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos)
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !pos)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nx_setsize.c
|
||||
* libc/nx/lib_nx_setsize.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,7 +43,8 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -92,7 +93,7 @@ int nx_setsize(NXWINDOW hwnd, FAR const struct nxgl_size_s *size)
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !size)
|
||||
{
|
||||
errno = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxmu/nxmu_semtake.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -44,7 +44,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include "nxfe.h"
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
115
libc/nx/lib_nxmu_sendwindow.c
Normal file
115
libc/nx/lib_nxmu_sendwindow.c
Normal file
@ -0,0 +1,115 @@
|
||||
/****************************************************************************
|
||||
* libc/nx/lib_nxmu_sendserver.c
|
||||
*
|
||||
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nxbe.h>
|
||||
#include <nuttx/nx/nxmu.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxmu_sendwindow
|
||||
*
|
||||
* Description:
|
||||
* Send a message to the server destined for a specific window at
|
||||
* NX_SVRMSG_PRIO priority
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - A pointer to the back-end window structure
|
||||
* msg - A pointer to the message to send
|
||||
* msglen - The length of the message in bytes.
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nxmu_sendwindow(FAR struct nxbe_window_s *wnd, FAR const void *msg,
|
||||
size_t msglen)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
/* Sanity checking */
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !wnd->conn)
|
||||
{
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ignore messages destined to a blocked window (no errors reported) */
|
||||
|
||||
if (!NXBE_ISBLOCKED(wnd))
|
||||
{
|
||||
/* Send the message to the server */
|
||||
|
||||
ret = nxmu_sendserver(wnd->conn, msg, msglen);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
Loading…
Reference in New Issue
Block a user