Some first attempt at effects interface.

svn path=/branches/work/kwin_composite/; revision=558191
This commit is contained in:
Luboš Luňák 2006-07-04 20:51:01 +00:00
parent 06e47c10db
commit 4f12c1e606
6 changed files with 126 additions and 2 deletions

View file

@ -46,7 +46,8 @@ set(kwin_KDEINIT_SRCS
rules.cpp rules.cpp
composite.cpp composite.cpp
toplevel.cpp toplevel.cpp
unmanaged.cpp ) unmanaged.cpp
effects.cpp )
kde4_automoc(${kwin_KDEINIT_SRCS}) kde4_automoc(${kwin_KDEINIT_SRCS})

View file

@ -12,6 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "workspace.h" #include "workspace.h"
#include "client.h" #include "client.h"
#include "unmanaged.h" #include "unmanaged.h"
#include "effects.h"
namespace KWinInternal namespace KWinInternal
{ {
@ -63,21 +64,30 @@ void Workspace::compositeTimeout()
it != stackingOrder().end(); it != stackingOrder().end();
++it ) ++it )
{ {
#if 1
(*it)->windowPixmap(); // trigger creation
effects->paintWindow( *it );
#else
QRect r = (*it)->geometry().intersect( QRect( 0, 0, displayWidth(), displayHeight())); QRect r = (*it)->geometry().intersect( QRect( 0, 0, displayWidth(), displayHeight()));
if( !r.isEmpty()) if( !r.isEmpty())
{ {
XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc, XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc,
qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y()); qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y());
} }
#endif
} }
for( UnmanagedList::ConstIterator it = unmanaged.begin(); for( UnmanagedList::ConstIterator it = unmanaged.begin();
it != unmanaged.end(); it != unmanaged.end();
++it ) ++it )
{ {
#if 1
effects->paintWorkspace( this );
#else
QRect r = (*it)->geometry().intersect( QRect( 0, 0, displayWidth(), displayHeight())); QRect r = (*it)->geometry().intersect( QRect( 0, 0, displayWidth(), displayHeight()));
if( !r.isEmpty()) if( !r.isEmpty())
XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc, XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc,
qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y()); qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y());
#endif
} }
XCopyArea( display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0 ); XCopyArea( display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0 );
XFreeGC( display(), gc ); XFreeGC( display(), gc );

62
effects.cpp Normal file
View file

@ -0,0 +1,62 @@
/*****************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
You can Freely distribute this program under the GNU General Public
License. See the file "COPYING" for the exact licensing terms.
******************************************************************/
#include "effects.h"
namespace KWinInternal
{
//****************************************
// Effect
//****************************************
Effect::~Effect()
{
}
void Effect::windowUserMoved( Toplevel* )
{
}
void Effect::windowUserResized( Toplevel* )
{
}
void Effect::paintWindow( Toplevel* )
{
}
void Effect::paintWorkspace( Workspace* )
{
}
//****************************************
// EffectsHandler
//****************************************
void EffectsHandler::windowUserMoved( Toplevel* c )
{
}
void EffectsHandler::windowUserResized( Toplevel* c )
{
}
void EffectsHandler::paintWindow( Toplevel* c )
{
}
void EffectsHandler::paintWorkspace( Workspace* )
{
}
EffectsHandler* effects;
} // namespace

43
effects.h Normal file
View file

@ -0,0 +1,43 @@
/*****************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
You can Freely distribute this program under the GNU General Public
License. See the file "COPYING" for the exact licensing terms.
******************************************************************/
#ifndef KWIN_EFFECTS_H
#define KWIN_EFFECTS_H
namespace KWinInternal
{
class Toplevel;
class Workspace;
class Effect
{
public:
virtual ~Effect();
virtual void windowUserMoved( Toplevel* c );
virtual void windowUserResized( Toplevel* c );
virtual void paintWindow( Toplevel* c );
virtual void paintWorkspace( Workspace* );
};
class EffectsHandler
{
public:
void windowUserMoved( Toplevel* c );
void windowUserResized( Toplevel* c );
void paintWindow( Toplevel* c );
void paintWorkspace( Workspace* );
};
extern EffectsHandler* effects;
} // namespace
#endif

View file

@ -28,6 +28,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "notifications.h" #include "notifications.h"
#include "geometrytip.h" #include "geometrytip.h"
#include "rules.h" #include "rules.h"
#include "effects.h"
#include <QX11Info> #include <QX11Info>
#include <QDesktopWidget> #include <QDesktopWidget>
@ -2549,7 +2550,10 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root )
} }
if ( isMove() ) if ( isMove() )
workspace()->clientMoved(globalPos, xTime()); workspace()->clientMoved(globalPos, xTime());
if( isMove())
effects->windowUserMoved( this );
else
effects->windowUserResized( this );
} }
} // namespace } // namespace

View file

@ -30,6 +30,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "options.h" #include "options.h"
#include "sm.h" #include "sm.h"
#include "utils.h" #include "utils.h"
#include "effects.h"
#define INT8 _X11INT8 #define INT8 _X11INT8
#define INT32 _X11INT32 #define INT32 _X11INT32
@ -117,6 +118,7 @@ Application::Application( )
options = new Options; options = new Options;
atoms = new Atoms; atoms = new Atoms;
effects = new EffectsHandler;
// create workspace. // create workspace.
(void) new Workspace( isSessionRestored() ); (void) new Workspace( isSessionRestored() );
@ -143,6 +145,8 @@ Application::~Application()
if( owner.ownerWindow() != None ) // if there was no --replace (no new WM) if( owner.ownerWindow() != None ) // if there was no --replace (no new WM)
XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() ); XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() );
delete options; delete options;
delete effects;
delete atoms;
} }
void Application::lostSelection() void Application::lostSelection()