diff --git a/src/komposefullscreenwidget.cpp b/src/komposefullscreenwidget.cpp index 4fdda7f..13e5228 100644 --- a/src/komposefullscreenwidget.cpp +++ b/src/komposefullscreenwidget.cpp @@ -33,6 +33,7 @@ #include #include +static bool controlHold = false; // is the control key pressed KomposeFullscreenWidget::KomposeFullscreenWidget( int displayType, KomposeLayout *l ) : KomposeTaskContainerWidget( -1, 0, l ), @@ -190,7 +191,16 @@ void KomposeFullscreenWidget::mousePressEvent ( TQMouseEvent * e ) } } -void KomposeFullscreenWidget::keyReleaseEvent ( TQKeyEvent * e ) +void KomposeFullscreenWidget::keyPressEvent( TQKeyEvent *e ) +{ + if ( e->key() == TQt::Key_Control ) + { + controlHold = true; + e->accept(); + } +} + +void KomposeFullscreenWidget::keyReleaseEvent ( TQKeyEvent *e ) { if ( e->key() == TQt::Key_Escape ) { @@ -198,14 +208,81 @@ void KomposeFullscreenWidget::keyReleaseEvent ( TQKeyEvent * e ) KomposeViewManager::instance()->closeCurrentView(); e->accept(); } + + else if ( e->key() == TQt::Key_Control ) + { + controlHold = false; + e->accept(); + return; + } + + // Movement keys + else if ( e->key() == TQt::Key_Right || e->key() == TQt::Key_D || e->key() == TQt::Key_H || + e->key() == TQt::Key_Left || e->key() == TQt::Key_A || e->key() == TQt::Key_J || + e->key() == TQt::Key_Up || e->key() == TQt::Key_W || e->key() == TQt::Key_K || + e->key() == TQt::Key_Down || e->key() == TQt::Key_S || e->key() == TQt::Key_L ) + { + // Map keys to directions + int direction = DLAYOUT_RIGHT; + switch( e->key() ) + { + case TQt::Key_Right: + direction = DLAYOUT_RIGHT; + break; + case TQt::Key_D: + direction = DLAYOUT_RIGHT; + break; + case TQt::Key_L: + direction = DLAYOUT_RIGHT; + break; + case TQt::Key_Left: + direction = DLAYOUT_LEFT; + break; + case TQt::Key_A: + direction = DLAYOUT_LEFT; + break; + case TQt::Key_H: + direction = DLAYOUT_LEFT; + break; + case TQt::Key_Up: + direction = DLAYOUT_TOP; + break; + case TQt::Key_W: + direction = DLAYOUT_TOP; + break; + case TQt::Key_K: + direction = DLAYOUT_TOP; + break; + case TQt::Key_Down: + direction = DLAYOUT_BOTTOM; + break; + case TQt::Key_S: + direction = DLAYOUT_BOTTOM; + break; + case TQt::Key_J: + direction = DLAYOUT_BOTTOM; + break; + } + + focusNeighbourDesk( direction ); + e->accept(); + return; + } + else { kdDebug() << "KomposeFullscreenWidget::keyReleaseEvent - ignored..." << endl; e->ignore(); } + KomposeTaskContainerWidget::keyReleaseEvent(e); } +bool KomposeFullscreenWidget::focusNeighbourDesk( int direction ) +{ + +} + int KomposeFullscreenWidget::getHeightForWidth ( int w ) const { return (int)(((double)w / (double)width()) * (double)height()); diff --git a/src/komposefullscreenwidget.h b/src/komposefullscreenwidget.h index 7b1af6e..827589d 100644 --- a/src/komposefullscreenwidget.h +++ b/src/komposefullscreenwidget.h @@ -44,11 +44,14 @@ protected: void initMenu(); void createDesktopWidgets(); - void mouseReleaseEvent (TQMouseEvent *); - void mousePressEvent (TQMouseEvent *); - void keyReleaseEvent ( TQKeyEvent * e ); + void mouseReleaseEvent( TQMouseEvent * ); + void mousePressEvent( TQMouseEvent * ); + void keyPressEvent( TQKeyEvent *e ); + void keyReleaseEvent( TQKeyEvent *e ); // void paintEvent ( TQPaintEvent * ); + bool focusNeighbourDesk( int direction ); + void destroyChildWidgets(); // virtual void closeEvent ( TQCloseEvent * e );