From 90d940ea8244140b25552bb8a28eacb7d3db01e8 Mon Sep 17 00:00:00 2001 From: alwin Date: Tue, 15 Mar 2005 11:24:43 +0000 Subject: setup a workaround for missing autorepeat flag on specialbuttons. eg, keyfilter of serverapp stores the last pressed button itself and checks against holdtime and releases itself. on c7x0/c8x0 it works with 2.6 kernel cause keys are repeated without this flag - on 2.4 kernel I don't know what happen (may that keys are not repeated) --- (limited to 'core/launcher') 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 @@ -144,7 +144,7 @@ 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 */ #if 0 @@ -159,6 +159,7 @@ void KeyFilter::timerEvent(QTimerEvent* e) // button held if ( heldButton ) { emit activate(heldButton, TRUE); + firedHeldButton = heldButton; heldButton = 0; } held_tid = 0; @@ -202,16 +203,25 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe && keycode != Key_Down ) return TRUE; +// odebug << " KeyFilter::checkButtonAction("<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; } @@ -219,8 +229,10 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe if ( press ) 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; emit activate(button, FALSE); 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 @@ -81,7 +81,7 @@ signals: private: bool keyRegistered( int key ); int held_tid; - const Opie::Core::ODeviceButton* heldButton; + const Opie::Core::ODeviceButton* heldButton,*firedHeldButton; KeyRegisterList m_keys; }; -- cgit v0.9.0.2