New mode for present windows effect: selecting all windows of same class as active window.
svn path=/trunk/KDE/kdebase/workspace/; revision=989722
This commit is contained in:
parent
69efc325fa
commit
ae0bac5c42
3 changed files with 36 additions and 1 deletions
|
@ -84,6 +84,12 @@ PresentWindowsEffect::PresentWindowsEffect()
|
||||||
shortcutAll = b->globalShortcut();
|
shortcutAll = b->globalShortcut();
|
||||||
connect( b, SIGNAL( triggered(bool) ), this, SLOT( toggleActiveAllDesktops() ));
|
connect( b, SIGNAL( triggered(bool) ), this, SLOT( toggleActiveAllDesktops() ));
|
||||||
connect( b, SIGNAL( globalShortcutChanged(QKeySequence) ), this, SLOT( globalShortcutChangedAll(QKeySequence)));
|
connect( b, SIGNAL( globalShortcutChanged(QKeySequence) ), this, SLOT( globalShortcutChangedAll(QKeySequence)));
|
||||||
|
KAction* c = ( KAction* )actionCollection->addAction( "ExposeClass" );
|
||||||
|
c->setText( i18n( "Toggle Present Windows (Window class)" ));
|
||||||
|
c->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F7 ));
|
||||||
|
connect( c, SIGNAL( triggered(bool) ), this, SLOT( toggleActiveClass() ));
|
||||||
|
connect( c, SIGNAL( globalShortcutChanged(QKeySequence) ), this, SLOT( globalShortcutChangedClass(QKeySequence)));
|
||||||
|
shortcutClass = c->globalShortcut();
|
||||||
reconfigure( ReconfigureAll );
|
reconfigure( ReconfigureAll );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +160,13 @@ const void* PresentWindowsEffect::proxy() const
|
||||||
return &m_proxy;
|
return &m_proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PresentWindowsEffect::toggleActiveClass()
|
||||||
|
{
|
||||||
|
m_mode = ModeWindowClass;
|
||||||
|
m_class = effects->activeWindow()->windowClass();
|
||||||
|
setActive( !m_activated );
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Screen painting
|
// Screen painting
|
||||||
|
|
||||||
|
@ -522,6 +535,11 @@ void PresentWindowsEffect::grabbedKeyboardEvent( QKeyEvent *e )
|
||||||
toggleActiveAllDesktops();
|
toggleActiveAllDesktops();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if( m_mode == ModeWindowClass && shortcutClass.contains( e->key() + e->modifiers() ) )
|
||||||
|
{
|
||||||
|
toggleActiveClass();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch( e->key() )
|
switch( e->key() )
|
||||||
{ // Wrap only if not auto-repeating
|
{ // Wrap only if not auto-repeating
|
||||||
|
@ -1556,6 +1574,8 @@ bool PresentWindowsEffect::isSelectableWindow( EffectWindow *w )
|
||||||
return w->isOnDesktop( m_desktop );
|
return w->isOnDesktop( m_desktop );
|
||||||
case ModeWindowGroup:
|
case ModeWindowGroup:
|
||||||
return m_selectedWindows.contains( w );
|
return m_selectedWindows.contains( w );
|
||||||
|
case ModeWindowClass:
|
||||||
|
return m_class == w->windowClass();
|
||||||
}
|
}
|
||||||
if( !m_tabBoxEnabled && m_ignoreMinimized && w->isMinimized() )
|
if( !m_tabBoxEnabled && m_ignoreMinimized && w->isMinimized() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1776,6 +1796,11 @@ void PresentWindowsEffect::globalShortcutChangedAll( const QKeySequence& seq )
|
||||||
shortcutAll = KShortcut( seq );
|
shortcutAll = KShortcut( seq );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PresentWindowsEffect::globalShortcutChangedClass( const QKeySequence& seq )
|
||||||
|
{
|
||||||
|
shortcutClass = KShortcut( seq );
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#include "presentwindows.moc"
|
#include "presentwindows.moc"
|
||||||
|
|
|
@ -95,7 +95,8 @@ class PresentWindowsEffect
|
||||||
ModeAllDesktops, // Shows windows of all desktops
|
ModeAllDesktops, // Shows windows of all desktops
|
||||||
ModeCurrentDesktop, // Shows windows on current desktop
|
ModeCurrentDesktop, // Shows windows on current desktop
|
||||||
ModeSelectedDesktop, // Shows windows of selected desktop via property (m_desktop)
|
ModeSelectedDesktop, // Shows windows of selected desktop via property (m_desktop)
|
||||||
ModeWindowGroup // Shows windows selected via property
|
ModeWindowGroup, // Shows windows selected via property
|
||||||
|
ModeWindowClass // Shows all windows of same class as selected class
|
||||||
};
|
};
|
||||||
enum WindowMouseAction
|
enum WindowMouseAction
|
||||||
{
|
{
|
||||||
|
@ -119,11 +120,13 @@ class PresentWindowsEffect
|
||||||
void setActive( bool active, bool closingTab = false ); // HACK: closingTab shouldn't be needed
|
void setActive( bool active, bool closingTab = false ); // HACK: closingTab shouldn't be needed
|
||||||
void toggleActive() { m_mode = ModeCurrentDesktop; setActive( !m_activated ); }
|
void toggleActive() { m_mode = ModeCurrentDesktop; setActive( !m_activated ); }
|
||||||
void toggleActiveAllDesktops() { m_mode = ModeAllDesktops; setActive( !m_activated ); }
|
void toggleActiveAllDesktops() { m_mode = ModeAllDesktops; setActive( !m_activated ); }
|
||||||
|
void toggleActiveClass();
|
||||||
|
|
||||||
// slots for global shortcut changed
|
// slots for global shortcut changed
|
||||||
// needed to toggle the effect
|
// needed to toggle the effect
|
||||||
void globalShortcutChanged( const QKeySequence& seq );
|
void globalShortcutChanged( const QKeySequence& seq );
|
||||||
void globalShortcutChangedAll( const QKeySequence& seq );
|
void globalShortcutChangedAll( const QKeySequence& seq );
|
||||||
|
void globalShortcutChangedClass( const QKeySequence& seq );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Window rearranging
|
// Window rearranging
|
||||||
|
@ -184,6 +187,7 @@ class PresentWindowsEffect
|
||||||
int m_desktop;
|
int m_desktop;
|
||||||
EffectWindowList m_selectedWindows;
|
EffectWindowList m_selectedWindows;
|
||||||
EffectWindow *m_managerWindow;
|
EffectWindow *m_managerWindow;
|
||||||
|
QString m_class;
|
||||||
|
|
||||||
// Window data
|
// Window data
|
||||||
WindowMotionManager m_motionManager;
|
WindowMotionManager m_motionManager;
|
||||||
|
@ -200,6 +204,7 @@ class PresentWindowsEffect
|
||||||
// Shortcut - needed to toggle the effect
|
// Shortcut - needed to toggle the effect
|
||||||
KShortcut shortcut;
|
KShortcut shortcut;
|
||||||
KShortcut shortcutAll;
|
KShortcut shortcutAll;
|
||||||
|
KShortcut shortcutClass;
|
||||||
|
|
||||||
// Atoms
|
// Atoms
|
||||||
// Present windows for all windows of given desktop
|
// Present windows for all windows of given desktop
|
||||||
|
|
|
@ -64,6 +64,11 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
|
||||||
b->setProperty( "isConfigurationAction", true );
|
b->setProperty( "isConfigurationAction", true );
|
||||||
b->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F9 ));
|
b->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F9 ));
|
||||||
|
|
||||||
|
KAction* c = ( KAction* )m_actionCollection->addAction( "ExposeClass" );
|
||||||
|
c->setText( i18n( "Toggle Present Windows (Window class)" ));
|
||||||
|
c->setProperty( "isConfigurationAction", true );
|
||||||
|
c->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F7 ));
|
||||||
|
|
||||||
m_ui->shortcutEditor->addCollection( m_actionCollection );
|
m_ui->shortcutEditor->addCollection( m_actionCollection );
|
||||||
|
|
||||||
connect( m_ui->layoutCombo, SIGNAL( currentIndexChanged( int )), this, SLOT( changed() ));
|
connect( m_ui->layoutCombo, SIGNAL( currentIndexChanged( int )), this, SLOT( changed() ));
|
||||||
|
|
Loading…
Reference in a new issue