From 93f9fcf5bbcecaf8c7c4070e42676d24caa12d87 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Fri, 04 Feb 2005 14:39:34 +0000 Subject: - add definitions for keys and buttons - add isHeld( Key ) --- (limited to 'libopie2/opiecore/oinputsystem.cpp') 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 ); + } +} -- cgit v0.9.0.2