Tabbox effect also converted to plugins.

svn path=/branches/work/kwin_composite/; revision=653014
This commit is contained in:
Luboš Luňák 2007-04-12 14:12:34 +00:00
parent 2b82c88874
commit 5fc1d4c480
10 changed files with 592 additions and 379 deletions

View file

@ -175,6 +175,8 @@ Effects framework TODO
+ EffectWindow should be completely opaque when kept as the only API for effects
- no inlines, etc.
+ API for tabbox for effects should be cleaned up
Effects TODO
===============================

View file

@ -247,6 +247,11 @@ int EffectsHandlerImpl::numberOfDesktops() const
return Workspace::self()->numberOfDesktops();
}
QString EffectsHandlerImpl::desktopName( int desktop ) const
{
return Workspace::self()->desktopName( desktop );
}
void EffectsHandlerImpl::calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const
{
Workspace::self()->calcDesktopLayout( x, y, orientation );
@ -281,6 +286,58 @@ EffectWindowList EffectsHandlerImpl::stackingOrder() const
return ret;
}
void EffectsHandlerImpl::setTabBoxWindow(EffectWindow* w)
{
if( Client* c = dynamic_cast< Client* >( static_cast< EffectWindowImpl* >( w )->window()))
Workspace::self()->setTabBoxClient( c );
}
void EffectsHandlerImpl::setTabBoxDesktop(int desktop)
{
Workspace::self()->setTabBoxDesktop( desktop );
}
EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const
{
EffectWindowList ret;
ClientList clients = Workspace::self()->currentTabBoxClientList();
foreach( Client* c, clients )
ret.append( c->effectWindow());
return ret;
}
void EffectsHandlerImpl::refTabBox()
{
Workspace::self()->refTabBox();
}
void EffectsHandlerImpl::unrefTabBox()
{
Workspace::self()->unrefTabBox();
}
void EffectsHandlerImpl::closeTabBox()
{
Workspace::self()->closeTabBox();
}
QList< int > EffectsHandlerImpl::currentTabBoxDesktopList() const
{
return Workspace::self()->currentTabBoxDesktopList();
}
int EffectsHandlerImpl::currentTabBoxDesktop() const
{
return Workspace::self()->currentTabBoxDesktop();
}
EffectWindow* EffectsHandlerImpl::currentTabBoxWindow() const
{
if( Client* c = Workspace::self()->currentTabBoxClient())
return c->effectWindow();
return NULL;
}
void EffectsHandlerImpl::addRepaintFull()
{
Workspace::self()->addRepaintFull();
@ -565,6 +622,13 @@ QString EffectWindowImpl::caption() const
return "";
}
QPixmap EffectWindowImpl::icon() const
{
if( Client* c = dynamic_cast<Client*>( toplevel ))
return c->icon();
return QPixmap(); // TODO
}
const EffectWindowGroup* EffectWindowImpl::group() const
{
if( Client* c = dynamic_cast< Client* >( toplevel ))

View file

@ -38,10 +38,22 @@ class EffectsHandlerImpl : public EffectsHandler
virtual int currentDesktop() const;
virtual int numberOfDesktops() const;
virtual QString desktopName( int desktop ) const;
virtual int displayWidth() const;
virtual int displayHeight() const;
virtual QPoint cursorPos() const;
virtual EffectWindowList stackingOrder() const;
virtual void setTabBoxWindow(EffectWindow*);
virtual void setTabBoxDesktop(int);
virtual EffectWindowList currentTabBoxWindowList() const;
virtual void refTabBox();
virtual void unrefTabBox();
virtual void closeTabBox();
virtual QList< int > currentTabBoxDesktopList() const;
virtual int currentTabBoxDesktop() const;
virtual EffectWindow* currentTabBoxWindow() const;
virtual void addRepaintFull();
virtual void addRepaint( const QRect& r );
virtual void addRepaint( int x, int y, int w, int h );
@ -107,6 +119,7 @@ class EffectWindowImpl : public EffectWindow
virtual bool isMinimized() const;
virtual double opacity() const;
virtual QString caption() const;
virtual QPixmap icon() const;
virtual const EffectWindowGroup* group() const;
virtual int x() const;

View file

@ -12,14 +12,16 @@ License. See the file "COPYING" for the exact licensing terms.
#include "boxswitch.h"
#include <QCursor>
#include <QMouseEvent>
#include <QSize>
#include <assert.h>
#ifdef HAVE_OPENGL
#include <GL/gl.h>
#endif
#if 0
// TODO
namespace KWin
{
@ -50,12 +52,12 @@ void BoxSwitchEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* paint
{
if( mActivated )
{
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
if( windows.contains( w ) && w != selected_window )
{
*mask |= Scene::PAINT_WINDOW_TRANSLUCENT;
*mask &= ~Scene::PAINT_WINDOW_OPAQUE;
*mask |= PAINT_WINDOW_TRANSLUCENT;
*mask &= ~PAINT_WINDOW_OPAQUE;
}
}
else
@ -63,9 +65,9 @@ void BoxSwitchEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* paint
if( painting_desktop )
{
if( w->isOnDesktop( painting_desktop ))
w->enablePainting( Scene::Window::PAINT_DISABLED_BY_DESKTOP );
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
else
w->disablePainting( Scene::Window::PAINT_DISABLED_BY_DESKTOP );
w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
}
}
}
@ -77,7 +79,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da
effects->paintScreen( mask, region, data );
if( mActivated )
{
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
paintFrame();
@ -85,8 +87,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da
{
if( w == selected_window )
{
paintHighlight( windows[ w ]->area,
static_cast< Client* >( w->window())->caption());
paintHighlight( windows[ w ]->area, w->caption());
}
paintWindowThumbnail( w );
paintWindowIcon( w );
@ -103,7 +104,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da
if( painting_desktop == selected_desktop )
{
paintHighlight( desktops[ painting_desktop ]->area,
Workspace::self()->desktopName( painting_desktop ));
effects->desktopName( painting_desktop ));
}
paintDesktopThumbnail( painting_desktop );
@ -118,7 +119,7 @@ void BoxSwitchEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi
{
if( mActivated )
{
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
if( windows.contains( w ) && w != selected_window )
{
@ -138,13 +139,13 @@ void BoxSwitchEffect::windowInputMouseEvent( Window w, QEvent* e )
pos += frame_area.topLeft();
// determine which item was clicked
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
foreach( EffectWindow* w, windows.keys())
{
if( windows[ w ]->clickable.contains( pos ))
{
Workspace::self()->setTabBoxClient( static_cast< Client* >( w->window()));
effects->setTabBoxWindow( w );
}
}
}
@ -154,7 +155,7 @@ void BoxSwitchEffect::windowInputMouseEvent( Window w, QEvent* e )
{
if( desktops[ i ]->clickable.contains( pos ))
{
Workspace::self()->setTabBoxDesktop( i );
effects->setTabBoxDesktop( i );
}
}
}
@ -164,11 +165,11 @@ void BoxSwitchEffect::windowDamaged( EffectWindow* w, const QRect& damage )
{
if( mActivated )
{
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
if( windows.contains( w ))
{
workspace()->addRepaint( windows[ w ]->area );
effects->addRepaint( windows[ w ]->area );
}
}
else
@ -176,11 +177,11 @@ void BoxSwitchEffect::windowDamaged( EffectWindow* w, const QRect& damage )
if( w->isOnAllDesktops())
{
foreach( ItemInfo* info, desktops )
workspace()->addRepaint( info->area );
effects->addRepaint( info->area );
}
else
{
workspace()->addRepaint( desktops[ w->desktop() ]->area );
effects->addRepaint( desktops[ w->desktop() ]->area );
}
}
}
@ -190,11 +191,11 @@ void BoxSwitchEffect::windowGeometryShapeChanged( EffectWindow* w, const QRect&
{
if( mActivated )
{
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
if( windows.contains( w ) && w->size() != old.size())
{
workspace()->addRepaint( windows[ w ]->area );
effects->addRepaint( windows[ w ]->area );
}
}
else
@ -202,11 +203,11 @@ void BoxSwitchEffect::windowGeometryShapeChanged( EffectWindow* w, const QRect&
if( w->isOnAllDesktops())
{
foreach( ItemInfo* info, desktops )
workspace()->addRepaint( info->area );
effects->addRepaint( info->area );
}
else
{
workspace()->addRepaint( desktops[ w->desktop() ]->area );
effects->addRepaint( desktops[ w->desktop() ]->area );
}
}
}
@ -216,22 +217,22 @@ void BoxSwitchEffect::tabBoxAdded( int mode )
{
if( !mActivated )
{
if( mode == TabBox::WindowsMode )
if( mode == TabBoxWindowsMode )
{
if( Workspace::self()->currentTabBoxClientList().count() > 0 )
if( effects->currentTabBoxWindowList().count() > 0 )
{
mMode = mode;
Workspace::self()->refTabBox();
effects->refTabBox();
setActive();
}
}
else
{ // DesktopMode
if( Workspace::self()->currentTabBoxDesktopList().count() > 0 )
if( effects->currentTabBoxDesktopList().count() > 0 )
{
mMode = mode;
painting_desktop = 0;
Workspace::self()->refTabBox();
effects->refTabBox();
setActive();
}
}
@ -248,65 +249,65 @@ void BoxSwitchEffect::tabBoxUpdated()
{
if( mActivated )
{
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
if( selected_window != NULL )
{
if( windows.contains( selected_window ))
workspace()->addRepaint( windows.value( selected_window )->area );
selected_window->window()->addRepaintFull();
effects->addRepaint( windows.value( selected_window )->area );
selected_window->addRepaintFull();
}
selected_window = Workspace::self()->currentTabBoxClient()->effectWindow();
selected_window = effects->currentTabBoxWindow();
if( windows.contains( selected_window ))
workspace()->addRepaint( windows.value( selected_window )->area );
selected_window->window()->addRepaintFull();
if( Workspace::self()->currentTabBoxClientList() == original_windows )
effects->addRepaint( windows.value( selected_window )->area );
selected_window->addRepaintFull();
if( effects->currentTabBoxWindowList() == original_windows )
return;
original_windows = Workspace::self()->currentTabBoxClientList();
original_windows = effects->currentTabBoxWindowList();
}
else
{ // DesktopMode
if( desktops.contains( selected_desktop ))
workspace()->addRepaint( desktops.value( selected_desktop )->area );
selected_desktop = Workspace::self()->currentTabBoxDesktop();
effects->addRepaint( desktops.value( selected_desktop )->area );
selected_desktop = effects->currentTabBoxDesktop();
if( desktops.contains( selected_desktop ))
workspace()->addRepaint( desktops.value( selected_desktop )->area );
if( Workspace::self()->currentTabBoxDesktopList() == original_desktops )
effects->addRepaint( desktops.value( selected_desktop )->area );
if( effects->currentTabBoxDesktopList() == original_desktops )
return;
original_desktops = Workspace::self()->currentTabBoxDesktopList();
original_desktops = effects->currentTabBoxDesktopList();
}
workspace()->addRepaint( frame_area );
effects->addRepaint( frame_area );
calculateFrameSize();
calculateItemSizes();
moveResizeInputWindow( frame_area.x(), frame_area.y(), frame_area.width(), frame_area.height());
workspace()->addRepaint( frame_area );
effects->addRepaint( frame_area );
}
}
void BoxSwitchEffect::setActive()
{
mActivated = true;
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
original_windows = Workspace::self()->currentTabBoxClientList();
selected_window = Workspace::self()->currentTabBoxClient()->effectWindow();
original_windows = effects->currentTabBoxWindowList();
selected_window = effects->currentTabBoxWindow();
}
else
{
original_desktops = Workspace::self()->currentTabBoxDesktopList();
selected_desktop = Workspace::self()->currentTabBoxDesktop();
original_desktops = effects->currentTabBoxDesktopList();
selected_desktop = effects->currentTabBoxDesktop();
}
calculateFrameSize();
calculateItemSizes();
mInput = effects->createInputWindow( this, frame_area.x(), frame_area.y(),
frame_area.width(), frame_area.height(), Qt::ArrowCursor );
workspace()->addRepaint( frame_area );
if( mMode == TabBox::WindowsMode )
effects->addRepaint( frame_area );
if( mMode == TabBoxWindowsMode )
{
foreach( EffectWindow* w, windows.keys())
{
if( w != selected_window )
w->window()->addRepaintFull();
w->addRepaintFull();
}
}
}
@ -314,23 +315,23 @@ void BoxSwitchEffect::setActive()
void BoxSwitchEffect::setInactive()
{
mActivated = false;
Workspace::self()->unrefTabBox();
effects->unrefTabBox();
if( mInput != None )
{
effects->destroyInputWindow( mInput );
mInput = None;
}
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
foreach( EffectWindow* w, windows.keys())
{
if( w != selected_window )
w->window()->addRepaintFull();
w->addRepaintFull();
}
foreach( ItemInfo* i, windows )
{
#ifdef HAVE_XRENDER
if( dynamic_cast< SceneXrender* >( scene ))
if( effects->compositingType() == XRenderCompositing )
{
if( i->iconPicture != None )
XRenderFreePicture( display(), i->iconPicture );
@ -347,7 +348,7 @@ void BoxSwitchEffect::setInactive()
delete i;
desktops.clear();
}
workspace()->addRepaint( frame_area );
effects->addRepaint( frame_area );
frame_area = QRect();
}
@ -361,7 +362,7 @@ void BoxSwitchEffect::calculateFrameSize()
{
int itemcount;
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
itemcount = original_windows.count();
item_max_size.setWidth( 200 );
@ -386,12 +387,12 @@ void BoxSwitchEffect::calculateFrameSize()
void BoxSwitchEffect::calculateItemSizes()
{
if( mMode == TabBox::WindowsMode )
if( mMode == TabBoxWindowsMode )
{
windows.clear();
for( int i = 0; i < original_windows.count(); i++ )
{
EffectWindow* w = original_windows.at( i )->effectWindow();
EffectWindow* w = original_windows.at( i );
windows[ w ] = new ItemInfo();
windows[ w ]->area = QRect( frame_area.x() + frame_margin
@ -422,7 +423,7 @@ void BoxSwitchEffect::paintFrame()
{
double alpha = 0.75;
#ifdef HAVE_OPENGL
if( dynamic_cast< SceneOpenGL* >( scene ))
if( effects->compositingType() == OpenGLCompositing )
{
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
glEnable( GL_BLEND );
@ -441,10 +442,10 @@ void BoxSwitchEffect::paintFrame()
glDisableClientState( GL_VERTEX_ARRAY );
glPopAttrib();
}
else
#endif
{
#ifdef HAVE_XRENDER
if( effects->compositingType() == XRenderCompositing )
{
Pixmap pixmap = XCreatePixmap( display(), rootWindow(),
frame_area.width(), frame_area.height(), 32 );
Picture pic = XRenderCreatePicture( display(), pixmap, alphaFormat, 0, NULL );
@ -457,18 +458,18 @@ void BoxSwitchEffect::paintFrame()
XRenderFillRectangle( display(), PictOpSrc, pic, &col, 0, 0,
frame_area.width(), frame_area.height());
XRenderComposite( display(), alpha != 1.0 ? PictOpOver : PictOpSrc,
pic, None, static_cast< SceneXrender* >( scene )->bufferPicture(),
pic, None, effects->xrenderBufferPicture(),
0, 0, 0, 0, frame_area.x(), frame_area.y(), frame_area.width(), frame_area.height());
XRenderFreePicture( display(), pic );
#endif
}
#endif
}
void BoxSwitchEffect::paintHighlight( QRect area, QString text )
{
double alpha = 0.75;
#ifdef HAVE_OPENGL
if( dynamic_cast< SceneOpenGL* >( scene ))
if( effects->compositingType() == OpenGLCompositing )
{
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
glEnable( GL_BLEND );
@ -487,10 +488,10 @@ void BoxSwitchEffect::paintHighlight( QRect area, QString text )
glDisableClientState( GL_VERTEX_ARRAY );
glPopAttrib();
}
else
#endif
{
#ifdef HAVE_XRENDER
if( effects->compositingType() == XRenderCompositing )
{
Pixmap pixmap = XCreatePixmap( display(), rootWindow(),
area.width(), area.height(), 32 );
Picture pic = XRenderCreatePicture( display(), pixmap, alphaFormat, 0, NULL );
@ -503,11 +504,11 @@ void BoxSwitchEffect::paintHighlight( QRect area, QString text )
XRenderFillRectangle( display(), PictOpSrc, pic, &col, 0, 0,
area.width(), area.height());
XRenderComposite( display(), alpha != 1.0 ? PictOpOver : PictOpSrc,
pic, None, static_cast< SceneXrender* >( scene )->bufferPicture(),
pic, None, effects->xrenderBufferPicture(),
0, 0, 0, 0, area.x(), area.y(), area.width(), area.height());
XRenderFreePicture( display(), pic );
#endif
}
#endif
// kDebug() << text << endl; // TODO draw this nicely on screen
}
@ -523,7 +524,7 @@ void BoxSwitchEffect::paintWindowThumbnail( EffectWindow* w )
Qt::KeepAspectRatio );
effects->drawWindow( w,
Scene::PAINT_WINDOW_OPAQUE | Scene::PAINT_WINDOW_TRANSFORMED,
PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSFORMED,
windows[ w ]->thumbnail, data );
}
@ -549,7 +550,7 @@ void BoxSwitchEffect::paintDesktopThumbnail( int iDesktop )
data.xTranslate = x;
data.yTranslate = y;
effects->paintScreen( Scene::PAINT_SCREEN_TRANSFORMED | Scene::PAINT_SCREEN_BACKGROUND_FIRST,
effects->paintScreen( PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_BACKGROUND_FIRST,
region, data );
}
@ -557,33 +558,32 @@ void BoxSwitchEffect::paintWindowIcon( EffectWindow* w )
{
if( !windows.contains( w ))
return;
if( windows[ w ]->icon.serialNumber()
!= static_cast< Client* >( w->window())->icon().serialNumber())
if( windows[ w ]->icon.serialNumber() != w->icon().serialNumber())
{ // make sure windows[ w ]->icon is the right QPixmap, and rebind
windows[ w ]->icon = static_cast< Client* >( w->window())->icon();
windows[ w ]->icon = w->icon();
#ifdef HAVE_OPENGL
if( dynamic_cast< SceneOpenGL* >( scene ))
if( effects->compositingType() == OpenGLCompositing )
{
windows[ w ]->iconTexture.load( windows[ w ]->icon );
windows[ w ]->iconTexture.setFilter( GL_LINEAR );
}
else
#endif
{
#ifdef HAVE_XRENDER
if( effects->compositingType() == XRenderCompositing )
{
if( windows[ w ]->iconPicture != None )
XRenderFreePicture( display(), windows[ w ]->iconPicture );
windows[ w ]->iconPicture = XRenderCreatePicture( display(),
windows[ w ]->icon.handle(), alphaFormat, 0, NULL );
#endif
}
#endif
}
int width = windows[ w ]->icon.width();
int height = windows[ w ]->icon.height();
int x = windows[ w ]->area.x() + windows[ w ]->area.width() - width - highlight_margin;
int y = windows[ w ]->area.y() + windows[ w ]->area.height() - height - highlight_margin;
#ifdef HAVE_OPENGL
if( dynamic_cast< SceneOpenGL* >( scene ))
if( effects->compositingType() == OpenGLCompositing )
{
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
glEnable( GL_BLEND );
@ -613,18 +613,17 @@ void BoxSwitchEffect::paintWindowIcon( EffectWindow* w )
windows[ w ]->iconTexture.unbind();
glPopAttrib();
}
else
#endif
{
#ifdef HAVE_XRENDER
if( effects->compositingType() == XRenderCompositing )
{
XRenderComposite( display(),
windows[ w ]->icon.depth() == 32 ? PictOpOver : PictOpSrc,
windows[ w ]->iconPicture, None,
static_cast< SceneXrender* >( scene )->bufferPicture(),
effects->xrenderBufferPicture(),
0, 0, 0, 0, x, y, width, height );
#endif
}
#endif
}
} // namespace
#endif

View file

@ -11,9 +11,6 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef KWIN_BOXSWITCH_H
#define KWIN_BOXSWITCH_H
#if 0
// TODO
#include <kwineffects.h>
#include <QHash>
@ -104,4 +101,3 @@ class BoxSwitchEffect::ItemInfo
} // namespace
#endif
#endif

View file

@ -181,12 +181,23 @@ class KWIN_EXPORT EffectsHandler
//
virtual int currentDesktop() const = 0;
virtual int numberOfDesktops() const = 0;
virtual QString desktopName( int desktop ) const = 0;
virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const = 0;
virtual void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const = 0;
virtual bool optionRollOverDesktops() const = 0;
virtual EffectWindowList stackingOrder() const = 0;
virtual void setTabBoxWindow(EffectWindow*) = 0;
virtual void setTabBoxDesktop(int) = 0;
virtual EffectWindowList currentTabBoxWindowList() const = 0;
virtual void refTabBox() = 0;
virtual void unrefTabBox() = 0;
virtual void closeTabBox() = 0;
virtual QList< int > currentTabBoxDesktopList() const = 0;
virtual int currentTabBoxDesktop() const = 0;
virtual EffectWindow* currentTabBoxWindow() const = 0;
// Repaints the entire workspace
virtual void addRepaintFull() = 0;
virtual void addRepaint( const QRect& r ) = 0;
@ -262,6 +273,7 @@ class KWIN_EXPORT EffectWindow
virtual QRect iconGeometry() const = 0;
virtual QString caption() const = 0;
virtual QPixmap icon() const = 0;
virtual const EffectWindowGroup* group() const = 0;
virtual bool isDesktop() const = 0;

View file

@ -59,6 +59,10 @@ enum ElectricBorder
ElectricNone
};
// DesktopMode and WindowsMode are based on the order in which the desktop
// or window were viewed.
// DesktopListMode lists them in the order created.
enum TabBoxMode { TabBoxDesktopMode, TabBoxDesktopListMode, TabBoxWindowsMode };
class KWIN_EXPORT WindowPaintData
{

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef KWIN_TABBOX_H
#define KWIN_TABBOX_H
#include <Q3Frame>
#include <QFrame>
#include <QTimer>
#include "utils.h"
@ -24,57 +24,68 @@ namespace KWin
class Workspace;
class Client;
class TabBox : public Q3Frame
class TabBox : public QFrame
{
Q_OBJECT
public:
TabBox( Workspace *ws, const char *name=0 );
TabBox( Workspace *ws );
~TabBox();
Client* currentClient();
void setCurrentClient( Client* c );
ClientList currentClientList();
int currentDesktop();
QList< int > currentDesktopList();
// DesktopMode and WindowsMode are based on the order in which the desktop
// or window were viewed.
// DesktopListMode lists them in the order created.
enum Mode { DesktopMode, DesktopListMode, WindowsMode };
void setMode( Mode mode );
Mode mode() const;
void setCurrentClient( Client* newClient );
void setCurrentDesktop( int newDesktop );
void reset();
enum SortOrder { StaticOrder, MostRecentlyUsedOrder };
void setMode( TabBoxMode mode );
TabBoxMode mode() const;
void reset( bool partial_reset = false );
void nextPrev( bool next = true);
void delayedShow();
void hide();
void refDisplay();
void unrefDisplay();
bool isDisplayed() const;
void handleMouseEvent( XEvent* );
Workspace* workspace() const;
void reconfigure();
void updateKeyMapping();
public slots:
void show();
protected:
void showEvent( QShowEvent* );
void hideEvent( QHideEvent* );
void drawContents( QPainter * );
void paintEvent( QPaintEvent* );
private:
void createClientList(ClientList &list, int desktop /*-1 = all*/, Client *start, bool chain);
void updateOutline();
void createDesktopList(QList< int > &list, int start, SortOrder order);
private:
Client* current_client;
Mode m;
Workspace* wspace;
TabBoxMode m;
ClientList clients;
Client* client;
QList< int > desktops;
int desk;
QTimer delayedShowTimer;
int display_refcount;
QString no_tasks;
int lineHeight;
bool showMiniIcon;
QTimer delayedShowTimer;
QString no_tasks;
bool options_traverse_all;
Window outline_left, outline_right, outline_top, outline_bottom;
};
@ -87,15 +98,36 @@ inline Workspace* TabBox::workspace() const
}
/*!
Returns the current mode, either DesktopListMode or WindowsMode
Returns the current mode, either TabBoxDesktopListMode or TabBoxWindowsMode
\sa setMode()
*/
inline TabBox::Mode TabBox::mode() const
inline TabBoxMode TabBox::mode() const
{
return m;
}
/*!
Increase the reference count, preventing the default tabbox from showing.
\sa unrefDisplay(), isDisplayed()
*/
inline void TabBox::refDisplay()
{
++display_refcount;
}
/*!
Returns whether the tab box is being displayed, either natively or by an
effect.
\sa refDisplay(), unrefDisplay()
*/
inline bool TabBox::isDisplayed() const
{
return display_refcount > 0;
}
} // namespace
#endif

View file

@ -462,14 +462,14 @@ class Workspace : public QObject, public KDecorationDefines
void setupWindowShortcut( Client* c );
bool startKDEWalkThroughWindows();
bool startWalkThroughDesktops( int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
bool startWalkThroughDesktops( TabBoxMode mode ); // TabBoxDesktopMode | TabBoxDesktopListMode
bool startWalkThroughDesktops();
bool startWalkThroughDesktopList();
void KDEWalkThroughWindows( bool forward );
void CDEWalkThroughWindows( bool forward );
void walkThroughDesktops( bool forward );
void KDEOneStepThroughWindows( bool forward );
void oneStepThroughDesktops( bool forward, int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
void oneStepThroughDesktops( bool forward, TabBoxMode mode ); // TabBoxDesktopMode | TabBoxDesktopListMode
void oneStepThroughDesktops( bool forward );
void oneStepThroughDesktopList( bool forward );
bool establishTabBoxGrab();