Make the opacity slider and wheel operations work again.
svn path=/branches/work/kwin_composite/; revision=558740
This commit is contained in:
parent
bab62bf88f
commit
1719127d3f
9 changed files with 30 additions and 21 deletions
|
@ -1793,13 +1793,20 @@ bool Client::hasShape( Window w )
|
||||||
return boundingShaped != 0;
|
return boundingShaped != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Client::opacity() const
|
double Client::opacity() const
|
||||||
{
|
{
|
||||||
if( info->opacity() == 0xffffffff )
|
if( info->opacity() == 0xffffffff )
|
||||||
return 1.0;
|
return 1.0;
|
||||||
return info->opacity() * 1.0 / 0xffffffff;
|
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
|
void Client::debug( kdbgstream& stream ) const
|
||||||
{
|
{
|
||||||
stream << "\'ID:" << window() << ";WMCLASS:" << resourceClass() << ":" << resourceName() << ";Caption:" << caption() << "\'";
|
stream << "\'ID:" << window() << ";WMCLASS:" << resourceClass() << ":" << resourceName() << ";Caption:" << caption() << "\'";
|
||||||
|
|
3
client.h
3
client.h
|
@ -192,7 +192,8 @@ class Client
|
||||||
bool shape() const;
|
bool shape() const;
|
||||||
void updateShape();
|
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( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet );
|
||||||
void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet );
|
void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet );
|
||||||
|
|
|
@ -32,7 +32,6 @@ void Workspace::setupCompositing()
|
||||||
return;
|
return;
|
||||||
if( scene != NULL )
|
if( scene != NULL )
|
||||||
return;
|
return;
|
||||||
// TODO start tracking unmanaged windows
|
|
||||||
compositeTimer.start( 20 );
|
compositeTimer.start( 20 );
|
||||||
XCompositeRedirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
|
XCompositeRedirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
|
||||||
// scene = new SceneBasic( this );
|
// scene = new SceneBasic( this );
|
||||||
|
@ -54,7 +53,6 @@ void Workspace::finishCompositing()
|
||||||
c->finishCompositing();
|
c->finishCompositing();
|
||||||
XCompositeUnredirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
|
XCompositeUnredirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
|
||||||
compositeTimer.stop();
|
compositeTimer.stop();
|
||||||
// TODO stop tracking unmanaged windows
|
|
||||||
delete scene;
|
delete scene;
|
||||||
scene = NULL;
|
scene = NULL;
|
||||||
for( ClientList::ConstIterator it = clients.begin();
|
for( ClientList::ConstIterator it = clients.begin();
|
||||||
|
@ -64,7 +62,7 @@ void Workspace::finishCompositing()
|
||||||
if( (*it)->opacity() != 1.0 )
|
if( (*it)->opacity() != 1.0 )
|
||||||
{
|
{
|
||||||
NETWinInfo i( display(), (*it)->frameId(), rootWindow(), 0 );
|
NETWinInfo i( display(), (*it)->frameId(), rootWindow(), 0 );
|
||||||
i.setOpacity( long((*it)->opacity() * 0xffffffff ));
|
i.setOpacity( static_cast< unsigned long >((*it)->opacity() * 0xffffffff ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,14 @@ class Matrix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Matrix();
|
Matrix();
|
||||||
float m[ 4 ][ 4 ];
|
double m[ 4 ][ 4 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectData
|
class EffectData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Matrix matrix;
|
Matrix matrix;
|
||||||
float opacity;
|
double opacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Effect
|
class Effect
|
||||||
|
|
|
@ -16,11 +16,11 @@ namespace KWinInternal
|
||||||
{
|
{
|
||||||
|
|
||||||
Toplevel::Toplevel( Workspace* ws )
|
Toplevel::Toplevel( Workspace* ws )
|
||||||
: id( None )
|
: vis( None )
|
||||||
|
, id( None )
|
||||||
, wspace( ws )
|
, wspace( ws )
|
||||||
, damage_handle( None )
|
, damage_handle( None )
|
||||||
, window_pixmap( None )
|
, window_pixmap( None )
|
||||||
, vis( None )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Toplevel
|
||||||
int height() const;
|
int height() const;
|
||||||
Pixmap windowPixmap() const;
|
Pixmap windowPixmap() const;
|
||||||
Visual* visual() const;
|
Visual* visual() const;
|
||||||
virtual float opacity() const = 0;
|
virtual double opacity() const = 0;
|
||||||
void setupCompositing();
|
void setupCompositing();
|
||||||
void finishCompositing();
|
void finishCompositing();
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -63,7 +63,7 @@ void Unmanaged::deleteUnmanaged( Unmanaged* c, allowed_t )
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Unmanaged::opacity() const
|
double Unmanaged::opacity() const
|
||||||
{
|
{
|
||||||
if( info->opacity() == 0xffffffff )
|
if( info->opacity() == 0xffffffff )
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Unmanaged
|
||||||
void release();
|
void release();
|
||||||
bool track( Window w );
|
bool track( Window w );
|
||||||
static void deleteUnmanaged( Unmanaged* c, allowed_t );
|
static void deleteUnmanaged( Unmanaged* c, allowed_t );
|
||||||
virtual float opacity() const;
|
virtual double opacity() const;
|
||||||
protected:
|
protected:
|
||||||
virtual void debug( kdbgstream& stream ) const;
|
virtual void debug( kdbgstream& stream ) const;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -164,10 +164,18 @@ QMenu* Workspace::clientPopup()
|
||||||
return popup;
|
return popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sets the transparency of the client to given value(given by slider)
|
|
||||||
void Workspace::setPopupClientOpacity(int value)
|
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)
|
void Workspace::setTransButtonText(int value)
|
||||||
|
@ -183,11 +191,6 @@ void Workspace::setTransButtonText(int value)
|
||||||
transButton->setText('0'+QString::number(value)+" %");
|
transButton->setText('0'+QString::number(value)+" %");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::resetClientOpacity()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
The client popup menu will become visible soon.
|
The client popup menu will become visible soon.
|
||||||
|
@ -641,10 +644,10 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
|
||||||
workspace()->windowToNextDesktop( this );
|
workspace()->windowToNextDesktop( this );
|
||||||
break;
|
break;
|
||||||
case Options::MouseOpacityMore:
|
case Options::MouseOpacityMore:
|
||||||
// TODO
|
setOpacity( qMin( opacity() + 0.1, 1.0 ));
|
||||||
break;
|
break;
|
||||||
case Options::MouseOpacityLess:
|
case Options::MouseOpacityLess:
|
||||||
// TODO
|
setOpacity( qMax( opacity() - 0.1, 0.0 ));
|
||||||
break;
|
break;
|
||||||
case Options::MouseNothing:
|
case Options::MouseNothing:
|
||||||
replay = true;
|
replay = true;
|
||||||
|
|
Loading…
Reference in a new issue