-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 | |||
@@ -141,13 +141,13 @@ void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | |||
141 | alertCount = 0; | 141 | alertCount = 0; |
142 | currentPriority = INT_MAX; | 142 | currentPriority = INT_MAX; |
143 | } | 143 | } |
144 | 144 | ||
145 | //--------------------------------------------------------------------------- | 145 | //--------------------------------------------------------------------------- |
146 | 146 | ||
147 | KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0) | 147 | KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0),firedHeldButton(0) |
148 | { | 148 | { |
149 | /* We don't do this cause it would interfere with ODevice */ | 149 | /* We don't do this cause it would interfere with ODevice */ |
150 | #if 0 | 150 | #if 0 |
151 | qwsServer->setKeyboardFilter(this); | 151 | qwsServer->setKeyboardFilter(this); |
152 | #endif | 152 | #endif |
153 | } | 153 | } |
@@ -156,12 +156,13 @@ void KeyFilter::timerEvent(QTimerEvent* e) | |||
156 | { | 156 | { |
157 | if ( e->timerId() == held_tid ) { | 157 | if ( e->timerId() == held_tid ) { |
158 | killTimer(held_tid); | 158 | killTimer(held_tid); |
159 | // button held | 159 | // button held |
160 | if ( heldButton ) { | 160 | if ( heldButton ) { |
161 | emit activate(heldButton, TRUE); | 161 | emit activate(heldButton, TRUE); |
162 | firedHeldButton = heldButton; | ||
162 | heldButton = 0; | 163 | heldButton = 0; |
163 | } | 164 | } |
164 | held_tid = 0; | 165 | held_tid = 0; |
165 | } | 166 | } |
166 | } | 167 | } |
167 | 168 | ||
@@ -199,31 +200,42 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe | |||
199 | && keycode != Key_Left | 200 | && keycode != Key_Left |
200 | && keycode != Key_Right | 201 | && keycode != Key_Right |
201 | && keycode != Key_Up | 202 | && keycode != Key_Up |
202 | && keycode != Key_Down ) | 203 | && keycode != Key_Down ) |
203 | return TRUE; | 204 | return TRUE; |
204 | 205 | ||
206 | // odebug << " KeyFilter::checkButtonAction("<<db<<","<<keycode<<","<<press<<","<<autoRepeat<<")"<<oendl; | ||
205 | /* check if it was registered */ | 207 | /* check if it was registered */ |
206 | if (!db ) { | 208 | if (!db ) { |
207 | if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) ) | 209 | if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) ) |
208 | return true; | 210 | return true; |
209 | } else { | 211 | } else { |
210 | |||
211 | // First check to see if DeviceButtonManager knows something about this button: | 212 | // First check to see if DeviceButtonManager knows something about this button: |
212 | const ODeviceButton* button = ODevice::inst()->buttonForKeycode(keycode); | 213 | const ODeviceButton* button = ODevice::inst()->buttonForKeycode(keycode); |
213 | if (button && !autoRepeat) { | 214 | if (button && !autoRepeat) { |
214 | if ( held_tid ) { | 215 | if (firedHeldButton) { |
216 | if (held_tid) { | ||
217 | killTimer(held_tid); | ||
218 | held_tid = 0; | ||
219 | } | ||
220 | if (!press && button == firedHeldButton) { | ||
221 | firedHeldButton = 0; | ||
222 | return TRUE; | ||
223 | } | ||
224 | } else if ( held_tid && heldButton != button) { | ||
215 | killTimer(held_tid); | 225 | killTimer(held_tid); |
216 | held_tid = 0; | 226 | held_tid = 0; |
217 | } | 227 | } |
218 | if ( button->heldAction().isNull() ) { | 228 | if ( button->heldAction().isNull() ) { |
219 | if ( press ) | 229 | if ( press ) |
220 | emit activate(button, FALSE); | 230 | emit activate(button, FALSE); |
221 | } else if ( press ) { | 231 | } else if ( press ) { |
222 | heldButton = button; | 232 | if (heldButton != button) { |
223 | held_tid = startTimer( ODevice::inst ()->buttonHoldTime () ); | 233 | heldButton = button; |
234 | held_tid = startTimer( ODevice::inst ()->buttonHoldTime () ); | ||
235 | } | ||
224 | } else if ( heldButton ) { | 236 | } else if ( heldButton ) { |
225 | heldButton = 0; | 237 | heldButton = 0; |
226 | emit activate(button, FALSE); | 238 | emit activate(button, FALSE); |
227 | } | 239 | } |
228 | QWSServer::screenSaverActivate(FALSE); | 240 | QWSServer::screenSaverActivate(FALSE); |
229 | return TRUE; | 241 | 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: | |||
78 | void activate(const Opie::Core::ODeviceButton*,bool); | 78 | void activate(const Opie::Core::ODeviceButton*,bool); |
79 | 79 | ||
80 | 80 | ||
81 | private: | 81 | private: |
82 | bool keyRegistered( int key ); | 82 | bool keyRegistered( int key ); |
83 | int held_tid; | 83 | int held_tid; |
84 | const Opie::Core::ODeviceButton* heldButton; | 84 | const Opie::Core::ODeviceButton* heldButton,*firedHeldButton; |
85 | KeyRegisterList m_keys; | 85 | KeyRegisterList m_keys; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | class ServerApplication : public Opie::Core::OApplication | 88 | class ServerApplication : public Opie::Core::OApplication |
89 | { | 89 | { |
90 | Q_OBJECT | 90 | Q_OBJECT |