author | groucho <groucho> | 2003-03-22 09:21:03 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-03-22 09:21:03 (UTC) |
commit | f462ccd5ad11da7bddfa627d4773e3b02f18e2b8 (patch) (unidiff) | |
tree | ba1250690fe416d01802059117107391fecb0d88 | |
parent | 32458f9d70e8b13a7e8ff46c06af17860c218f23 (diff) | |
download | opie-f462ccd5ad11da7bddfa627d4773e3b02f18e2b8.zip opie-f462ccd5ad11da7bddfa627d4773e3b02f18e2b8.tar.gz opie-f462ccd5ad11da7bddfa627d4773e3b02f18e2b8.tar.bz2 |
Bug fix- Key presess are now routed up to the QPEApplication event queue if ignore is defined for a certain key
-rw-r--r-- | core/launcher/desktop.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index fbcce7c..86527f6 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -329,79 +329,84 @@ void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray | |||
329 | stream >> k >> c >> m; | 329 | stream >> k >> c >> m; |
330 | 330 | ||
331 | keyRegisterList.append ( QCopKeyRegister ( k, c, m )); | 331 | keyRegisterList.append ( QCopKeyRegister ( k, c, m )); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | void DesktopApplication::sendHeldAction ( ) | 335 | void DesktopApplication::sendHeldAction ( ) |
336 | { | 336 | { |
337 | if ( m_last_button ) { | 337 | if ( m_last_button ) { |
338 | m_last_button-> heldAction ( ). send ( ); | 338 | m_last_button-> heldAction ( ). send ( ); |
339 | m_last_button = 0; | 339 | m_last_button = 0; |
340 | } | 340 | } |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | 344 | ||
345 | bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) | 345 | bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) |
346 | { | 346 | { |
347 | if ( db ) { | 347 | if ( db ) { |
348 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { | 348 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { |
349 | m_button_timer-> stop ( ); | 349 | m_button_timer-> stop ( ); |
350 | 350 | ||
351 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) | 351 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) |
352 | { | 352 | { |
353 | |||
353 | if ( db-> pressedAction ( ). channel ( )!="ignore") { | 354 | if ( db-> pressedAction ( ). channel ( )!="ignore") { |
355 | |||
354 | db-> pressedAction ( ). send ( ); | 356 | db-> pressedAction ( ). send ( ); |
355 | } | 357 | } |
356 | else return false; | 358 | else |
359 | return false; | ||
357 | } | 360 | } |
358 | } | 361 | } |
359 | else if ( press && !autoRepeat ) { | 362 | else if ( press && !autoRepeat ) { |
360 | m_button_timer-> stop ( ); | 363 | m_button_timer-> stop ( ); |
361 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) | 364 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) |
362 | { | 365 | { |
363 | 366 | ||
364 | if ( db-> heldAction ( ). channel ( )!="ignore") { | 367 | if ( db-> heldAction ( ). channel ( )!="ignore") { |
365 | m_last_button = db; | 368 | m_last_button = db; |
366 | m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); | 369 | m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); |
367 | } | 370 | } |
368 | else return false; | 371 | else return false; |
369 | } | 372 | } |
370 | } | 373 | } |
371 | } | 374 | } |
372 | return true; | 375 | return true; |
373 | } | 376 | } |
374 | 377 | ||
375 | bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) | 378 | bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) |
376 | { | 379 | { |
380 | |||
377 | if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { | 381 | if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { |
378 | QKeyEvent *ke = (QKeyEvent *) e; | 382 | QKeyEvent *ke = (QKeyEvent *) e; |
379 | 383 | ||
380 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); | 384 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); |
381 | 385 | ||
382 | if ( db ) { | 386 | if ( db ) { |
383 | return checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( )); | 387 | if (checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( ))) |
388 | return true; //checkButtonAction retrune false if events should be routed through | ||
384 | } | 389 | } |
385 | } | 390 | } |
386 | return QPEApplication::eventFilter ( o, e ); | 391 | return QPEApplication::eventFilter ( o, e ); |
387 | } | 392 | } |
388 | 393 | ||
389 | #ifdef Q_WS_QWS | 394 | #ifdef Q_WS_QWS |
390 | 395 | ||
391 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 396 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
392 | { | 397 | { |
393 | qpedesktop->checkMemory(); | 398 | qpedesktop->checkMemory(); |
394 | 399 | ||
395 | if ( e->type == QWSEvent::Key ) { | 400 | if ( e->type == QWSEvent::Key ) { |
396 | QWSKeyEvent * ke = (QWSKeyEvent *) e; | 401 | QWSKeyEvent * ke = (QWSKeyEvent *) e; |
397 | ushort keycode = ke-> simpleData. keycode; | 402 | ushort keycode = ke-> simpleData. keycode; |
398 | 403 | ||
399 | if ( !loggedin && keycode != Key_F34 ) | 404 | if ( !loggedin && keycode != Key_F34 ) |
400 | return true; | 405 | return true; |
401 | 406 | ||
402 | bool press = ke-> simpleData. is_press; | 407 | bool press = ke-> simpleData. is_press; |
403 | bool autoRepeat = ke-> simpleData. is_auto_repeat; | 408 | bool autoRepeat = ke-> simpleData. is_auto_repeat; |
404 | 409 | ||
405 | if ( !keyboardGrabbed ( )) { | 410 | if ( !keyboardGrabbed ( )) { |
406 | // app that registers key/message to be sent back to the app, when it doesn't have focus, | 411 | // app that registers key/message to be sent back to the app, when it doesn't have focus, |
407 | // when user presses key, unless keyboard has been requested from app. | 412 | // when user presses key, unless keyboard has been requested from app. |
@@ -644,50 +649,48 @@ void Desktop::execAutoStart() | |||
644 | // value saved as delay, start the app | 649 | // value saved as delay, start the app |
645 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 650 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
646 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 651 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
647 | e << QString( appName ); | 652 | e << QString( appName ); |
648 | } | 653 | } |
649 | } | 654 | } |
650 | 655 | ||
651 | #if defined(QPE_HAVE_TOGGLELIGHT) | 656 | #if defined(QPE_HAVE_TOGGLELIGHT) |
652 | #include <qpe/config.h> | 657 | #include <qpe/config.h> |
653 | 658 | ||
654 | #include <sys/ioctl.h> | 659 | #include <sys/ioctl.h> |
655 | #include <sys/types.h> | 660 | #include <sys/types.h> |
656 | #include <fcntl.h> | 661 | #include <fcntl.h> |
657 | #include <unistd.h> | 662 | #include <unistd.h> |
658 | #include <errno.h> | 663 | #include <errno.h> |
659 | #include <linux/ioctl.h> | 664 | #include <linux/ioctl.h> |
660 | #include <time.h> | 665 | #include <time.h> |
661 | #endif | 666 | #endif |
662 | 667 | ||
663 | 668 | ||
664 | void Desktop::togglePower() | 669 | void Desktop::togglePower() |
665 | { | 670 | { |
666 | static bool excllock = false; | 671 | static bool excllock = false; |
667 | 672 | ||
668 | qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); | ||
669 | |||
670 | if ( excllock ) | 673 | if ( excllock ) |
671 | return ; | 674 | return ; |
672 | 675 | ||
673 | excllock = true; | 676 | excllock = true; |
674 | 677 | ||
675 | bool wasloggedin = loggedin; | 678 | bool wasloggedin = loggedin; |
676 | loggedin = 0; | 679 | loggedin = 0; |
677 | suspendTime = QDateTime::currentDateTime(); | 680 | suspendTime = QDateTime::currentDateTime(); |
678 | 681 | ||
679 | #ifdef QWS | 682 | #ifdef QWS |
680 | 683 | ||
681 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { | 684 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { |
682 | // Should use a big black window instead. | 685 | // Should use a big black window instead. |
683 | // But this would not show up fast enough | 686 | // But this would not show up fast enough |
684 | QGfx *g = qt_screen-> screenGfx ( ); | 687 | QGfx *g = qt_screen-> screenGfx ( ); |
685 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); | 688 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); |
686 | delete g; | 689 | delete g; |
687 | } | 690 | } |
688 | #endif | 691 | #endif |
689 | 692 | ||
690 | ODevice::inst ( )-> suspend ( ); | 693 | ODevice::inst ( )-> suspend ( ); |
691 | 694 | ||
692 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call | 695 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call |
693 | QWSServer::screenSaverActivate ( false ); | 696 | QWSServer::screenSaverActivate ( false ); |