summaryrefslogtreecommitdiff
path: root/library/qpemenubar.cpp
authorsandman <sandman>2002-12-22 23:59:13 (UTC)
committer sandman <sandman>2002-12-22 23:59:13 (UTC)
commitc513f413c7d901cc9945714c8e7eb47292f63306 (patch) (unidiff)
tree9ce6af28225f006dffbeb536eb2fd520e903e08d /library/qpemenubar.cpp
parent5c7694a7baadec8afe128ad2541e0a8acfc23737 (diff)
downloadopie-c513f413c7d901cc9945714c8e7eb47292f63306.zip
opie-c513f413c7d901cc9945714c8e7eb47292f63306.tar.gz
opie-c513f413c7d901cc9945714c8e7eb47292f63306.tar.bz2
Totally reworked the key grabbing, which always had problems:
- applications get *all* key events now, as long as they have the focus - an application decides if it has the keyboard grabbed or not - if it's grabbed, the app consumes the key press - if it's not grabbed and a F1-F29 key is pressed, the app sends a QCop call to the launcher (deviceButtonPressed(...)) - when the launcher receives a QCop deviceButtonPressed it simply sends the configured QCopEnvelope - all "special" actions (like menu, home) are now accessible via QCop calls (see buttonsettings)
Diffstat (limited to 'library/qpemenubar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpemenubar.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/library/qpemenubar.cpp b/library/qpemenubar.cpp
index 4aa0bf3..3e5bad5 100644
--- a/library/qpemenubar.cpp
+++ b/library/qpemenubar.cpp
@@ -204,52 +204,48 @@ bool QPEMenuToolFocusManager::eventFilter( QObject *object, QEvent *event )
204 QMenuBarHack *mb = (QMenuBarHack *)object; 204 QMenuBarHack *mb = (QMenuBarHack *)object;
205 if ( dx && mb->activeItem() >= 0 ) { 205 if ( dx && mb->activeItem() >= 0 ) {
206 int i = mb->activeItem(); 206 int i = mb->activeItem();
207 int c = mb->count(); 207 int c = mb->count();
208 int n = c; 208 int n = c;
209 while ( n-- ) { 209 while ( n-- ) {
210 i = i + dx; 210 i = i + dx;
211 if ( i == c ) { 211 if ( i == c ) {
212 mb->goodbye(); 212 mb->goodbye();
213 moveFocus( TRUE ); 213 moveFocus( TRUE );
214 return TRUE; 214 return TRUE;
215 } else if ( i < 0 ) { 215 } else if ( i < 0 ) {
216 mb->goodbye(); 216 mb->goodbye();
217 moveFocus( FALSE ); 217 moveFocus( FALSE );
218 return TRUE; 218 return TRUE;
219 } 219 }
220 QMenuItem *mi = mb->findItem( mb->idAt(i) ); 220 QMenuItem *mi = mb->findItem( mb->idAt(i) );
221 if ( mi->isEnabled() && !mi->isSeparator() ) { 221 if ( mi->isEnabled() && !mi->isSeparator() ) {
222 break; 222 break;
223 } 223 }
224 } 224 }
225 } 225 }
226 } 226 }
227 } 227 }
228 if ( ke->key() == Key_F11 ) {
229 setActive( !isActive() );
230 return TRUE;
231 }
232 } else if ( event->type() == QEvent::KeyRelease ) { 228 } else if ( event->type() == QEvent::KeyRelease ) {
233 QKeyEvent *ke = (QKeyEvent *)event; 229 QKeyEvent *ke = (QKeyEvent *)event;
234 if ( isActive() ) { 230 if ( isActive() ) {
235 if ( object->inherits( "QButton" ) ) { 231 if ( object->inherits( "QButton" ) ) {
236 // Deactivate when a button is selected 232 // Deactivate when a button is selected
237 if ( ke->key() == Key_Space ) 233 if ( ke->key() == Key_Space )
238 QTimer::singleShot( 0, this, SLOT(deactivate()) ); 234 QTimer::singleShot( 0, this, SLOT(deactivate()) );
239 } 235 }
240 } 236 }
241 } else if ( event->type() == QEvent::FocusIn ) { 237 } else if ( event->type() == QEvent::FocusIn ) {
242 if ( isActive() ) { 238 if ( isActive() ) {
243 // A non-menu/tool widget has been selected - we're deactivated 239 // A non-menu/tool widget has been selected - we're deactivated
244 QWidget *w = (QWidget *)object; 240 QWidget *w = (QWidget *)object;
245 if ( !w->isPopup() && !list.contains( GuardedWidget( w ) ) ) { 241 if ( !w->isPopup() && !list.contains( GuardedWidget( w ) ) ) {
246 inFocus = 0; 242 inFocus = 0;
247 } 243 }
248 } 244 }
249 } else if ( event->type() == QEvent::Hide ) { 245 } else if ( event->type() == QEvent::Hide ) {
250 if ( isActive() ) { 246 if ( isActive() ) {
251 // Deaticvate if a menu/tool has been hidden 247 // Deaticvate if a menu/tool has been hidden
252 QWidget *w = (QWidget *)object; 248 QWidget *w = (QWidget *)object;
253 if ( !w->isPopup() && !list.contains( GuardedWidget( w ) ) ) { 249 if ( !w->isPopup() && !list.contains( GuardedWidget( w ) ) ) {
254 setActive( FALSE ); 250 setActive( FALSE );
255 } 251 }