vnc: Decouple VNC server from NX graphic stack
since VNC server is very useful even without NX: 1.Replace nxgl_coord_t with fb_coord_t 2.Replace nxgl_rect_s with fb_area_s 3.Remove nxgl_xxx function call Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
e9ab3adf23
commit
902d2197b0
@ -208,7 +208,7 @@ Graphics
|
|||||||
|
|
||||||
:configuration: CONFIG_VNCSERVER
|
:configuration: CONFIG_VNCSERVER
|
||||||
|
|
||||||
:dependencies: VNC server provides :c:func:`vnc_default_fbinitialize`.
|
:dependencies: VNC server provides :c:func:`nx_vnc_fbinitialize`.
|
||||||
|
|
||||||
.. c:macro:: BOARDIOC_NXTERM
|
.. c:macro:: BOARDIOC_NXTERM
|
||||||
|
|
||||||
|
@ -657,7 +657,7 @@ int boardctl(unsigned int cmd, uintptr_t arg)
|
|||||||
* ARG: A reference readable instance of struct
|
* ARG: A reference readable instance of struct
|
||||||
* boardioc_vncstart_s
|
* boardioc_vncstart_s
|
||||||
* CONFIGURATION: CONFIG_VNCSERVER
|
* CONFIGURATION: CONFIG_VNCSERVER
|
||||||
* DEPENDENCIES: VNC server provides vnc_default_fbinitialize()
|
* DEPENDENCIES: VNC server provides nx_vnc_fbinitialize()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case BOARDIOC_VNC_START:
|
case BOARDIOC_VNC_START:
|
||||||
@ -673,7 +673,7 @@ int boardctl(unsigned int cmd, uintptr_t arg)
|
|||||||
{
|
{
|
||||||
/* Setup the VNC server to support keyboard/mouse inputs */
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
ret = vnc_default_fbinitialize(vnc->display, vnc->handle);
|
ret = nx_vnc_fbinitialize(vnc->display, vnc->handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
menuconfig VNCCLIENT
|
menuconfig VNCCLIENT
|
||||||
bool "VNC client"
|
bool "VNC client"
|
||||||
default n
|
default n
|
||||||
depends on NET_TCP && !NX_LCDDRIVER && !VNC_SERVER && EXPERIMENTAL
|
depends on NET_TCP && !VNC_SERVER && EXPERIMENTAL
|
||||||
---help---
|
---help---
|
||||||
Enable support for a VNC Remote Frame Buffer (RFB) client
|
Enable support for a VNC Remote Frame Buffer (RFB) client
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
menuconfig VNCSERVER
|
menuconfig VNCSERVER
|
||||||
bool "VNC server"
|
bool "VNC server"
|
||||||
default n
|
default n
|
||||||
depends on NET_TCP && !NX_LCDDRIVER
|
depends on NET_TCP
|
||||||
select FB_UPDATE
|
select FB_UPDATE
|
||||||
---help---
|
---help---
|
||||||
Enable support for a VNC Remote Frame Buffer (RFB) server.
|
Enable support for a VNC Remote Frame Buffer (RFB) server.
|
||||||
|
@ -21,11 +21,7 @@
|
|||||||
ifeq ($(CONFIG_VNCSERVER),y)
|
ifeq ($(CONFIG_VNCSERVER),y)
|
||||||
|
|
||||||
CSRCS += vnc_server.c vnc_negotiate.c vnc_updater.c vnc_receiver.c
|
CSRCS += vnc_server.c vnc_negotiate.c vnc_updater.c vnc_receiver.c
|
||||||
CSRCS += vnc_raw.c vnc_rre.c vnc_color.c vnc_fbdev.c
|
CSRCS += vnc_raw.c vnc_rre.c vnc_color.c vnc_fbdev.c vnc_keymap.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NX_KBD),y)
|
|
||||||
CSRCS += vnc_keymap.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
DEPPATH += --dep-path vnc/server
|
DEPPATH += --dep-path vnc/server
|
||||||
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)/graphics/vnc/server}
|
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)/graphics/vnc/server}
|
||||||
|
@ -275,15 +275,15 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_colors(FAR struct vnc_session_s *session,
|
int vnc_colors(FAR struct vnc_session_s *session,
|
||||||
FAR struct nxgl_rect_s *rect,
|
FAR struct fb_area_s *rect,
|
||||||
unsigned int maxcolors,
|
unsigned int maxcolors,
|
||||||
FAR lfb_color_t *colors)
|
FAR lfb_color_t *colors)
|
||||||
{
|
{
|
||||||
FAR const lfb_color_t *rowstart;
|
FAR const lfb_color_t *rowstart;
|
||||||
FAR const lfb_color_t *pixptr;
|
FAR const lfb_color_t *pixptr;
|
||||||
lfb_color_t pixel;
|
lfb_color_t pixel;
|
||||||
nxgl_coord_t x;
|
fb_coord_t x;
|
||||||
nxgl_coord_t y;
|
fb_coord_t y;
|
||||||
int ncolors = 0;
|
int ncolors = 0;
|
||||||
int pixndx;
|
int pixndx;
|
||||||
int maxndx;
|
int maxndx;
|
||||||
@ -299,17 +299,17 @@ int vnc_colors(FAR struct vnc_session_s *session,
|
|||||||
/* Pointer to the first pixel in the first row in the local framebuffer */
|
/* Pointer to the first pixel in the first row in the local framebuffer */
|
||||||
|
|
||||||
rowstart = (FAR lfb_color_t *)
|
rowstart = (FAR lfb_color_t *)
|
||||||
(session->fb + RFB_STRIDE * rect->pt1.y +
|
(session->fb + RFB_STRIDE * rect->y +
|
||||||
RFB_BYTESPERPIXEL * rect->pt1.x);
|
RFB_BYTESPERPIXEL * rect->x);
|
||||||
|
|
||||||
/* Loop for each row in the rectangle */
|
/* Loop for each row in the rectangle */
|
||||||
|
|
||||||
for (y = rect->pt1.y; y <= rect->pt2.y; y++)
|
for (y = 0; y < rect->h; y++)
|
||||||
{
|
{
|
||||||
/* Loop for each column in the row */
|
/* Loop for each column in the row */
|
||||||
|
|
||||||
pixptr = rowstart;
|
pixptr = rowstart;
|
||||||
for (x = rect->pt1.x; x <= rect->pt2.x; x++)
|
for (x = 0; x < rect->w; x++)
|
||||||
{
|
{
|
||||||
/* Compare this pix to all of the others we have seen */
|
/* Compare this pix to all of the others we have seen */
|
||||||
|
|
||||||
|
@ -418,7 +418,6 @@ static int up_updateearea(FAR struct fb_vtable_s *vtable,
|
|||||||
{
|
{
|
||||||
FAR struct vnc_fbinfo_s *fbinfo = (FAR struct vnc_fbinfo_s *)vtable;
|
FAR struct vnc_fbinfo_s *fbinfo = (FAR struct vnc_fbinfo_s *)vtable;
|
||||||
FAR struct vnc_session_s *session;
|
FAR struct vnc_session_s *session;
|
||||||
struct nxgl_rect_s rect;
|
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
DEBUGASSERT(fbinfo != NULL && area != NULL);
|
DEBUGASSERT(fbinfo != NULL && area != NULL);
|
||||||
@ -436,8 +435,7 @@ static int up_updateearea(FAR struct fb_vtable_s *vtable,
|
|||||||
{
|
{
|
||||||
/* Queue the rectangular update */
|
/* Queue the rectangular update */
|
||||||
|
|
||||||
nxgl_area2rect(&rect, area);
|
ret = vnc_update_rectangle(session, area, true);
|
||||||
ret = vnc_update_rectangle(session, &rect, true);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
gerr("ERROR: vnc_update_rectangle failed: %d\n", ret);
|
gerr("ERROR: vnc_update_rectangle failed: %d\n", ret);
|
||||||
@ -733,8 +731,6 @@ int up_fbinitialize(int display)
|
|||||||
* called, however, keyboard/mouse inputs from the remote VNC client will
|
* called, however, keyboard/mouse inputs from the remote VNC client will
|
||||||
* be lost. By calling vnc_fbinitialize(), you can provide callout
|
* be lost. By calling vnc_fbinitialize(), you can provide callout
|
||||||
* functions that can be received by logic higher in the architecture.
|
* functions that can be received by logic higher in the architecture.
|
||||||
* These higher level callouts can then call nx_kbdin() or nx_mousein() on
|
|
||||||
* behalf of the VNC server.
|
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* display - In the case of hardware with multiple displays, this
|
* display - In the case of hardware with multiple displays, this
|
||||||
|
@ -34,15 +34,12 @@
|
|||||||
#define XK_LATIN1 1
|
#define XK_LATIN1 1
|
||||||
#define XK_XKB_KEYS 1
|
#define XK_XKB_KEYS 1
|
||||||
|
|
||||||
#include <nuttx/nx/nx.h>
|
|
||||||
#include <nuttx/video/vnc.h>
|
#include <nuttx/video/vnc.h>
|
||||||
#include <nuttx/input/x11_keysymdef.h>
|
#include <nuttx/input/x11_keysymdef.h>
|
||||||
#include <nuttx/input/kbd_codec.h>
|
#include <nuttx/input/kbd_codec.h>
|
||||||
|
|
||||||
#include "vnc_server.h"
|
#include "vnc_server.h"
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -611,30 +608,3 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: vnc_kbdout
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This is the default keyboard callout function.
|
|
||||||
* This is simply wrappers around nx_kdbout(), respectively.
|
|
||||||
* When configured using vnc_fbinitialize(), the 'arg' must be the correct
|
|
||||||
* NXHANDLE value.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* arg - The NXHANDLE from the NX graphics subsystem
|
|
||||||
* nch - Number of characters
|
|
||||||
* ch - An array of input characters.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch)
|
|
||||||
{
|
|
||||||
DEBUGASSERT(arg != NULL);
|
|
||||||
nx_kbdin((NXHANDLE)arg, nch, ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* CONFIG_NX_KBD */
|
|
||||||
|
@ -71,16 +71,16 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static size_t vnc_copy8(FAR struct vnc_session_s *session,
|
static size_t vnc_copy8(FAR struct vnc_session_s *session,
|
||||||
nxgl_coord_t row, nxgl_coord_t col,
|
fb_coord_t row, fb_coord_t col,
|
||||||
nxgl_coord_t height, nxgl_coord_t width,
|
fb_coord_t height, fb_coord_t width,
|
||||||
vnc_convert8_t convert)
|
vnc_convert8_t convert)
|
||||||
{
|
{
|
||||||
FAR struct rfb_framebufferupdate_s *update;
|
FAR struct rfb_framebufferupdate_s *update;
|
||||||
FAR const lfb_color_t *srcleft;
|
FAR const lfb_color_t *srcleft;
|
||||||
FAR const lfb_color_t *src;
|
FAR const lfb_color_t *src;
|
||||||
FAR uint8_t *dest;
|
FAR uint8_t *dest;
|
||||||
nxgl_coord_t x;
|
fb_coord_t x;
|
||||||
nxgl_coord_t y;
|
fb_coord_t y;
|
||||||
|
|
||||||
/* Destination rectangle start address */
|
/* Destination rectangle start address */
|
||||||
|
|
||||||
@ -129,8 +129,8 @@ static size_t vnc_copy8(FAR struct vnc_session_s *session,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static size_t vnc_copy16(FAR struct vnc_session_s *session,
|
static size_t vnc_copy16(FAR struct vnc_session_s *session,
|
||||||
nxgl_coord_t row, nxgl_coord_t col,
|
fb_coord_t row, fb_coord_t col,
|
||||||
nxgl_coord_t height, nxgl_coord_t width,
|
fb_coord_t height, fb_coord_t width,
|
||||||
vnc_convert16_t convert)
|
vnc_convert16_t convert)
|
||||||
{
|
{
|
||||||
FAR struct rfb_framebufferupdate_s *update;
|
FAR struct rfb_framebufferupdate_s *update;
|
||||||
@ -138,8 +138,8 @@ static size_t vnc_copy16(FAR struct vnc_session_s *session,
|
|||||||
FAR const lfb_color_t *src;
|
FAR const lfb_color_t *src;
|
||||||
FAR uint8_t *dest;
|
FAR uint8_t *dest;
|
||||||
uint16_t pixel;
|
uint16_t pixel;
|
||||||
nxgl_coord_t x;
|
fb_coord_t x;
|
||||||
nxgl_coord_t y;
|
fb_coord_t y;
|
||||||
bool bigendian;
|
bool bigendian;
|
||||||
|
|
||||||
/* Destination rectangle start address */
|
/* Destination rectangle start address */
|
||||||
@ -201,16 +201,16 @@ static size_t vnc_copy16(FAR struct vnc_session_s *session,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static size_t vnc_copy32(FAR struct vnc_session_s *session,
|
static size_t vnc_copy32(FAR struct vnc_session_s *session,
|
||||||
nxgl_coord_t row, nxgl_coord_t col,
|
fb_coord_t row, fb_coord_t col,
|
||||||
nxgl_coord_t height, nxgl_coord_t width,
|
fb_coord_t height, fb_coord_t width,
|
||||||
vnc_convert32_t convert)
|
vnc_convert32_t convert)
|
||||||
{
|
{
|
||||||
FAR struct rfb_framebufferupdate_s *update;
|
FAR struct rfb_framebufferupdate_s *update;
|
||||||
FAR const lfb_color_t *srcleft;
|
FAR const lfb_color_t *srcleft;
|
||||||
FAR const lfb_color_t *src;
|
FAR const lfb_color_t *src;
|
||||||
FAR uint8_t *dest;
|
FAR uint8_t *dest;
|
||||||
nxgl_coord_t x;
|
fb_coord_t x;
|
||||||
nxgl_coord_t y;
|
fb_coord_t y;
|
||||||
uint32_t pixel;
|
uint32_t pixel;
|
||||||
bool bigendian;
|
bool bigendian;
|
||||||
|
|
||||||
@ -275,20 +275,20 @@ static size_t vnc_copy32(FAR struct vnc_session_s *session,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
int vnc_raw(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect)
|
||||||
{
|
{
|
||||||
FAR struct rfb_framebufferupdate_s *update;
|
FAR struct rfb_framebufferupdate_s *update;
|
||||||
FAR const uint8_t *src;
|
FAR const uint8_t *src;
|
||||||
nxgl_coord_t srcwidth;
|
fb_coord_t srcwidth;
|
||||||
nxgl_coord_t srcheight;
|
fb_coord_t srcheight;
|
||||||
nxgl_coord_t destwidth;
|
fb_coord_t destwidth;
|
||||||
nxgl_coord_t destheight;
|
fb_coord_t destheight;
|
||||||
nxgl_coord_t deststride;
|
fb_coord_t deststride;
|
||||||
nxgl_coord_t updwidth;
|
fb_coord_t updwidth;
|
||||||
nxgl_coord_t updheight;
|
fb_coord_t updheight;
|
||||||
nxgl_coord_t width;
|
fb_coord_t width;
|
||||||
nxgl_coord_t x;
|
fb_coord_t x;
|
||||||
nxgl_coord_t y;
|
fb_coord_t y;
|
||||||
unsigned int bytesperpixel;
|
unsigned int bytesperpixel;
|
||||||
unsigned int maxwidth;
|
unsigned int maxwidth;
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -345,11 +345,8 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
|||||||
* In that case, we will have to emit multiple rectangles.
|
* In that case, we will have to emit multiple rectangles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUGASSERT(rect->pt1.x <= rect->pt2.x);
|
srcwidth = rect->w;
|
||||||
srcwidth = rect->pt2.x - rect->pt1.x + 1;
|
srcheight = rect->h;
|
||||||
|
|
||||||
DEBUGASSERT(rect->pt1.y <= rect->pt2.y);
|
|
||||||
srcheight = rect->pt2.y - rect->pt1.y + 1;
|
|
||||||
|
|
||||||
deststride = srcwidth * bytesperpixel;
|
deststride = srcwidth * bytesperpixel;
|
||||||
if (deststride > maxwidth)
|
if (deststride > maxwidth)
|
||||||
@ -385,7 +382,7 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
|||||||
* asynchronously.
|
* asynchronously.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (y = rect->pt1.y;
|
for (y = rect->y;
|
||||||
srcheight > 0 && colorfmt == session->colorfmt;
|
srcheight > 0 && colorfmt == session->colorfmt;
|
||||||
srcheight -= updheight, y += updheight)
|
srcheight -= updheight, y += updheight)
|
||||||
{
|
{
|
||||||
@ -410,7 +407,7 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
|||||||
* changes asynchronously.
|
* changes asynchronously.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (width = srcwidth, x = rect->pt1.x;
|
for (width = srcwidth, x = rect->x;
|
||||||
width > 0 && colorfmt == session->colorfmt;
|
width > 0 && colorfmt == session->colorfmt;
|
||||||
width -= updwidth, x += updwidth)
|
width -= updwidth, x += updwidth)
|
||||||
{
|
{
|
||||||
|
@ -51,8 +51,7 @@
|
|||||||
#include <nuttx/net/net.h>
|
#include <nuttx/net/net.h>
|
||||||
#include <nuttx/video/rfb.h>
|
#include <nuttx/video/rfb.h>
|
||||||
#include <nuttx/video/vnc.h>
|
#include <nuttx/video/vnc.h>
|
||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/input/mouse.h>
|
||||||
#include <nuttx/nx/nxglib.h>
|
|
||||||
|
|
||||||
#include "vnc_server.h"
|
#include "vnc_server.h"
|
||||||
|
|
||||||
@ -266,7 +265,7 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
|||||||
case RFB_FBUPDATEREQ_MSG: /* FramebufferUpdateRequest */
|
case RFB_FBUPDATEREQ_MSG: /* FramebufferUpdateRequest */
|
||||||
{
|
{
|
||||||
FAR struct rfb_fbupdatereq_s *update;
|
FAR struct rfb_fbupdatereq_s *update;
|
||||||
struct nxgl_rect_s rect;
|
struct fb_area_s rect;
|
||||||
|
|
||||||
ginfo("Received FramebufferUpdateRequest\n");
|
ginfo("Received FramebufferUpdateRequest\n");
|
||||||
|
|
||||||
@ -287,10 +286,10 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
|||||||
|
|
||||||
update = (FAR struct rfb_fbupdatereq_s *)session->inbuf;
|
update = (FAR struct rfb_fbupdatereq_s *)session->inbuf;
|
||||||
|
|
||||||
rect.pt1.x = rfb_getbe16(update->xpos);
|
rect.x = rfb_getbe16(update->xpos);
|
||||||
rect.pt1.y = rfb_getbe16(update->ypos);
|
rect.y = rfb_getbe16(update->ypos);
|
||||||
rect.pt2.x = rect.pt1.x + rfb_getbe16(update->width);
|
rect.w = rfb_getbe16(update->width);
|
||||||
rect.pt2.y = rect.pt1.y + rfb_getbe16(update->height);
|
rect.h = rfb_getbe16(update->height);
|
||||||
|
|
||||||
ret = vnc_update_rectangle(session, &rect, false);
|
ret = vnc_update_rectangle(session, &rect, false);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -330,10 +329,9 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
|||||||
|
|
||||||
case RFB_POINTEREVENT_MSG: /* PointerEvent */
|
case RFB_POINTEREVENT_MSG: /* PointerEvent */
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
FAR struct rfb_pointerevent_s *event;
|
FAR struct rfb_pointerevent_s *event;
|
||||||
uint8_t buttons;
|
uint8_t buttons;
|
||||||
#endif
|
|
||||||
ginfo("Received PointerEvent\n");
|
ginfo("Received PointerEvent\n");
|
||||||
|
|
||||||
/* Read the rest of the PointerEvent message */
|
/* Read the rest of the PointerEvent message */
|
||||||
@ -346,10 +344,6 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
|||||||
gerr("ERROR: Failed to read PointerEvent message: %d\n",
|
gerr("ERROR: Failed to read PointerEvent message: %d\n",
|
||||||
ret);
|
ret);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
|
|
||||||
/* REVISIT: How will be get the NX handle? */
|
|
||||||
|
|
||||||
else if (session->mouseout != NULL)
|
else if (session->mouseout != NULL)
|
||||||
{
|
{
|
||||||
event = (FAR struct rfb_pointerevent_s *)session->inbuf;
|
event = (FAR struct rfb_pointerevent_s *)session->inbuf;
|
||||||
@ -362,25 +356,24 @@ int vnc_receiver(FAR struct vnc_session_s *session)
|
|||||||
buttons = 0;
|
buttons = 0;
|
||||||
if ((event->buttons & (1 << 0)) != 0)
|
if ((event->buttons & (1 << 0)) != 0)
|
||||||
{
|
{
|
||||||
buttons |= NX_MOUSE_LEFTBUTTON;
|
buttons |= MOUSE_BUTTON_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((event->buttons & (1 << 1)) != 0)
|
if ((event->buttons & (1 << 1)) != 0)
|
||||||
{
|
{
|
||||||
buttons |= NX_MOUSE_CENTERBUTTON;
|
buttons |= MOUSE_BUTTON_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((event->buttons & (1 << 2)) != 0)
|
if ((event->buttons & (1 << 2)) != 0)
|
||||||
{
|
{
|
||||||
buttons |= NX_MOUSE_RIGHTBUTTON;
|
buttons |= MOUSE_BUTTON_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->mouseout(session->arg,
|
session->mouseout(session->arg,
|
||||||
(nxgl_coord_t)rfb_getbe16(event->xpos),
|
(fb_coord_t)rfb_getbe16(event->xpos),
|
||||||
(nxgl_coord_t)rfb_getbe16(event->ypos),
|
(fb_coord_t)rfb_getbe16(event->ypos),
|
||||||
buttons);
|
buttons);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -483,31 +476,3 @@ int vnc_client_encodings(FAR struct vnc_session_s *session,
|
|||||||
session->change = true;
|
session->change = true;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: vnc_mouse
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This is the default keyboard/mouse callout function. This is simply a
|
|
||||||
* wrapper around nx_mousein(). When
|
|
||||||
* configured using vnc_fbinitialize(), the 'arg' must be the correct
|
|
||||||
* NXHANDLE value.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These
|
|
||||||
* callouts have arguments that match the inputs to nx_kbdin() and
|
|
||||||
* nx_mousein() (if arg is really of type NXHANDLE).
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y,
|
|
||||||
uint8_t buttons)
|
|
||||||
{
|
|
||||||
DEBUGASSERT(arg != NULL);
|
|
||||||
nx_mousein((NXHANDLE)arg, x, y, buttons);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -92,74 +92,48 @@ struct rre_encode32_s
|
|||||||
|
|
||||||
ssize_t vnc_rre8(FAR struct vnc_session_s *session,
|
ssize_t vnc_rre8(FAR struct vnc_session_s *session,
|
||||||
FAR struct rre_encode8_s *dest,
|
FAR struct rre_encode8_s *dest,
|
||||||
FAR struct nxgl_rect_s *rect,
|
FAR struct fb_area_s *rect,
|
||||||
uint8_t bgcolor)
|
uint8_t bgcolor)
|
||||||
{
|
{
|
||||||
nxgl_coord_t width;
|
|
||||||
nxgl_coord_t height;
|
|
||||||
|
|
||||||
rfb_putbe32(dest->hdr.nsubrects, 1);
|
rfb_putbe32(dest->hdr.nsubrects, 1);
|
||||||
dest->hdr.pixel = bgcolor;
|
dest->hdr.pixel = bgcolor;
|
||||||
|
|
||||||
dest->rect.pixel = bgcolor;
|
dest->rect.pixel = bgcolor;
|
||||||
rfb_putbe16(dest->rect.xpos, rect->pt1.x);
|
rfb_putbe16(dest->rect.xpos, rect->x);
|
||||||
rfb_putbe16(dest->rect.ypos, rect->pt1.y);
|
rfb_putbe16(dest->rect.ypos, rect->y);
|
||||||
|
rfb_putbe16(dest->rect.width, rect->w);
|
||||||
width = rect->pt2.x - rect->pt1.x + 1;
|
rfb_putbe16(dest->rect.height, rect->h);
|
||||||
height = rect->pt2.y - rect->pt1.y + 1;
|
|
||||||
|
|
||||||
rfb_putbe16(dest->rect.width, width);
|
|
||||||
rfb_putbe16(dest->rect.height, height);
|
|
||||||
|
|
||||||
return sizeof(struct rre_encode8_s);
|
return sizeof(struct rre_encode8_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t vnc_rre16(FAR struct vnc_session_s *session,
|
ssize_t vnc_rre16(FAR struct vnc_session_s *session,
|
||||||
FAR struct rre_encode16_s *dest,
|
FAR struct rre_encode16_s *dest,
|
||||||
FAR struct nxgl_rect_s *rect,
|
FAR struct fb_area_s *rect,
|
||||||
uint16_t bgcolor)
|
uint16_t bgcolor)
|
||||||
{
|
{
|
||||||
nxgl_coord_t width;
|
|
||||||
nxgl_coord_t height;
|
|
||||||
|
|
||||||
rfb_putbe32(dest->hdr.nsubrects, 1);
|
rfb_putbe32(dest->hdr.nsubrects, 1);
|
||||||
rfb_putbe16(dest->hdr.pixel, bgcolor);
|
rfb_putbe16(dest->hdr.pixel, bgcolor);
|
||||||
|
|
||||||
rfb_putbe16(dest->rect.pixel, bgcolor);
|
rfb_putbe16(dest->rect.pixel, bgcolor);
|
||||||
rfb_putbe16(dest->rect.xpos, rect->pt1.x);
|
rfb_putbe16(dest->rect.xpos, rect->x);
|
||||||
rfb_putbe16(dest->rect.xpos, rect->pt1.x);
|
rfb_putbe16(dest->rect.ypos, rect->y);
|
||||||
rfb_putbe16(dest->rect.ypos, rect->pt1.y);
|
rfb_putbe16(dest->rect.width, rect->w);
|
||||||
|
rfb_putbe16(dest->rect.height, rect->h);
|
||||||
width = rect->pt2.x - rect->pt1.x + 1;
|
|
||||||
height = rect->pt2.y - rect->pt1.y + 1;
|
|
||||||
|
|
||||||
rfb_putbe16(dest->rect.width, width);
|
|
||||||
rfb_putbe16(dest->rect.height, height);
|
|
||||||
|
|
||||||
return sizeof(struct rre_encode16_s);
|
return sizeof(struct rre_encode16_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t vnc_rre32(FAR struct vnc_session_s *session,
|
ssize_t vnc_rre32(FAR struct vnc_session_s *session,
|
||||||
FAR struct rre_encode32_s *dest,
|
FAR struct rre_encode32_s *dest,
|
||||||
FAR struct nxgl_rect_s *rect,
|
FAR struct fb_area_s *rect,
|
||||||
uint32_t bgcolor)
|
uint32_t bgcolor)
|
||||||
{
|
{
|
||||||
nxgl_coord_t width;
|
|
||||||
nxgl_coord_t height;
|
|
||||||
|
|
||||||
rfb_putbe32(dest->hdr.nsubrects, 1);
|
rfb_putbe32(dest->hdr.nsubrects, 1);
|
||||||
rfb_putbe32(dest->hdr.pixel, bgcolor);
|
rfb_putbe32(dest->hdr.pixel, bgcolor);
|
||||||
|
|
||||||
rfb_putbe32(dest->rect.pixel, bgcolor);
|
rfb_putbe32(dest->rect.pixel, bgcolor);
|
||||||
rfb_putbe16(dest->rect.xpos, rect->pt1.x);
|
rfb_putbe16(dest->rect.xpos, rect->x);
|
||||||
rfb_putbe16(dest->rect.xpos, rect->pt1.x);
|
rfb_putbe16(dest->rect.ypos, rect->y);
|
||||||
rfb_putbe16(dest->rect.ypos, rect->pt1.y);
|
rfb_putbe16(dest->rect.width, rect->w);
|
||||||
|
rfb_putbe16(dest->rect.height, rect->h);
|
||||||
width = rect->pt2.x - rect->pt1.x + 1;
|
|
||||||
height = rect->pt2.y - rect->pt1.y + 1;
|
|
||||||
|
|
||||||
rfb_putbe16(dest->rect.width, width);
|
|
||||||
rfb_putbe16(dest->rect.height, height);
|
|
||||||
|
|
||||||
return sizeof(struct rre_encode32_s);
|
return sizeof(struct rre_encode32_s);
|
||||||
}
|
}
|
||||||
@ -189,13 +163,11 @@ ssize_t vnc_rre32(FAR struct vnc_session_s *session,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
int vnc_rre(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect)
|
||||||
{
|
{
|
||||||
FAR struct rfb_framebufferupdate_s *rre;
|
FAR struct rfb_framebufferupdate_s *rre;
|
||||||
FAR struct rfb_rectangle_s *rrect;
|
FAR struct rfb_rectangle_s *rrect;
|
||||||
lfb_color_t bgcolor;
|
lfb_color_t bgcolor;
|
||||||
nxgl_coord_t width;
|
|
||||||
nxgl_coord_t height;
|
|
||||||
size_t nbytes;
|
size_t nbytes;
|
||||||
ssize_t nsent;
|
ssize_t nsent;
|
||||||
int ret;
|
int ret;
|
||||||
@ -209,9 +181,6 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
|||||||
ret = vnc_colors(session, rect, 1, &bgcolor);
|
ret = vnc_colors(session, rect, 1, &bgcolor);
|
||||||
if (ret == 1)
|
if (ret == 1)
|
||||||
{
|
{
|
||||||
width = rect->pt2.x - rect->pt1.x + 1;
|
|
||||||
height = rect->pt2.y - rect->pt1.y + 1;
|
|
||||||
|
|
||||||
/* Format the FrameBuffer Update with a single RRE encoded
|
/* Format the FrameBuffer Update with a single RRE encoded
|
||||||
* rectangle.
|
* rectangle.
|
||||||
*/
|
*/
|
||||||
@ -223,10 +192,10 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
|||||||
rfb_putbe16(rre->nrect, 1);
|
rfb_putbe16(rre->nrect, 1);
|
||||||
|
|
||||||
rrect = (FAR struct rfb_rectangle_s *)&rre->rect;
|
rrect = (FAR struct rfb_rectangle_s *)&rre->rect;
|
||||||
rfb_putbe16(rrect->xpos, rect->pt1.x);
|
rfb_putbe16(rrect->xpos, rect->x);
|
||||||
rfb_putbe16(rrect->ypos, rect->pt1.y);
|
rfb_putbe16(rrect->ypos, rect->y);
|
||||||
rfb_putbe16(rrect->width, width);
|
rfb_putbe16(rrect->width, rect->w);
|
||||||
rfb_putbe16(rrect->height, height);
|
rfb_putbe16(rrect->height, rect->h);
|
||||||
rfb_putbe32(rrect->encoding, RFB_ENCODING_RRE);
|
rfb_putbe32(rrect->encoding, RFB_ENCODING_RRE);
|
||||||
|
|
||||||
/* The sub-rectangle encoding depends of the remote pixel width */
|
/* The sub-rectangle encoding depends of the remote pixel width */
|
||||||
@ -292,7 +261,7 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect)
|
|||||||
|
|
||||||
DEBUGASSERT(nsent == nbytes);
|
DEBUGASSERT(nsent == nbytes);
|
||||||
updinfo("Sent {(%d, %d),(%d, %d)}\n",
|
updinfo("Sent {(%d, %d),(%d, %d)}\n",
|
||||||
rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y);
|
rect->x, rect->y, rect->w, rect->h);
|
||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
#include <nuttx/video/fb.h>
|
#include <nuttx/video/fb.h>
|
||||||
#include <nuttx/video/rfb.h>
|
#include <nuttx/video/rfb.h>
|
||||||
#include <nuttx/video/vnc.h>
|
#include <nuttx/video/vnc.h>
|
||||||
#include <nuttx/nx/nxglib.h>
|
|
||||||
#include <nuttx/nx/nx.h>
|
|
||||||
#include <nuttx/net/net.h>
|
#include <nuttx/net/net.h>
|
||||||
#include <nuttx/semaphore.h>
|
#include <nuttx/semaphore.h>
|
||||||
|
|
||||||
@ -196,7 +194,7 @@ struct vnc_fbupdate_s
|
|||||||
{
|
{
|
||||||
FAR struct vnc_fbupdate_s *flink;
|
FAR struct vnc_fbupdate_s *flink;
|
||||||
bool whupd; /* True: whole screen update */
|
bool whupd; /* True: whole screen update */
|
||||||
struct nxgl_rect_s rect; /* The enqueued update rectangle */
|
struct fb_area_s rect; /* The enqueued update rectangle */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vnc_session_s
|
struct vnc_session_s
|
||||||
@ -424,7 +422,7 @@ int vnc_stop_updater(FAR struct vnc_session_s *session);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||||
FAR const struct nxgl_rect_s *rect,
|
FAR const struct fb_area_s *rect,
|
||||||
bool change);
|
bool change);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -464,7 +462,7 @@ int vnc_receiver(FAR struct vnc_session_s *session);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect);
|
int vnc_rre(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: vnc_raw
|
* Name: vnc_raw
|
||||||
@ -484,7 +482,7 @@ int vnc_rre(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect);
|
int vnc_raw(FAR struct vnc_session_s *session, FAR struct fb_area_s *rect);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: vnc_key_map
|
* Name: vnc_key_map
|
||||||
@ -503,10 +501,8 @@ int vnc_raw(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
|
||||||
void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym,
|
void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym,
|
||||||
bool keydown);
|
bool keydown);
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: vnc_convert_rgbNN
|
* Name: vnc_convert_rgbNN
|
||||||
@ -556,7 +552,7 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_colors(FAR struct vnc_session_s *session,
|
int vnc_colors(FAR struct vnc_session_s *session,
|
||||||
FAR struct nxgl_rect_s *rect,
|
FAR struct fb_area_s *rect,
|
||||||
unsigned int maxcolors, FAR lfb_color_t *colors);
|
unsigned int maxcolors, FAR lfb_color_t *colors);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
|
@ -67,16 +67,9 @@ static sem_t g_errsem = SEM_INITIALIZER(1);
|
|||||||
|
|
||||||
/* A rectangle represent the entire local framebuffer */
|
/* A rectangle represent the entire local framebuffer */
|
||||||
|
|
||||||
static const struct nxgl_rect_s g_wholescreen =
|
static const struct fb_area_s g_wholescreen =
|
||||||
{
|
{
|
||||||
{
|
0, 0, CONFIG_VNCSERVER_SCREENWIDTH, CONFIG_VNCSERVER_SCREENHEIGHT
|
||||||
0,
|
|
||||||
0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
CONFIG_VNCSERVER_SCREENWIDTH - 1,
|
|
||||||
CONFIG_VNCSERVER_SCREENHEIGHT - 1
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -379,8 +372,8 @@ static FAR void *vnc_updater(FAR void *arg)
|
|||||||
DEBUGASSERT(srcrect != NULL);
|
DEBUGASSERT(srcrect != NULL);
|
||||||
|
|
||||||
updinfo("Dequeued {(%d, %d),(%d, %d)}\n",
|
updinfo("Dequeued {(%d, %d),(%d, %d)}\n",
|
||||||
srcrect->rect.pt1.x, srcrect->rect.pt1.y,
|
srcrect->rect.x, srcrect->rect.y,
|
||||||
srcrect->rect.pt2.x, srcrect->rect.pt2.y);
|
srcrect->rect.w, srcrect->rect.h);
|
||||||
|
|
||||||
/* Attempt to use RRE encoding */
|
/* Attempt to use RRE encoding */
|
||||||
|
|
||||||
@ -536,26 +529,45 @@ int vnc_stop_updater(FAR struct vnc_session_s *session)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
||||||
FAR const struct nxgl_rect_s *rect, bool change)
|
FAR const struct fb_area_s *rect, bool change)
|
||||||
{
|
{
|
||||||
FAR struct vnc_fbupdate_s *update;
|
FAR struct vnc_fbupdate_s *update;
|
||||||
struct nxgl_rect_s intersection;
|
struct fb_area_s intersection;
|
||||||
bool whupd;
|
bool whupd;
|
||||||
|
|
||||||
|
intersection.x = rect->x;
|
||||||
|
intersection.y = rect->y;
|
||||||
|
|
||||||
/* Clip rectangle to the screen dimensions */
|
/* Clip rectangle to the screen dimensions */
|
||||||
|
|
||||||
nxgl_rectintersect(&intersection, rect, &g_wholescreen);
|
if (rect->w < g_wholescreen.w)
|
||||||
|
{
|
||||||
|
intersection.w = rect->w;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
intersection.w = g_wholescreen.w;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure that the clipped rectangle has a area */
|
if (rect->h < g_wholescreen.h)
|
||||||
|
{
|
||||||
|
intersection.h = rect->h;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
intersection.h = g_wholescreen.h;
|
||||||
|
}
|
||||||
|
|
||||||
if (!nxgl_nullrect(&intersection))
|
/* Make sure that the clipped rectangle has an area */
|
||||||
|
|
||||||
|
if (intersection.w && intersection.h)
|
||||||
{
|
{
|
||||||
/* Check for a whole screen update. The RealVNC client sends a lot
|
/* Check for a whole screen update. The RealVNC client sends a lot
|
||||||
* of these (especially when it is confused)
|
* of these (especially when it is confused)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
whupd = (memcmp(&intersection, &g_wholescreen,
|
whupd = (memcmp(&intersection, &g_wholescreen,
|
||||||
sizeof(struct nxgl_rect_s)) == 0);
|
sizeof(struct fb_area_s)) == 0);
|
||||||
|
|
||||||
/* Ignore any client update requests if there have been no changes to
|
/* Ignore any client update requests if there have been no changes to
|
||||||
* the framebuffer since the last whole screen update.
|
* the framebuffer since the last whole screen update.
|
||||||
@ -621,15 +633,15 @@ int vnc_update_rectangle(FAR struct vnc_session_s *session,
|
|||||||
/* Copy the clipped rectangle into the update structure */
|
/* Copy the clipped rectangle into the update structure */
|
||||||
|
|
||||||
update->whupd = whupd;
|
update->whupd = whupd;
|
||||||
nxgl_rectcopy(&update->rect, &intersection);
|
memcpy(&update->rect, &intersection, sizeof(intersection));
|
||||||
|
|
||||||
/* Add the update to the end of the update queue. */
|
/* Add the update to the end of the update queue. */
|
||||||
|
|
||||||
vnc_add_queue(session, update);
|
vnc_add_queue(session, update);
|
||||||
|
|
||||||
updinfo("Queued {(%d, %d),(%d, %d)}\n",
|
updinfo("Queued {(%d, %d),(%d, %d)}\n",
|
||||||
intersection.pt1.x, intersection.pt1.y,
|
intersection.x, intersection.y,
|
||||||
intersection.pt2.x, intersection.pt2.y);
|
intersection.w, intersection.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <nuttx/nx/nxglib.h>
|
#include <nuttx/nx/nxglib.h>
|
||||||
|
#include <nuttx/video/vnc.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -258,6 +259,49 @@ extern "C"
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nx_vnc_fbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This is just a wrapper around vnc_fbinitialize() that will establish
|
||||||
|
* the default mouse and keyboard callout functions.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* display - In the case of hardware with multiple displays, this
|
||||||
|
* specifies the display. Normally this is zero.
|
||||||
|
* handle - And instance of NXHANDLE returned from initialization of the
|
||||||
|
* NX graphics system for that display.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success. Otherwise, a negated errno value is
|
||||||
|
* returned to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* int nx_vnc_fbinitialize(int display, NXHANDLE handle); */
|
||||||
|
|
||||||
|
#if defined(CONFIG_NX_KBD) && defined(CONFIG_NX_XYINPUT)
|
||||||
|
|
||||||
|
# define nx_vnc_fbinitialize(d,h) \
|
||||||
|
vnc_fbinitialize((d), nx_kbdin, nx_mousein, (FAR void *)(h))
|
||||||
|
|
||||||
|
#elif defined(CONFIG_NX_KBD)
|
||||||
|
|
||||||
|
# define nx_vnc_fbinitialize(d,h) \
|
||||||
|
vnc_fbinitialize((d), nx_kbdin, NULL, (FAR void *)(h))
|
||||||
|
|
||||||
|
#elif defined(CONFIG_NX_XYINPUT)
|
||||||
|
|
||||||
|
# define nx_vnc_fbinitialize(d,h) \
|
||||||
|
vnc_fbinitialize((d), NULL, nx_mousein, (FAR void *)(h))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# define nx_vnc_fbinitialize(d,h) \
|
||||||
|
vnc_fbinitialize((d), NULL, NULL, NULL)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nx_runinstance (and nx_run macro)
|
* Name: nx_runinstance (and nx_run macro)
|
||||||
*
|
*
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <nuttx/nx/nxglib.h>
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -41,9 +39,9 @@
|
|||||||
* the inputs to nx_kbdin() and nx_mousein().
|
* the inputs to nx_kbdin() and nx_mousein().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef CODE void (*vnc_mouseout_t)(FAR void *arg, nxgl_coord_t x,
|
typedef CODE int (*vnc_mouseout_t)(FAR void *arg, int16_t x,
|
||||||
nxgl_coord_t y, uint8_t buttons);
|
int16_t y, uint8_t buttons);
|
||||||
typedef CODE void (*vnc_kbdout_t)(FAR void *arg, uint8_t nch,
|
typedef CODE int (*vnc_kbdout_t)(FAR void *arg, uint8_t nch,
|
||||||
FAR const uint8_t *ch);
|
FAR const uint8_t *ch);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -93,7 +91,7 @@ extern "C"
|
|||||||
* These higher level callouts can then call nx_kbdin() or nx_mousein() on
|
* These higher level callouts can then call nx_kbdin() or nx_mousein() on
|
||||||
* behalf of the VNC server.
|
* behalf of the VNC server.
|
||||||
*
|
*
|
||||||
* See also vnc_default_fbinitialize() below.
|
* See also nx_vnc_fbinitialize() in include/nuttx/nx/nx.h.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* display - In the case of hardware with multiple displays, this
|
* display - In the case of hardware with multiple displays, this
|
||||||
@ -116,79 +114,6 @@ extern "C"
|
|||||||
int vnc_fbinitialize(int display, vnc_kbdout_t kbdout,
|
int vnc_fbinitialize(int display, vnc_kbdout_t kbdout,
|
||||||
vnc_mouseout_t mouseout, FAR void *arg);
|
vnc_mouseout_t mouseout, FAR void *arg);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: vnc_mouse and vnc_kbdout
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* These are the default keyboard/mouse callout functions. They are
|
|
||||||
* simply wrappers around nx_mousein() and nx_kdbout(), respectively. When
|
|
||||||
* configured using vnc_fbinitialize(), the 'arg' must be the correct
|
|
||||||
* NXHANDLE value.
|
|
||||||
*
|
|
||||||
* See also vnc_default_fbinitialize() below.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* See vnc_mouseout_t and vnc_kbdout_t typde definitions above. These
|
|
||||||
* callouts have arguments that match the inputs to nx_kbdin() and
|
|
||||||
* nx_mousein() (if arg is really of type NXHANDLE).
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_NX_KBD
|
|
||||||
void vnc_kbdout(FAR void *arg, uint8_t nch, FAR const uint8_t *ch);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_NX_XYINPUT
|
|
||||||
void vnc_mouseout(FAR void *arg, nxgl_coord_t x, nxgl_coord_t y,
|
|
||||||
uint8_t buttons);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: vnc_default_fbinitialize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This is just a wrapper around vnc_fbinitialize() that will establish
|
|
||||||
* the default mouse and keyboard callout functions.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* display - In the case of hardware with multiple displays, this
|
|
||||||
* specifies the display. Normally this is zero.
|
|
||||||
* handle - And instance of NXHANDLE returned from initialization of the
|
|
||||||
* NX graphics system for that display.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is
|
|
||||||
* returned to indicate the nature of the failure.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* int vnc_default_fbinitialize(int display, NXHANDLE handle); */
|
|
||||||
|
|
||||||
#if defined(CONFIG_NX_KBD) && defined(CONFIG_NX_XYINPUT)
|
|
||||||
|
|
||||||
#define vnc_default_fbinitialize(d,h) \
|
|
||||||
vnc_fbinitialize((d), vnc_kbdout, vnc_mouseout, (FAR void *)(h))
|
|
||||||
|
|
||||||
#elif defined(CONFIG_NX_KBD)
|
|
||||||
|
|
||||||
#define vnc_default_fbinitialize(d,h) \
|
|
||||||
vnc_fbinitialize((d), vnc_kbdout, NULL, (FAR void *)(h))
|
|
||||||
|
|
||||||
#elif defined(CONFIG_NX_XYINPUT)
|
|
||||||
|
|
||||||
#define vnc_default_fbinitialize(d,h) \
|
|
||||||
vnc_fbinitialize((d), NULL, vnc_mouseout, (FAR void *)(h))
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define vnc_default_fbinitialize(d,h) \
|
|
||||||
vnc_fbinitialize((d), NULL, NULL, NULL)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@
|
|||||||
* ARG: A reference readable instance of struct
|
* ARG: A reference readable instance of struct
|
||||||
* boardioc_vncstart_s
|
* boardioc_vncstart_s
|
||||||
* CONFIGURATION: CONFIG_VNCSERVER
|
* CONFIGURATION: CONFIG_VNCSERVER
|
||||||
* DEPENDENCIES: VNC server provides vnc_default_fbinitialize()
|
* DEPENDENCIES: VNC server provides nx_vnc_fbinitialize()
|
||||||
*
|
*
|
||||||
* CMD: BOARDIOC_NXTERM
|
* CMD: BOARDIOC_NXTERM
|
||||||
* DESCRIPTION: Create an NX terminal device
|
* DESCRIPTION: Create an NX terminal device
|
||||||
|
Loading…
x
Reference in New Issue
Block a user