summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oinputsystem.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/oinputsystem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oinputsystem.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libopie2/opiecore/oinputsystem.cpp b/libopie2/opiecore/oinputsystem.cpp
index 8253c18..29de35c 100644
--- a/libopie2/opiecore/oinputsystem.cpp
+++ b/libopie2/opiecore/oinputsystem.cpp
@@ -141,16 +141,32 @@ QString OInputDevice::uniq() const
{
char buf[BUFSIZE] = "<unknown>";
::ioctl( _fd, EVIOCGUNIQ(sizeof buf), buf );
return buf;
}
+
bool OInputDevice::hasFeature( Feature bit ) const
{
BIT_MASK( features, EV_MAX );
if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 )
return false;
else
return BIT_TEST( features, bit );
}
+
+bool OInputDevice::isHeld( Key bit ) const
+{
+ BIT_MASK( keys, KEY_MAX );
+
+ if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 )
+ {
+ perror( "EVIOCGKEY" );
+ return false;
+ }
+ else
+ {
+ return BIT_TEST( keys, bit );
+ }
+}