Basic transformations on the whole workspace.
svn path=/branches/work/kwin_composite/; revision=559204
This commit is contained in:
parent
e6c23e4cd3
commit
28e3726f2e
4 changed files with 80 additions and 22 deletions
45
effects.cpp
45
effects.cpp
|
@ -136,7 +136,7 @@ void Effect::transformWindow( Toplevel*, Matrix&, EffectData& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect::transformWorkspace( Workspace*, Matrix&, EffectData& )
|
void Effect::transformWorkspace( Matrix&, EffectData& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,19 +239,44 @@ void GrowMove::windowUserMovedResized( Toplevel* c, bool first, bool last )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShiftWorkspaceUp::ShiftWorkspaceUp( Workspace* ws )
|
||||||
|
: up( false )
|
||||||
|
, wspace( ws )
|
||||||
|
{
|
||||||
|
connect( &timer, SIGNAL( timeout()), SLOT( tick()));
|
||||||
|
timer.start( 2000 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShiftWorkspaceUp::transformWorkspace( Matrix& matrix, EffectData& )
|
||||||
|
{
|
||||||
|
if( !up )
|
||||||
|
return;
|
||||||
|
Matrix m;
|
||||||
|
m.m[ 1 ][ 3 ] = -10;
|
||||||
|
matrix *= m;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShiftWorkspaceUp::tick()
|
||||||
|
{
|
||||||
|
up = !up;
|
||||||
|
wspace->addDamage( 0, 0, displayWidth(), displayHeight());
|
||||||
|
}
|
||||||
|
|
||||||
static MakeHalfTransparent* mht;
|
static MakeHalfTransparent* mht;
|
||||||
static ShakyMove* sm;
|
static ShakyMove* sm;
|
||||||
static GrowMove* gm;
|
static GrowMove* gm;
|
||||||
|
static ShiftWorkspaceUp* swu;
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
// EffectsHandler
|
// EffectsHandler
|
||||||
//****************************************
|
//****************************************
|
||||||
|
|
||||||
EffectsHandler::EffectsHandler()
|
EffectsHandler::EffectsHandler( Workspace* ws )
|
||||||
{
|
{
|
||||||
mht = new MakeHalfTransparent;
|
mht = new MakeHalfTransparent;
|
||||||
sm = new ShakyMove;
|
sm = new ShakyMove;
|
||||||
// gm = new GrowMove;
|
// gm = new GrowMove;
|
||||||
|
swu = new ShiftWorkspaceUp( ws );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandler::windowUserMovedResized( Toplevel* c, bool first, bool last )
|
void EffectsHandler::windowUserMovedResized( Toplevel* c, bool first, bool last )
|
||||||
|
@ -262,6 +287,8 @@ void EffectsHandler::windowUserMovedResized( Toplevel* c, bool first, bool last
|
||||||
sm->windowUserMovedResized( c, first, last );
|
sm->windowUserMovedResized( c, first, last );
|
||||||
if( gm )
|
if( gm )
|
||||||
gm->windowUserMovedResized( c, first, last );
|
gm->windowUserMovedResized( c, first, last );
|
||||||
|
if( swu )
|
||||||
|
swu->windowUserMovedResized( c, first, last );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandler::transformWindow( Toplevel* c, Matrix& matrix, EffectData& data )
|
void EffectsHandler::transformWindow( Toplevel* c, Matrix& matrix, EffectData& data )
|
||||||
|
@ -272,16 +299,20 @@ void EffectsHandler::transformWindow( Toplevel* c, Matrix& matrix, EffectData& d
|
||||||
sm->transformWindow( c, matrix, data );
|
sm->transformWindow( c, matrix, data );
|
||||||
if( gm )
|
if( gm )
|
||||||
gm->transformWindow( c, matrix, data );
|
gm->transformWindow( c, matrix, data );
|
||||||
|
if( swu )
|
||||||
|
swu->transformWindow( c, matrix, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandler::transformWorkspace( Workspace* w, Matrix& matrix, EffectData& data )
|
void EffectsHandler::transformWorkspace( Matrix& matrix, EffectData& data )
|
||||||
{
|
{
|
||||||
if( mht )
|
if( mht )
|
||||||
mht->transformWorkspace( w, matrix, data );
|
mht->transformWorkspace( matrix, data );
|
||||||
if( sm )
|
if( sm )
|
||||||
sm->transformWorkspace( w, matrix, data );
|
sm->transformWorkspace( matrix, data );
|
||||||
if( gm )
|
if( gm )
|
||||||
gm->transformWorkspace( w, matrix, data );
|
gm->transformWorkspace( matrix, data );
|
||||||
|
if( swu )
|
||||||
|
swu->transformWorkspace( matrix, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandler::windowDeleted( Toplevel* c )
|
void EffectsHandler::windowDeleted( Toplevel* c )
|
||||||
|
@ -292,6 +323,8 @@ void EffectsHandler::windowDeleted( Toplevel* c )
|
||||||
sm->windowDeleted( c );
|
sm->windowDeleted( c );
|
||||||
if( gm )
|
if( gm )
|
||||||
gm->windowDeleted( c );
|
gm->windowDeleted( c );
|
||||||
|
if( swu )
|
||||||
|
swu->windowDeleted( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectsHandler* effects;
|
EffectsHandler* effects;
|
||||||
|
|
21
effects.h
21
effects.h
|
@ -73,17 +73,17 @@ class Effect
|
||||||
virtual void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
virtual void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
||||||
virtual void windowDeleted( Toplevel* c );
|
virtual void windowDeleted( Toplevel* c );
|
||||||
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
||||||
virtual void transformWorkspace( Workspace*, Matrix& m, EffectData& data );
|
virtual void transformWorkspace( Matrix& m, EffectData& data );
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectsHandler
|
class EffectsHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EffectsHandler();
|
EffectsHandler( Workspace* ws );
|
||||||
void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
||||||
void windowDeleted( Toplevel* c );
|
void windowDeleted( Toplevel* c );
|
||||||
void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
||||||
void transformWorkspace( Workspace*, Matrix& m, EffectData& data );
|
void transformWorkspace( Matrix& m, EffectData& data );
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EffectsHandler* effects;
|
extern EffectsHandler* effects;
|
||||||
|
@ -120,6 +120,21 @@ class GrowMove
|
||||||
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ShiftWorkspaceUp
|
||||||
|
: public QObject, public Effect
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ShiftWorkspaceUp( Workspace* ws );
|
||||||
|
virtual void transformWorkspace( Matrix& m, EffectData& data );
|
||||||
|
private slots:
|
||||||
|
void tick();
|
||||||
|
private:
|
||||||
|
QTimer timer;
|
||||||
|
bool up;
|
||||||
|
Workspace* wspace;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
32
main.cpp
32
main.cpp
|
@ -29,6 +29,8 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#include "atoms.h"
|
#include "atoms.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "sm.h"
|
#include "sm.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "effects.h"
|
||||||
|
|
||||||
#define INT8 _X11INT8
|
#define INT8 _X11INT8
|
||||||
#define INT32 _X11INT32
|
#define INT32 _X11INT32
|
||||||
|
@ -93,7 +95,7 @@ Application::Application( )
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen_number == -1)
|
if (screen_number == -1)
|
||||||
screen_number = DefaultScreen(QX11Info::display());
|
screen_number = DefaultScreen(display());
|
||||||
|
|
||||||
if( !owner.claim( args->isSet( "replace" ), true ))
|
if( !owner.claim( args->isSet( "replace" ), true ))
|
||||||
{
|
{
|
||||||
|
@ -111,14 +113,18 @@ Application::Application( )
|
||||||
XSetErrorHandler( x11ErrorHandler );
|
XSetErrorHandler( x11ErrorHandler );
|
||||||
|
|
||||||
// check whether another windowmanager is running
|
// check whether another windowmanager is running
|
||||||
XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), SubstructureRedirectMask );
|
XSelectInput(display(), rootWindow(), SubstructureRedirectMask );
|
||||||
syncX(); // trigger error now
|
syncX(); // trigger error now
|
||||||
|
|
||||||
options = new Options;
|
options = new Options;
|
||||||
atoms = new Atoms;
|
atoms = new Atoms;
|
||||||
|
|
||||||
|
initting = false; // TODO
|
||||||
|
|
||||||
// create workspace.
|
// create workspace.
|
||||||
(void) new Workspace( isSessionRestored() );
|
Workspace* workspace = new Workspace( isSessionRestored() );
|
||||||
|
|
||||||
|
effects = new EffectsHandler( workspace );
|
||||||
|
|
||||||
syncX(); // trigger possible errors, there's still a chance to abort
|
syncX(); // trigger possible errors, there's still a chance to abort
|
||||||
|
|
||||||
|
@ -128,27 +134,29 @@ Application::Application( )
|
||||||
ksplash.call( "upAndRunning", QString( "wm started" ));
|
ksplash.call( "upAndRunning", QString( "wm started" ));
|
||||||
XEvent e;
|
XEvent e;
|
||||||
e.xclient.type = ClientMessage;
|
e.xclient.type = ClientMessage;
|
||||||
e.xclient.message_type = XInternAtom( QX11Info::display(), "_KDE_SPLASH_PROGRESS", False );
|
e.xclient.message_type = XInternAtom( display(), "_KDE_SPLASH_PROGRESS", False );
|
||||||
e.xclient.display = QX11Info::display();
|
e.xclient.display = display();
|
||||||
e.xclient.window = QX11Info::appRootWindow();
|
e.xclient.window = rootWindow();
|
||||||
e.xclient.format = 8;
|
e.xclient.format = 8;
|
||||||
strcpy( e.xclient.data.b, "wm started" );
|
strcpy( e.xclient.data.b, "wm started" );
|
||||||
XSendEvent( QX11Info::display(), QX11Info::appRootWindow(), False, SubstructureNotifyMask, &e );
|
XSendEvent( display(), rootWindow(), False, SubstructureNotifyMask, &e );
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
{
|
{
|
||||||
delete Workspace::self();
|
delete Workspace::self();
|
||||||
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( QX11Info::display(), PointerRoot, RevertToPointerRoot, QX11Info::appTime() );
|
XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() );
|
||||||
delete options;
|
delete options;
|
||||||
|
delete effects;
|
||||||
|
delete atoms;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::lostSelection()
|
void Application::lostSelection()
|
||||||
{
|
{
|
||||||
delete Workspace::self();
|
delete Workspace::self();
|
||||||
// remove windowmanager privileges
|
// remove windowmanager privileges
|
||||||
XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), PropertyChangeMask );
|
XSelectInput(display(), rootWindow(), PropertyChangeMask );
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,13 +280,13 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
|
||||||
KWinInternal::SessionManaged weAreIndeed;
|
KWinInternal::SessionManaged weAreIndeed;
|
||||||
KWinInternal::SessionSaveDoneHelper helper;
|
KWinInternal::SessionSaveDoneHelper helper;
|
||||||
|
|
||||||
fcntl(ConnectionNumber(QX11Info::display()), F_SETFD, 1);
|
fcntl(XConnectionNumber(KWinInternal::display()), F_SETFD, 1);
|
||||||
|
|
||||||
QString appname;
|
QString appname;
|
||||||
if (KWinInternal::screen_number == 0)
|
if (KWinInternal::screen_number == 0)
|
||||||
appname = "org.kde.kwin";
|
appname = "kwin";
|
||||||
else
|
else
|
||||||
appname.sprintf("org.kde.kwin-screen-%d", KWinInternal::screen_number);
|
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
|
||||||
|
|
||||||
QDBus::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService );
|
QDBus::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService );
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ void SceneXrender::paint( XserverRegion damage, ToplevelList windows )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
effects->transformWindow( c, data.matrix, data.effect ); // TODO remove, instead add initWindow() to effects
|
effects->transformWindow( c, data.matrix, data.effect ); // TODO remove, instead add initWindow() to effects
|
||||||
|
effects->transformWorkspace( data.matrix, data.effect );
|
||||||
saveWindowClipRegion( c, damage );
|
saveWindowClipRegion( c, damage );
|
||||||
if( data.simpleTransformation() && isOpaque( c ))
|
if( data.simpleTransformation() && isOpaque( c ))
|
||||||
{ // is opaque, has simple shape, can be clipped, will be painted using simpler faster method
|
{ // is opaque, has simple shape, can be clipped, will be painted using simpler faster method
|
||||||
|
@ -172,6 +173,7 @@ void SceneXrender::updateTransformation( Toplevel* c )
|
||||||
resetWindowData( c );
|
resetWindowData( c );
|
||||||
WindowData& data = window_data[ c ];
|
WindowData& data = window_data[ c ];
|
||||||
effects->transformWindow( c, data.matrix, data.effect );
|
effects->transformWindow( c, data.matrix, data.effect );
|
||||||
|
effects->transformWorkspace( data.matrix, data.effect );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneXrender::resetWindowData( Toplevel* c )
|
void SceneXrender::resetWindowData( Toplevel* c )
|
||||||
|
@ -319,7 +321,7 @@ void SceneXrender::createBuffer()
|
||||||
XFreePixmap( display(), pixmap ); // The picture owns the pixmap now
|
XFreePixmap( display(), pixmap ); // The picture owns the pixmap now
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneXrender::setPictureMatrix( Picture pic, const Matrix& m )
|
void SceneXrender::setPictureMatrix( Picture pic, const Matrix& )
|
||||||
{
|
{
|
||||||
if( pic == None )
|
if( pic == None )
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue