Make windowOpacityChanged() a slot
The method windowOpacityChanged is now a protected slot in class Scene. The implementations in the subclasses SceneOpenGL and SceneXRender are the same. The slots are connected to the singal opacityChanged() from Toplevel. The connection is done in the method windowAdded() in both SceneOpenGL and SceneXRender.
This commit is contained in:
parent
d88cb00b0b
commit
59a8aac752
7 changed files with 11 additions and 10 deletions
|
@ -572,7 +572,6 @@ bool Client::windowEvent(XEvent* e)
|
|||
if (compositing()) {
|
||||
addRepaintFull();
|
||||
emit opacityChanged(this, old_opacity);
|
||||
scene->windowOpacityChanged(this);
|
||||
} else {
|
||||
// forward to the frame if there's possibly another compositing manager running
|
||||
NETWinInfo2 i(display(), frameId(), rootWindow(), 0);
|
||||
|
@ -1580,7 +1579,6 @@ bool Unmanaged::windowEvent(XEvent* e)
|
|||
if (compositing()) {
|
||||
addRepaintFull();
|
||||
emit opacityChanged(this, old_opacity);
|
||||
scene->windowOpacityChanged(this);
|
||||
}
|
||||
}
|
||||
switch(e->type) {
|
||||
|
|
5
scene.h
5
scene.h
|
@ -59,8 +59,6 @@ public:
|
|||
|
||||
// shape/size of a window changed
|
||||
virtual void windowGeometryShapeChanged(Toplevel*) = 0;
|
||||
// opacity of a window changed
|
||||
virtual void windowOpacityChanged(Toplevel*) = 0;
|
||||
// a new window has been created
|
||||
virtual void windowAdded(Toplevel*) = 0;
|
||||
// a window has been closed
|
||||
|
@ -101,6 +99,9 @@ public:
|
|||
bool waitSyncAvailable() {
|
||||
return has_waitSync;
|
||||
}
|
||||
protected Q_SLOTS:
|
||||
// opacity of a window changed
|
||||
virtual void windowOpacityChanged(KWin::Toplevel* c) = 0;
|
||||
protected:
|
||||
// shared implementation, starts painting the screen
|
||||
void paintScreen(int* mask, QRegion* region);
|
||||
|
|
|
@ -213,6 +213,7 @@ void SceneOpenGL::windowAdded(Toplevel* c)
|
|||
{
|
||||
assert(!windows.contains(c));
|
||||
windows[ c ] = new Window(c);
|
||||
connect(c, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), SLOT(windowOpacityChanged(KWin::Toplevel*)));
|
||||
c->effectWindow()->setSceneWindow(windows[ c ]);
|
||||
c->getShadow();
|
||||
windows[ c ]->updateShadow(c->shadow());
|
||||
|
@ -251,7 +252,7 @@ void SceneOpenGL::windowGeometryShapeChanged(Toplevel* c)
|
|||
w->checkTextureSize();
|
||||
}
|
||||
|
||||
void SceneOpenGL::windowOpacityChanged(Toplevel*)
|
||||
void SceneOpenGL::windowOpacityChanged(KWin::Toplevel* t)
|
||||
{
|
||||
#if 0 // not really needed, windows are painted on every repaint
|
||||
// and opacity is used when applying texture, not when
|
||||
|
|
|
@ -52,7 +52,6 @@ public:
|
|||
}
|
||||
virtual void paint(QRegion damage, ToplevelList windows);
|
||||
virtual void windowGeometryShapeChanged(Toplevel*);
|
||||
virtual void windowOpacityChanged(Toplevel*);
|
||||
virtual void windowAdded(Toplevel*);
|
||||
virtual void windowClosed(Toplevel*, Deleted*);
|
||||
virtual void windowDeleted(Deleted*);
|
||||
|
@ -61,7 +60,8 @@ protected:
|
|||
virtual void paintGenericScreen(int mask, ScreenPaintData data);
|
||||
virtual void paintBackground(QRegion region);
|
||||
QMatrix4x4 transformation(int mask, const ScreenPaintData &data) const;
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void windowOpacityChanged(KWin::Toplevel* c);
|
||||
private:
|
||||
bool selectMode();
|
||||
bool initTfp();
|
||||
|
|
|
@ -299,7 +299,7 @@ void SceneXrender::windowGeometryShapeChanged(Toplevel* c)
|
|||
w->discardAlpha();
|
||||
}
|
||||
|
||||
void SceneXrender::windowOpacityChanged(Toplevel* c)
|
||||
void SceneXrender::windowOpacityChanged(KWin::Toplevel* c)
|
||||
{
|
||||
if (!windows.contains(c)) // this is ok, alpha is created on demand
|
||||
return;
|
||||
|
@ -335,6 +335,7 @@ void SceneXrender::windowAdded(Toplevel* c)
|
|||
{
|
||||
assert(!windows.contains(c));
|
||||
windows[ c ] = new Window(c);
|
||||
connect(c, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), SLOT(windowOpacityChanged(KWin::Toplevel*)));
|
||||
c->effectWindow()->setSceneWindow(windows[ c ]);
|
||||
c->getShadow();
|
||||
windows[ c ]->updateShadow(c->shadow());
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
}
|
||||
virtual void paint(QRegion damage, ToplevelList windows);
|
||||
virtual void windowGeometryShapeChanged(Toplevel*);
|
||||
virtual void windowOpacityChanged(Toplevel*);
|
||||
virtual void windowAdded(Toplevel*);
|
||||
virtual void windowClosed(Toplevel*, Deleted*);
|
||||
virtual void windowDeleted(Deleted*);
|
||||
|
@ -56,6 +55,8 @@ public:
|
|||
protected:
|
||||
virtual void paintBackground(QRegion region);
|
||||
virtual void paintGenericScreen(int mask, ScreenPaintData data);
|
||||
protected Q_SLOTS:
|
||||
virtual void windowOpacityChanged(KWin::Toplevel* c);
|
||||
private:
|
||||
void paintTransformedScreen(int mask);
|
||||
void createBuffer();
|
||||
|
|
|
@ -323,7 +323,6 @@ void Toplevel::setOpacity(double new_opacity)
|
|||
if (compositing()) {
|
||||
addRepaintFull();
|
||||
emit opacityChanged(this, old_opacity);
|
||||
scene->windowOpacityChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue