summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_mypal.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opiecore/device/odevice_mypal.cpp b/libopie2/opiecore/device/odevice_mypal.cpp
index 208be46..73b31cb 100644
--- a/libopie2/opiecore/device/odevice_mypal.cpp
+++ b/libopie2/opiecore/device/odevice_mypal.cpp
@@ -124,67 +124,67 @@ void MyPal::initButtons()
if (( mb->model & d->m_model ) == d->m_model ) {
b. setKeycode ( mb->code );
b. setUserText ( QObject::tr ( "Button", mb->utext ));
b. setPixmap ( OResource::loadPixmap ( mb->pix ));
b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( mb->fpressedservice ), mb->fpressedaction ));
b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( mb->fheldservice ), mb->fheldaction ));
d->m_buttons->append ( b );
}
}
reloadButtonMapping();
}
bool MyPal::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
{
int newkeycode = keycode;
switch ( keycode ) {
case Key_Left :
case Key_Right:
case Key_Up :
case Key_Down : {
// Rotate the cursor keys by 270
// keycode - Key_Left = position of the button starting from left clockwise
// add the rotation to it and modolo. No we've the original offset
// add the offset to the Key_Left key
if ( d->m_model == Model_MyPal_716 )
newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4;
break;
}
- // map Power Button short/long press to F6
- case Key_F6: {
- if ( isPress ) {
+ // map Power Button short/long press
+ case HardKey_Suspend: { // Hope we don't have infinite recursion here:
+ if ( isPress ) {
if ( m_power_timer )
killTimer ( m_power_timer );
m_power_timer = startTimer ( 500 );
}
else if ( m_power_timer ) {
killTimer ( m_power_timer );
m_power_timer = 0;
QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
}
newkeycode = Key_unknown;
break;
}
}
if ( newkeycode != keycode ) {
if ( newkeycode != Key_unknown )
QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
return true;
}
else
return false;
}
void MyPal::timerEvent ( QTimerEvent * )
{
killTimer ( m_power_timer );
m_power_timer = 0;
QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
}