Add an option so that windows can hover above the cube similar to 3D Windows plugin in Compiz. Currently this disables "windows overlapping edges" feature when this option is set (no change when not set).

FEATURE: 184689


svn path=/trunk/KDE/kdebase/workspace/; revision=927550
This commit is contained in:
Martin Gräßlin 2009-02-17 20:47:02 +00:00
parent ca901dae30
commit ed311a899d
4 changed files with 38 additions and 12 deletions

View file

@ -131,6 +131,7 @@ void CubeEffect::loadConfig( QString config )
invertKeys = conf.readEntry( "InvertKeys", false );
invertMouse = conf.readEntry( "InvertMouse", false );
capDeformationFactor = conf.readEntry( "CapDeformation", 0 )/100.0f;
useZOrdering = conf.readEntry( "ZOrdering", false );
QString file = conf.readEntry( "Wallpaper", QString("") );
if( wallpaper )
wallpaper->discard();
@ -1287,11 +1288,11 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int
if( w->isOnDesktop( painting_desktop ))
{
QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop );
if( w->x() < rect.x() )
if( w->x() < rect.x() && !useZOrdering )
{
data.quads = data.quads.splitAtX( -w->x() );
}
if( w->x() + w->width() > rect.x() + rect.width() )
if( w->x() + w->width() > rect.x() + rect.width() && !useZOrdering )
{
data.quads = data.quads.splitAtX( rect.width() - w->x() );
}
@ -1311,7 +1312,7 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int
int prev_desktop = painting_desktop -1;
if( prev_desktop == 0 )
prev_desktop = effects->numberOfDesktops();
if( w->isOnDesktop( prev_desktop ) )
if( w->isOnDesktop( prev_desktop ) && !useZOrdering )
{
QRect rect = effects->clientArea( FullArea, activeScreen, prev_desktop);
if( w->x()+w->width() > rect.x() + rect.width() )
@ -1335,7 +1336,7 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int
int next_desktop = painting_desktop +1;
if( next_desktop > effects->numberOfDesktops() )
next_desktop = 1;
if( w->isOnDesktop( next_desktop ) )
if( w->isOnDesktop( next_desktop ) && !useZOrdering )
{
QRect rect = effects->clientArea( FullArea, activeScreen, next_desktop);
if( w->x() < rect.x() )
@ -1405,6 +1406,16 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
if( painting_desktop == effects->currentDesktop() && (!w->isOnDesktop( painting_desktop )) )
opacity = cubeOpacity * (1.0 - timeLine.value());
}
// z-Ordering
if( !w->isDesktop() && !w->isDock() && useZOrdering )
{
float zOrdering = (effects->stackingOrder().indexOf( w )-1)*25.0;
if( start )
zOrdering *= timeLine.value();
if( stop )
zOrdering *= (1.0 - timeLine.value());
data.zTranslate += zOrdering;
}
// check for windows belonging to the previous desktop
int prev_desktop = painting_desktop -1;
if( prev_desktop == 0 )
@ -1412,7 +1423,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
int next_desktop = painting_desktop +1;
if( next_desktop > effects->numberOfDesktops() )
next_desktop = 1;
if( w->isOnDesktop( prev_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) )
if( w->isOnDesktop( prev_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) && !useZOrdering )
{
QRect rect = effects->clientArea( FullArea, activeScreen, prev_desktop);
data.xTranslate = -rect.width();
@ -1426,7 +1437,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
}
data.quads = new_quads;
}
if( w->isOnDesktop( next_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) )
if( w->isOnDesktop( next_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) && !useZOrdering )
{
QRect rect = effects->clientArea( FullArea, activeScreen, next_desktop);
data.xTranslate = rect.width();
@ -1468,7 +1479,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
opacity = 0.99f;
data.opacity *= opacity;
if( w->isOnDesktop(painting_desktop) && w->x() < rect.x() )
if( w->isOnDesktop(painting_desktop) && w->x() < rect.x() && !useZOrdering )
{
WindowQuadList new_quads;
foreach( const WindowQuad &quad, data.quads )
@ -1480,7 +1491,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
}
data.quads = new_quads;
}
if( w->isOnDesktop(painting_desktop) && w->x() + w->width() > rect.x() + rect.width() )
if( w->isOnDesktop(painting_desktop) && w->x() + w->width() > rect.x() + rect.width() && !useZOrdering )
{
WindowQuadList new_quads;
foreach( const WindowQuad &quad, data.quads )
@ -1547,7 +1558,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
}
}
}
effects->paintWindow( w, mask, region, data );
effects->paintWindow( w, PAINT_WINDOW_TRANSFORMED, region, data );
if( activated && cube_painting )
{
if( mode == Cylinder )

View file

@ -143,6 +143,7 @@ class CubeEffect
GLShader* cylinderShader;
GLShader* sphereShader;
float capDeformationFactor;
bool useZOrdering;
// GL lists
bool capListCreated;

View file

@ -94,6 +94,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->capDeformationSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->zOrderingBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
load();
}
@ -121,6 +122,7 @@ void CubeEffectConfig::load()
bool invertKeys = conf.readEntry( "InvertKeys", false );
bool invertMouse = conf.readEntry( "InvertMouse", false );
m_ui->capDeformationSlider->setValue( conf.readEntry( "CapDeformation", 0 ) );
bool zOrdering = conf.readEntry( "ZOrdering", false );
m_ui->rotationDurationSpin->setValue( duration );
m_ui->cubeOpacitySlider->setValue( opacity );
@ -186,6 +188,7 @@ void CubeEffectConfig::load()
m_ui->capColorButton->setColor( capColor );
m_ui->invertKeysBox->setChecked( invertKeys );
m_ui->invertMouseBox->setChecked( invertMouse );
m_ui->zOrderingBox->setChecked( zOrdering );
capsSelectionChanged();
emit changed(false);
@ -212,6 +215,7 @@ void CubeEffectConfig::save()
conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() );
conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() );
conf.writeEntry( "CapDeformation", m_ui->capDeformationSlider->value() );
conf.writeEntry( "ZOrdering", m_ui->zOrderingBox->isChecked() );
m_ui->editor->save();
@ -241,6 +245,7 @@ void CubeEffectConfig::defaults()
m_ui->invertKeysBox->setChecked( false );
m_ui->invertMouseBox->setChecked( false );
m_ui->capDeformationSlider->setValue( 0 );
m_ui->zOrderingBox->setChecked( false );
m_ui->editor->allDefault();
emit changed(true);
}

