Make the opacity slider and wheel operations work again.

svn path=/branches/work/kwin_composite/; revision=558740
This commit is contained in:
Luboš Luňák 2006-07-05 22:26:34 +00:00
parent bab62bf88f
commit 1719127d3f
9 changed files with 30 additions and 21 deletions

View file

@ -1793,13 +1793,20 @@ bool Client::hasShape( Window w )
return boundingShaped != 0;
}
float Client::opacity() const
double Client::opacity() const
{
if( info->opacity() == 0xffffffff )
return 1.0;
return info->opacity() * 1.0 / 0xffffffff;
}
void Client::setOpacity( double opacity )
{
opacity = qBound( 0.0, opacity, 1.0 );
info->setOpacity( static_cast< unsigned long >( opacity * 0xffffffff ));
// we'll react on PropertyNotify
}
void Client::debug( kdbgstream& stream ) const
{
stream << "\'ID:" << window() << ";WMCLASS:" << resourceClass() << ":" << resourceName() << ";Caption:" << caption() << "\'";

View file

@ -192,7 +192,8 @@ class Client
bool shape() const;
void updateShape();
virtual float opacity() const;
virtual double opacity() const;
void setOpacity( double opacity );
void setGeometry( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet );
void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet );

View file

@ -32,7 +32,6 @@ void Workspace::setupCompositing()
return;
if( scene != NULL )
return;
// TODO start tracking unmanaged windows
compositeTimer.start( 20 );
XCompositeRedirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
// scene = new SceneBasic( this );
@ -54,7 +53,6 @@ void Workspace::finishCompositing()
c->finishCompositing();
XCompositeUnredirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
compositeTimer.stop();
// TODO stop tracking unmanaged windows
delete scene;
scene = NULL;
for( ClientList::ConstIterator it = clients.begin();
@ -64,7 +62,7 @@ void Workspace::finishCompositing()
if( (*it)->opacity() != 1.0 )
{
NETWinInfo i( display(), (*it)->frameId(), rootWindow(), 0 );
i.setOpacity( long((*it)->opacity() * 0xffffffff ));
i.setOpacity( static_cast< unsigned long >((*it)->opacity() * 0xffffffff ));
}
}
}

View file

@ -23,14 +23,14 @@ class Matrix
{
public:
Matrix();
float m[ 4 ][ 4 ];
double m[ 4 ][ 4 ];
};
class EffectData
{
public:
Matrix matrix;
float opacity;
double opacity;
};
class Effect

View file

@ -16,11 +16,11 @@ namespace KWinInternal
{
Toplevel::Toplevel( Workspace* ws )
: id( None )
: vis( None )
, id( None )
, wspace( ws )
, damage_handle( None )
, window_pixmap( None )
, vis( None )
{
}

View file

@ -41,7 +41,7 @@ class Toplevel
int height() const;
Pixmap windowPixmap() const;
Visual* visual() const;
virtual float opacity() const = 0;
virtual double opacity() const = 0;
void setupCompositing();
void finishCompositing();
protected:

View file

@ -63,7 +63,7 @@ void Unmanaged::deleteUnmanaged( Unmanaged* c, allowed_t )
delete c;
}
float Unmanaged::opacity() const
double Unmanaged::opacity() const
{
if( info->opacity() == 0xffffffff )
return 1.0;

View file

@ -29,7 +29,7 @@ class Unmanaged
void release();
bool track( Window w );
static void deleteUnmanaged( Unmanaged* c, allowed_t );
virtual float opacity() const;
virtual double opacity() const;
protected:
virtual void debug( kdbgstream& stream ) const;
private:

View file

@ -164,10 +164,18 @@ QMenu* Workspace::clientPopup()
return popup;
}
//sets the transparency of the client to given value(given by slider)
void Workspace::setPopupClientOpacity(int value)
{
// TODO
if( active_popup_client == NULL )
return;
active_popup_client->setOpacity( value / 100.0 );
}
void Workspace::resetClientOpacity()
{
if( active_popup_client == NULL )
return;
active_popup_client->setOpacity( 1.0 );
}
void Workspace::setTransButtonText(int value)
@ -183,11 +191,6 @@ void Workspace::setTransButtonText(int value)
transButton->setText('0'+QString::number(value)+" %");
}
void Workspace::resetClientOpacity()
{
// TODO
}
/*!
The client popup menu will become visible soon.
@ -641,10 +644,10 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
workspace()->windowToNextDesktop( this );
break;
case Options::MouseOpacityMore:
// TODO
setOpacity( qMin( opacity() + 0.1, 1.0 ));
break;
case Options::MouseOpacityLess:
// TODO
setOpacity( qMax( opacity() - 0.1, 0.0 ));
break;
case Options::MouseNothing:
replay = true;