-rw-r--r-- | core/launcher/serverapp.cpp | 22 | ||||
-rw-r--r-- | core/launcher/serverapp.h | 2 |
2 files changed, 18 insertions, 6 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index 75d4ac1..6fe0479 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp @@ -145,5 +145,5 @@ void DesktopPowerAlerter::hideEvent( QHideEvent *e ) //--------------------------------------------------------------------------- -KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0) +KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0),firedHeldButton(0) { /* We don't do this cause it would interfere with ODevice */ @@ -160,4 +160,5 @@ void KeyFilter::timerEvent(QTimerEvent* e) if ( heldButton ) { emit activate(heldButton, TRUE); + firedHeldButton = heldButton; heldButton = 0; } @@ -203,4 +204,5 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe return TRUE; +// odebug << " KeyFilter::checkButtonAction("<<db<<","<<keycode<<","<<press<<","<<autoRepeat<<")"<<oendl; /* check if it was registered */ if (!db ) { @@ -208,9 +210,17 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe return true; } else { - // First check to see if DeviceButtonManager knows something about this button: const ODeviceButton* button = ODevice::inst()->buttonForKeycode(keycode); if (button && !autoRepeat) { - if ( held_tid ) { + if (firedHeldButton) { + if (held_tid) { + killTimer(held_tid); + held_tid = 0; + } + if (!press && button == firedHeldButton) { + firedHeldButton = 0; + return TRUE; + } + } else if ( held_tid && heldButton != button) { killTimer(held_tid); held_tid = 0; @@ -220,6 +230,8 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe emit activate(button, FALSE); } else if ( press ) { - heldButton = button; - held_tid = startTimer( ODevice::inst ()->buttonHoldTime () ); + if (heldButton != button) { + heldButton = button; + held_tid = startTimer( ODevice::inst ()->buttonHoldTime () ); + } } else if ( heldButton ) { heldButton = 0; diff --git a/core/launcher/serverapp.h b/core/launcher/serverapp.h index 27be28b..98c5633 100644 --- a/core/launcher/serverapp.h +++ b/core/launcher/serverapp.h @@ -82,5 +82,5 @@ private: bool keyRegistered( int key ); int held_tid; - const Opie::Core::ODeviceButton* heldButton; + const Opie::Core::ODeviceButton* heldButton,*firedHeldButton; KeyRegisterList m_keys; }; |