Diffstat (limited to 'libopie2/opiecore/oinputsystem.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/oinputsystem.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libopie2/opiecore/oinputsystem.cpp b/libopie2/opiecore/oinputsystem.cpp index 29de35c..d1a28f5 100644 --- a/libopie2/opiecore/oinputsystem.cpp +++ b/libopie2/opiecore/oinputsystem.cpp | |||
@@ -147,13 +147,16 @@ QString OInputDevice::uniq() const | |||
147 | 147 | ||
148 | bool OInputDevice::hasFeature( Feature bit ) const | 148 | bool OInputDevice::hasFeature( Feature bit ) const |
149 | { | 149 | { |
150 | BIT_MASK( features, EV_MAX ); | 150 | BIT_MASK( features, EV_MAX ); |
151 | 151 | ||
152 | if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) | 152 | if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 ) |
153 | { | ||
154 | perror( "EVIOCGBIT" ); | ||
153 | return false; | 155 | return false; |
156 | } | ||
154 | else | 157 | else |
155 | return BIT_TEST( features, bit ); | 158 | return BIT_TEST( features, bit ); |
156 | } | 159 | } |
157 | 160 | ||
158 | 161 | ||
159 | bool OInputDevice::isHeld( Key bit ) const | 162 | bool OInputDevice::isHeld( Key bit ) const |
@@ -167,6 +170,28 @@ bool OInputDevice::isHeld( Key bit ) const | |||
167 | } | 170 | } |
168 | else | 171 | else |
169 | { | 172 | { |
170 | return BIT_TEST( keys, bit ); | 173 | return BIT_TEST( keys, bit ); |
171 | } | 174 | } |
172 | } | 175 | } |
176 | |||
177 | |||
178 | QString OInputDevice::globalKeyMask() const | ||
179 | { | ||
180 | BIT_MASK( keys, KEY_MAX ); | ||
181 | |||
182 | if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 ) | ||
183 | { | ||
184 | perror( "EVIOCGKEY" ); | ||
185 | } | ||
186 | else | ||
187 | { | ||
188 | QString keymask; | ||
189 | for ( int i = 0; i < KEY_MAX; ++i ) | ||
190 | { | ||
191 | if ( BIT_TEST( keys, i ) ) keymask.append( QString().sprintf( "%0d, ", i ) ); | ||
192 | } | ||
193 | return keymask; | ||
194 | |||
195 | } | ||
196 | } | ||
197 | |||