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) (unidiff)
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
144 return buf; 144 return buf;
145} 145}
146 146
147
147bool OInputDevice::hasFeature( Feature bit ) const 148bool OInputDevice::hasFeature( Feature bit ) const
148{ 149{
149 BIT_MASK( features, EV_MAX ); 150 BIT_MASK( features, EV_MAX );
@@ -154,3 +155,18 @@ bool OInputDevice::hasFeature( Feature bit ) const
154 return BIT_TEST( features, bit ); 155 return BIT_TEST( features, bit );
155} 156}
156 157
158
159bool OInputDevice::isHeld( Key bit ) const
160{
161 BIT_MASK( keys, KEY_MAX );
162
163 if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 )
164 {
165 perror( "EVIOCGKEY" );
166 return false;
167 }
168 else
169 {
170 return BIT_TEST( keys, bit );
171 }
172}