From 0b2a40e15090cba7f5ba03b54cd8447314569c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sat, 8 Dec 2007 17:57:53 +0000 Subject: [PATCH] Act on KeyPress, not KeyRelease, the release may come from the activating shortcut. svn path=/trunk/KDE/kdebase/workspace/; revision=746327 --- effects/desktopgrid.cpp | 40 +++++++++++++++----------------------- effects/presentwindows.cpp | 26 +++++++------------------ 2 files changed, 23 insertions(+), 43 deletions(-) diff --git a/effects/desktopgrid.cpp b/effects/desktopgrid.cpp index 0b05f12f48..51c78f3b93 100644 --- a/effects/desktopgrid.cpp +++ b/effects/desktopgrid.cpp @@ -557,6 +557,22 @@ void DesktopGridEffect::grabbedKeyboardEvent( QKeyEvent* e ) { if( e->type() == QEvent::KeyPress ) { + int desktop = -1; + // switch by F or just + if( e->key() >= Qt::Key_F1 && e->key() <= Qt::Key_F35 ) + desktop = e->key() - Qt::Key_F1 + 1; + else if( e->key() >= Qt::Key_0 && e->key() <= Qt::Key_9 ) + desktop = e->key() == Qt::Key_0 ? 10 : e->key() - Qt::Key_0; + if( desktop != -1 ) + { + if( desktop <= effects->numberOfDesktops()) + { + setHighlightedDesktop( desktop ); + effects->setCurrentDesktop( desktop ); + setActive( false ); + } + return; + } switch( e->key()) { // wrap only on autorepeat case Qt::Key_Left: @@ -575,30 +591,6 @@ void DesktopGridEffect::grabbedKeyboardEvent( QKeyEvent* e ) setHighlightedDesktop( effects->desktopDown( highlighted_desktop, !e->isAutoRepeat())); break; - default: - break; - } - } - else if( e->type() == QEvent::KeyRelease ) - { - int desktop = -1; - // switch by F or just - if( e->key() >= Qt::Key_F1 && e->key() <= Qt::Key_F35 ) - desktop = e->key() - Qt::Key_F1 + 1; - else if( e->key() >= Qt::Key_0 && e->key() <= Qt::Key_9 ) - desktop = e->key() == Qt::Key_0 ? 10 : e->key() - Qt::Key_0; - if( desktop != -1 ) - { - if( desktop <= effects->numberOfDesktops()) - { - setHighlightedDesktop( desktop ); - effects->setCurrentDesktop( desktop ); - setActive( false ); - } - return; - } - switch( e->key()) - { case Qt::Key_Escape: setActive( false ); return; diff --git a/effects/presentwindows.cpp b/effects/presentwindows.cpp index 6668bbd342..ea608c5a83 100644 --- a/effects/presentwindows.cpp +++ b/effects/presentwindows.cpp @@ -812,25 +812,6 @@ void PresentWindowsEffect::grabbedKeyboardEvent( QKeyEvent* e ) rearrangeWindows(); } return; - case Qt::Key_Escape: - case Qt::Key_Return: - case Qt::Key_Enter: - break; - default: - if( !e->text().isEmpty()) - { - windowFilter.append( e->text()); - updateFilterTexture(); - rearrangeWindows(); - return; - } - break; - } - } - else if( e->type() == QEvent::KeyRelease ) - { - switch( e->key()) - { case Qt::Key_Escape: setActive( false ); return; @@ -849,6 +830,13 @@ void PresentWindowsEffect::grabbedKeyboardEvent( QKeyEvent* e ) } return; default: + if( !e->text().isEmpty()) + { + windowFilter.append( e->text()); + updateFilterTexture(); + rearrangeWindows(); + return; + } break; } }