Ctrl+F11 now does Expose effect with all window, including those on other desktops.

The downside is that sometimes it crashes when you want to activate a window in Expose mode. It seems
  to be some kind of memory problem, but I can't figure out what/where exactly, so I'd appreciate if
  someone took a look at it.

svn path=/branches/work/kwin_composite/; revision=645067
This commit is contained in:
Rivo Laks 2007-03-21 16:24:28 +00:00
parent d72a9239b4
commit d74c23ff17
2 changed files with 19 additions and 10 deletions

View file

@ -31,6 +31,7 @@ namespace KWinInternal
PresentWindowsEffect::PresentWindowsEffect()
{
mShowWindowsFromAllDesktops = false;
mActivated = false;
mActiveness = 0.0;
@ -39,6 +40,10 @@ PresentWindowsEffect::PresentWindowsEffect()
a->setText( i18n("Toggle Expose effect" ));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActive()));
KAction* b = (KAction*)actionCollection->addAction( "ExposeAll" );
b->setText( i18n("Toggle Expose effect (incl other desktops)" ));
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F11));
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
}
@ -70,9 +75,11 @@ void PresentWindowsEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion*
// This window will be transformed by the effect
*mask |= Scene::PAINT_WINDOW_TRANSFORMED;
w->enablePainting( Scene::Window::PAINT_DISABLED_BY_MINIMIZE );
// If it's minimized window and effect is not fully active, then apply
// some transparency
if( mActiveness < 1.0f && static_cast< Client* >( w->window() )->isMinimized() )
w->enablePainting( Scene::Window::PAINT_DISABLED_BY_DESKTOP );
// If it's minimized window or on another desktop and effect is not
// fully active, then apply some transparency
Client* c = static_cast< Client* >( w->window() );
if( mActiveness < 1.0f && (c->isMinimized() || !c->isOnCurrentDesktop() ))
*mask |= Scene::PAINT_WINDOW_TRANSLUCENT;
}
@ -92,9 +99,10 @@ void PresentWindowsEffect::paintWindow( EffectWindow* w, int mask, QRegion regio
// Darken all windows except for the one under the cursor
if( !windata.area.contains(cursorPos()) )
data.brightness *= interpolate(1.0, 0.7, mActiveness);
// If it's minimized window and effect is not fully active, then apply
// some transparency
if( mActiveness < 1.0f && static_cast< Client* >( w->window() )->isMinimized() )
// If it's minimized window or on another desktop and effect is not
// fully active, then apply some transparency
Client* c = static_cast< Client* >( w->window() );
if( mActiveness < 1.0f && (c->isMinimized() || !c->isOnCurrentDesktop() ))
data.opacity *= interpolate(0.0, 1.0, mActiveness);
}
@ -179,9 +187,7 @@ void PresentWindowsEffect::rearrangeWindows()
{
if( client->isSpecialWindow() )
continue;
// TODO: make it possible to show windows of all desktops (needs config
// option)
if( !client->effectWindow()->isOnCurrentDesktop() )
if( !mShowWindowsFromAllDesktops && !client->effectWindow()->isOnCurrentDesktop() )
continue;
clientlist.append(client);
}

View file

@ -41,7 +41,8 @@ class PresentWindowsEffect
public slots:
void setActive(bool active);
void toggleActive() { setActive(!mActivated); }
void toggleActive() { mShowWindowsFromAllDesktops = false; setActive(!mActivated); }
void toggleActiveAllDesktops() { mShowWindowsFromAllDesktops = true; setActive(!mActivated); }
protected:
// Updates window tranformations, i.e. destination pos and scale of the window
@ -60,6 +61,8 @@ class PresentWindowsEffect
void effectTerminated();
private:
bool mShowWindowsFromAllDesktops;
// Whether the effect is currently activated by the user
bool mActivated;
// 0 = not active, 1 = fully active