The TabBox passes KeyEvents to the effects. So we can navigate with left/right/up/down in presentwindows when used as alt+tab effect. Filtering is of course disabled.
svn path=/trunk/KDE/kdebase/workspace/; revision=1042596
This commit is contained in:
parent
424d358fd2
commit
aff72003dd
7 changed files with 55 additions and 2 deletions
|
@ -295,6 +295,12 @@ void EffectsHandlerImpl::tabBoxUpdated()
|
|||
ep.second->tabBoxUpdated();
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::tabBoxKeyEvent( QKeyEvent* event )
|
||||
{
|
||||
foreach( const EffectPair &ep, loaded_effects )
|
||||
ep.second->tabBoxKeyEvent( event );
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::setActiveFullScreenEffect( Effect* e )
|
||||
{
|
||||
fullscreen_effect = e;
|
||||
|
|
|
@ -152,6 +152,7 @@ class EffectsHandlerImpl : public EffectsHandler
|
|||
void tabBoxAdded( int mode );
|
||||
void tabBoxClosed();
|
||||
void tabBoxUpdated();
|
||||
void tabBoxKeyEvent( QKeyEvent* event );
|
||||
bool borderActivated( ElectricBorder border );
|
||||
void mouseChanged( const QPoint& pos, const QPoint& oldpos,
|
||||
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
|
||||
|
|
|
@ -673,6 +673,44 @@ void PresentWindowsEffect::tabBoxUpdated()
|
|||
setHighlightedWindow( effects->currentTabBoxWindow() );
|
||||
}
|
||||
|
||||
void PresentWindowsEffect::tabBoxKeyEvent( QKeyEvent* event )
|
||||
{
|
||||
// not using the "normal" grabbedKeyboardEvent as we don't want to filter in tabbox
|
||||
if( event->type() == QEvent::KeyPress )
|
||||
{
|
||||
switch( event->key() )
|
||||
{ // Wrap only if not auto-repeating
|
||||
case Qt::Key_Left:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, -1, 0, !event->isAutoRepeat() ));
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, 1, 0, !event->isAutoRepeat() ));
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, 0, -1, !event->isAutoRepeat() ));
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, 0, 1, !event->isAutoRepeat() ));
|
||||
break;
|
||||
case Qt::Key_Home:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, -1000, 0, false ));
|
||||
break;
|
||||
case Qt::Key_End:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, 1000, 0, false ));
|
||||
break;
|
||||
case Qt::Key_PageUp:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, 0, -1000, false ));
|
||||
break;
|
||||
case Qt::Key_PageDown:
|
||||
setHighlightedWindow( relativeWindow( m_highlightedWindow, 0, 1000, false ));
|
||||
break;
|
||||
default:
|
||||
// nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Atom handling
|
||||
void PresentWindowsEffect::propertyNotify( EffectWindow* w, long a )
|
||||
|
|
|
@ -87,6 +87,7 @@ class PresentWindowsEffect
|
|||
virtual void tabBoxAdded( int mode );
|
||||
virtual void tabBoxClosed();
|
||||
virtual void tabBoxUpdated();
|
||||
virtual void tabBoxKeyEvent( QKeyEvent* event );
|
||||
|
||||
// atoms
|
||||
virtual void propertyNotify( EffectWindow* w, long atom );
|
||||
|
|
|
@ -186,6 +186,11 @@ void Effect::tabBoxClosed()
|
|||
void Effect::tabBoxUpdated()
|
||||
{
|
||||
}
|
||||
|
||||
void Effect::tabBoxKeyEvent( QKeyEvent* )
|
||||
{
|
||||
}
|
||||
|
||||
bool Effect::borderActivated( ElectricBorder )
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -170,7 +170,7 @@ X-KDE-Library=kwin4_effect_cooleffect
|
|||
|
||||
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
|
||||
#define KWIN_EFFECT_API_VERSION_MAJOR 0
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 104
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 105
|
||||
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
|
||||
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
|
||||
|
||||
|
@ -411,6 +411,7 @@ class KWIN_EXPORT Effect
|
|||
virtual void tabBoxAdded( int mode );
|
||||
virtual void tabBoxClosed();
|
||||
virtual void tabBoxUpdated();
|
||||
virtual void tabBoxKeyEvent( QKeyEvent* event );
|
||||
virtual bool borderActivated( ElectricBorder border );
|
||||
|
||||
static int displayWidth();
|
||||
|
|
|
@ -601,7 +601,8 @@ void TabBox::TabBox::grabbedKeyEvent( QKeyEvent* event )
|
|||
{
|
||||
if( !m_isShown && isDisplayed() )
|
||||
{ // tabbox has been replaced, check effects
|
||||
// TODO: pass keyevent to effects
|
||||
if( effects )
|
||||
static_cast<EffectsHandlerImpl*>(effects)->tabBoxKeyEvent( event );
|
||||
return;
|
||||
}
|
||||
setCurrentIndex( m_tabBox->grabbedKeyEvent( event ) );
|
||||
|
|
Loading…
Reference in a new issue