VNC: Add default mouse/keyboard input handlers
This commit is contained in:
parent
3527a5a5d7
commit
47c2b3d4a7
@ -48,6 +48,8 @@
|
|||||||
#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/input/x11_keysymdef.h>
|
#include <nuttx/input/x11_keysymdef.h>
|
||||||
#include <nuttx/input/kbd_codec.h>
|
#include <nuttx/input/kbd_codec.h>
|
||||||
|
|
||||||
@ -627,4 +629,26 @@ void vnc_key_map(FAR struct vnc_session_s *session, uint16_t keysym,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: 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.
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
(void)nx_kbdin((NXHANDLE)arg, nch, ch);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NX_KBD */
|
#endif /* CONFIG_NX_KBD */
|
@ -49,6 +49,9 @@
|
|||||||
|
|
||||||
#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/nx/nx.h>
|
||||||
|
#include <nuttx/nx/nxglib.h>
|
||||||
|
|
||||||
#include "vnc_server.h"
|
#include "vnc_server.h"
|
||||||
|
|
||||||
@ -470,3 +473,31 @@ int vnc_client_encodings(FAR struct vnc_session_s *session,
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: 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.
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
(void)nx_mousein((NXHANDLE)arg, x, y, buttons);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -108,6 +108,8 @@ extern "C"
|
|||||||
* higher level level callouts can then call nx_kbdin() or nx_mousein() on
|
* higher level 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.
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* display - In the case of hardware with multiple displays, this
|
* display - In the case of hardware with multiple displays, this
|
||||||
* specifies the display. Normally this is zero.
|
* specifies the display. Normally this is zero.
|
||||||
@ -129,6 +131,79 @@ 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);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: vnc_default_fbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This is just a wrapper around vnc_fbinitialize() that will establish
|
||||||
|
* the default mouse and keyboard callout functions.
|
||||||
|
*
|
||||||
|
* 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(nt 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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user