VNC: Add default mouse/keyboard input handlers

This commit is contained in:
Gregory Nutt
2016-04-22 12:48:27 -06:00
parent 3527a5a5d7
commit 47c2b3d4a7
3 changed files with 130 additions and 0 deletions
+75
View File
@@ -108,6 +108,8 @@ extern "C"
* higher level level callouts can then call nx_kbdin() or nx_mousein() on
* behalf of the VNC server.
*
* See also vnc_default_fbinitialize() below.
*
* Parameters:
* display - In the case of hardware with multiple displays, this
* specifies the display. Normally this is zero.
@@ -129,6 +131,79 @@ extern "C"
int vnc_fbinitialize(int display, vnc_kbdout_t kbdout,
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
#ifdef __cplusplus
}