View file

@ -114,7 +114,7 @@
</property>
</widget>
</item>
<item row="2" column="0" >
<item row="3" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Rotation duration:</string>
@ -127,7 +127,7 @@
</property>
</widget>
</item>
<item row="2" column="1" >
<item row="3" column="1" >
<widget class="QSpinBox" name="rotationDurationSpin" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
@ -155,7 +155,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<item row="4" column="0" colspan="2" >
<spacer name="verticalSpacer_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
@ -168,6 +168,13 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="zOrderingBox" >
<property name="text" >
<string>Windows hover above cube</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -517,6 +524,7 @@ otherwise it will remain active</string>
<tabstop>tabWidget</tabstop>
<tabstop>displayDesktopNameBox</tabstop>
<tabstop>reflectionBox</tabstop>
<tabstop>zOrderingBox</tabstop>
<tabstop>rotationDurationSpin</tabstop>
<tabstop>cubeOpacitySlider</tabstop>
<tabstop>cubeOpacitySpin</tabstop>
@ -532,6 +540,7 @@ otherwise it will remain active</string>
<tabstop>invertKeysBox</tabstop>
<tabstop>invertMouseBox</tabstop>
<tabstop>zPositionSlider</tabstop>
<tabstop>capDeformationSlider</tabstop>
</tabstops>
<resources/>
<connections>