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

View file

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