summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-15 11:24:43 (UTC)
committer alwin <alwin>2005-03-15 11:24:43 (UTC)
commit90d940ea8244140b25552bb8a28eacb7d3db01e8 (patch) (side-by-side diff)
tree5de47f91c534f8c034f101ee6344af104d4cd31d
parent81989dcd316065c2e72ecf43fc2cb8bfbf82763f (diff)
downloadopie-90d940ea8244140b25552bb8a28eacb7d3db01e8.zip
opie-90d940ea8244140b25552bb8a28eacb7d3db01e8.tar.gz
opie-90d940ea8244140b25552bb8a28eacb7d3db01e8.tar.bz2
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)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/serverapp.cpp16
-rw-r--r--core/launcher/serverapp.h2
2 files changed, 15 insertions, 3 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
@@ -141,13 +141,13 @@ void DesktopPowerAlerter::hideEvent( QHideEvent *e )
alertCount = 0;
currentPriority = INT_MAX;
}
//---------------------------------------------------------------------------
-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
qwsServer->setKeyboardFilter(this);
#endif
}
@@ -156,12 +156,13 @@ void KeyFilter::timerEvent(QTimerEvent* e)
{
if ( e->timerId() == held_tid ) {
killTimer(held_tid);
// button held
if ( heldButton ) {
emit activate(heldButton, TRUE);
+ firedHeldButton = heldButton;
heldButton = 0;
}
held_tid = 0;
}
}
@@ -199,31 +200,42 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe
&& keycode != Key_Left
&& keycode != Key_Right
&& keycode != Key_Up
&& keycode != Key_Down )
return TRUE;
+// odebug << " KeyFilter::checkButtonAction("<<db<<","<<keycode<<","<<press<<","<<autoRepeat<<")"<<oendl;
/* check if it was registered */
if (!db ) {
if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) )
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 (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;
+ }
if ( button->heldAction().isNull() ) {
if ( press )
emit activate(button, FALSE);
} else if ( press ) {
+ if (heldButton != button) {
heldButton = button;
held_tid = startTimer( ODevice::inst ()->buttonHoldTime () );
+ }
} else if ( heldButton ) {
heldButton = 0;
emit activate(button, FALSE);
}
QWSServer::screenSaverActivate(FALSE);
return TRUE;
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
@@ -78,13 +78,13 @@ signals:
void activate(const Opie::Core::ODeviceButton*,bool);
private:
bool keyRegistered( int key );
int held_tid;
- const Opie::Core::ODeviceButton* heldButton;
+ const Opie::Core::ODeviceButton* heldButton,*firedHeldButton;
KeyRegisterList m_keys;
};
class ServerApplication : public Opie::Core::OApplication
{
Q_OBJECT