summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oinputsystem.cpp
authormickeyl <mickeyl>2005-02-04 14:39:34 (UTC)
committer mickeyl <mickeyl>2005-02-04 14:39:34 (UTC)
commit93f9fcf5bbcecaf8c7c4070e42676d24caa12d87 (patch) (side-by-side diff)
treeccd643cf2cdf2d211b5cba4d09e9cc6b9dbec381 /libopie2/opiecore/oinputsystem.cpp
parent43213784ac3b6057f8c83f22604d75d0557e8c5a (diff)
downloadopie-93f9fcf5bbcecaf8c7c4070e42676d24caa12d87.zip
opie-93f9fcf5bbcecaf8c7c4070e42676d24caa12d87.tar.gz
opie-93f9fcf5bbcecaf8c7c4070e42676d24caa12d87.tar.bz2
- add definitions for keys and buttons
- add isHeld( Key )
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
@@ -144,6 +144,7 @@ QString OInputDevice::uniq() const
return buf;
}
+
bool OInputDevice::hasFeature( Feature bit ) const
{
BIT_MASK( features, EV_MAX );
@@ -154,3 +155,18 @@ bool OInputDevice::hasFeature( Feature bit ) const
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 );
+ }
+}