author | groucho <groucho> | 2003-03-22 09:21:03 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-03-22 09:21:03 (UTC) |
commit | f462ccd5ad11da7bddfa627d4773e3b02f18e2b8 (patch) (side-by-side diff) | |
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 @@ -321,95 +321,100 @@ void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); if ( db ) checkButtonAction ( db, keycode, press, autoRepeat ); } else if ( msg == "keyRegister(int,QCString,QCString)" ) { int k; QCString c, m; stream >> k >> c >> m; keyRegisterList.append ( QCopKeyRegister ( k, c, m )); } } void DesktopApplication::sendHeldAction ( ) { if ( m_last_button ) { m_last_button-> heldAction ( ). send ( ); m_last_button = 0; } } bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) { if ( db ) { if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { m_button_timer-> stop ( ); if (!db-> pressedAction ( ). channel ( ) .isEmpty()) { + if ( db-> pressedAction ( ). channel ( )!="ignore") { + db-> pressedAction ( ). send ( ); } - else return false; + else + return false; } } else if ( press && !autoRepeat ) { m_button_timer-> stop ( ); if (!db-> pressedAction ( ). channel ( ) .isEmpty()) { if ( db-> heldAction ( ). channel ( )!="ignore") { m_last_button = db; m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); } else return false; } } } return true; } bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) { + if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { QKeyEvent *ke = (QKeyEvent *) e; const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); if ( db ) { - return checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( )); + if (checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( ))) + return true; //checkButtonAction retrune false if events should be routed through } } return QPEApplication::eventFilter ( o, e ); } #ifdef Q_WS_QWS bool DesktopApplication::qwsEventFilter( QWSEvent *e ) { qpedesktop->checkMemory(); if ( e->type == QWSEvent::Key ) { QWSKeyEvent * ke = (QWSKeyEvent *) e; ushort keycode = ke-> simpleData. keycode; if ( !loggedin && keycode != Key_F34 ) return true; bool press = ke-> simpleData. is_press; bool autoRepeat = ke-> simpleData. is_auto_repeat; if ( !keyboardGrabbed ( )) { // app that registers key/message to be sent back to the app, when it doesn't have focus, // when user presses key, unless keyboard has been requested from app. // will not send multiple repeats if user holds key // i.e. one shot if ( keycode != 0 && press && !autoRepeat ) { for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { if (( *it ). getKeyCode ( ) == keycode ) { QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( )); return true; @@ -636,66 +641,64 @@ void Desktop::execAutoStart() QString appName; int delay; QDateTime now = QDateTime::currentDateTime(); Config cfg( "autostart" ); cfg.setGroup( "AutoStart" ); appName = cfg.readEntry( "Apps", "" ); delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); // If the time between suspend and resume was longer then the // value saved as delay, start the app if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( appName ); } } #if defined(QPE_HAVE_TOGGLELIGHT) #include <qpe/config.h> #include <sys/ioctl.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <linux/ioctl.h> #include <time.h> #endif void Desktop::togglePower() { static bool excllock = false; - qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); - if ( excllock ) return ; excllock = true; bool wasloggedin = loggedin; loggedin = 0; suspendTime = QDateTime::currentDateTime(); #ifdef QWS if ( Password::needToAuthenticate ( true ) && qt_screen ) { // Should use a big black window instead. // But this would not show up fast enough QGfx *g = qt_screen-> screenGfx ( ); g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); delete g; } #endif ODevice::inst ( )-> suspend ( ); DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call QWSServer::screenSaverActivate ( false ); { QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep } if ( wasloggedin ) login ( true ); |