apps/graphics/twm4nx: Add option to use touschreen instead of mouse input.
This commit is contained in:
parent
f3b3d1fc72
commit
afbb51eb1e
@ -81,7 +81,7 @@ config TWM4NX_NOKEYBOARD
|
||||
environment (it is also used if VNC is selected)
|
||||
|
||||
config TWM4NX_NOMOUSE
|
||||
bool "Disable mouse"
|
||||
bool "Disable mouse/touchscreen"
|
||||
default n
|
||||
---help---
|
||||
Normally you would never disable mouse input. That would make using
|
||||
@ -89,6 +89,24 @@ config TWM4NX_NOMOUSE
|
||||
debugging Twm4Nx bringup in a simpler environment (it is also used
|
||||
if VNC is selected)
|
||||
|
||||
choice
|
||||
prompt "Position device"
|
||||
default TWM4NX_MOUSE
|
||||
depends on !TWM4NX_NOMOUSE
|
||||
|
||||
config TWM4NX_MOUSE
|
||||
bool "Mouse"
|
||||
|
||||
config TWM4NX_TOUCHSCREEN
|
||||
bool "Touchscreen"
|
||||
|
||||
endchoice # Position device
|
||||
|
||||
config TWM4NX_MOUSE_DEVPATH
|
||||
string "Path to input device"
|
||||
default "/dev/mouse0" if TWM4NX_MOUSE
|
||||
default "/dev/input0" if TWM4NX_TOUCHSCREEN
|
||||
|
||||
config TWM4NX_DEBUG
|
||||
bool "Force debug output"
|
||||
default n
|
||||
|
@ -49,6 +49,11 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#ifdef CONFIG_TWM4NX_MOUSE
|
||||
# include <nuttx/input/mouse.h>
|
||||
#else
|
||||
# include <nuttx/input/touchscreen.h>
|
||||
#endif
|
||||
|
||||
#include "graphics/twm4nx/twm4nx_config.hxx"
|
||||
#include "graphics/twm4nx/ctwm4nx.hxx"
|
||||
@ -235,7 +240,7 @@ int CInput::keyboardOpen(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the mouse input devices. Not very interesting for the
|
||||
* Open the mouse/touchscreen input devices. Not very interesting for the
|
||||
* case of standard character device but much more interesting for
|
||||
* USB mouse devices that may disappear when disconnected but later
|
||||
* reappear when reconnected. In this case, this function will
|
||||
@ -373,11 +378,12 @@ int CInput::keyboardInput(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from the mouse device, update the cursor position, and
|
||||
* inject the mouse data into NX for proper distribution.
|
||||
* Read data from the mouse/touchscreen device. if the input device is a
|
||||
* mouse, then update the cursor position. And, in either case, inject
|
||||
* the mouse data into NX for proper distribution.
|
||||
*
|
||||
* @return On success, then method returns a valid file descriptor. A
|
||||
* negated errno value is returned if an irrecoverable error occurs.
|
||||
* @return On success, then method returns zero (OK). A negated errno
|
||||
* value is returned if an irrecoverable error occurs.
|
||||
*/
|
||||
|
||||
int CInput::mouseInput(void)
|
||||
|
@ -112,7 +112,7 @@ namespace Twm4Nx
|
||||
inline int keyboardOpen(void);
|
||||
|
||||
/**
|
||||
* Open the mouse input devices. Not very interesting for the
|
||||
* Open the mouse/touchscreen input device. Not very interesting for the
|
||||
* case of standard character device but much more interesting for
|
||||
* USB mouse devices that may disappear when disconnected but later
|
||||
* reappear when reconnected. In this case, this function will
|
||||
@ -138,11 +138,12 @@ namespace Twm4Nx
|
||||
inline int keyboardInput(void);
|
||||
|
||||
/**
|
||||
* Read data from the mouse device, update the cursor position, and
|
||||
* Read data from the mouse/touchscreen device. if the input device
|
||||
* is a mouse, then update the cursor position. And, in either case,
|
||||
* inject the mouse data into NX for proper distribution.
|
||||
*
|
||||
* @return On success, then method returns a valid file descriptor. A
|
||||
* negated errno value is returned if an irrecoverable error occurs.
|
||||
* @return On success, then method returns zero (OK). A negated errno
|
||||
* value is returned if an irrecoverable error occurs.
|
||||
*/
|
||||
|
||||
inline int mouseInput(void);
|
||||
|
@ -425,6 +425,8 @@
|
||||
* Mouse device settings
|
||||
*
|
||||
* CONFIG_TWM4NX_NOMOUSE - Can be used to disable mouse input.
|
||||
* CONFIG_TWM4NX_MOUSE - Input is from a mouse.
|
||||
* CONFIG_TWM4NX_TOUSCREEN - Input is from a touchscreen.
|
||||
* CONFIG_TWM4NX_MOUSE_DEVPATH - The full path to the mouse device.
|
||||
* Default: "/dev/console"
|
||||
* CONFIG_TWM4NX_MOUSE_USBHOST - Indicates the the mouse is attached via
|
||||
@ -434,11 +436,19 @@
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_TWM4NX_MOUSE_DEVPATH
|
||||
# define CONFIG_TWM4NX_MOUSE_DEVPATH "/dev/mouse0"
|
||||
# ifdef CONFIG_TWM4NX_MOUSE
|
||||
# define CONFIG_TWM4NX_MOUSE_DEVPATH "/dev/mouse0"
|
||||
# else
|
||||
# define CONFIG_TWM4NX_MOUSE_DEVPATH "/dev/input0"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TWM4NX_MOUSE_BUFSIZE
|
||||
# define CONFIG_TWM4NX_MOUSE_BUFSIZE sizeof(struct mouse_report_s)
|
||||
# ifdef CONFIG_TWM4NX_MOUSE
|
||||
# define CONFIG_TWM4NX_MOUSE_BUFSIZE sizeof(struct mouse_report_s)
|
||||
# else
|
||||
# define CONFIG_TWM4NX_MOUSE_BUFSIZE sizeof(SIZEOF_TOUCH_SAMPLE_S(1))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Keyboard device ///////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user