WindowDamaged becomes a signal

This commit is contained in:
Martin Gräßlin 2011-03-12 15:04:22 +01:00
parent 39ab2cf29e
commit 88d50727ee
12 changed files with 25 additions and 19 deletions

View file

@ -825,7 +825,7 @@ void Toplevel::addDamage(int x, int y, int w, int h)
r &= rect();
damage_region += r;
repaints_region += r;
static_cast<EffectsHandlerImpl*>(effects)->windowDamaged(effectWindow(), r);
emit damaged(this, r);
// discard lanczos texture
if (effect_window) {
QVariant cachedTextureVariant = effect_window->data(LanczosCacheRole);
@ -845,7 +845,7 @@ void Toplevel::addDamageFull()
return;
damage_region = rect();
repaints_region = rect();
static_cast<EffectsHandlerImpl*>(effects)->windowDamaged(effectWindow(), rect());
emit damaged(this, rect());
// discard lanczos texture
if (effect_window) {
QVariant cachedTextureVariant = effect_window->data(LanczosCacheRole);

View file

@ -137,6 +137,7 @@ void EffectsHandlerImpl::setupClientConnections(Client* c)
connect(c, SIGNAL(clientMinimized(KWin::Client*,bool)), this, SLOT(slotClientMinimized(KWin::Client*,bool)));
connect(c, SIGNAL(clientUnminimized(KWin::Client*,bool)), this, SLOT(slotClientUnminimized(KWin::Client*,bool)));
connect(c, SIGNAL(clientGeometryShapeChanged(KWin::Client*,QRect)), this, SLOT(slotClientGeometryShapeChanged(KWin::Client*,QRect)));
connect(c, SIGNAL(damaged(KWin::Toplevel*,QRect)), this, SLOT(slotWindowDamaged(KWin::Toplevel*,QRect)));
}
void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u)
@ -144,6 +145,7 @@ void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u)
connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*)));
connect(u, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal)));
connect(u, SIGNAL(unmanagedGeometryShapeChanged(KWin::Unmanaged*,QRect)), this, SLOT(slotUnmanagedGeometryShapeChanged(KWin::Unmanaged*,QRect)));
connect(u, SIGNAL(damaged(KWin::Toplevel*,QRect)), this, SLOT(slotWindowDamaged(KWin::Toplevel*,QRect)));
}
void EffectsHandlerImpl::reconfigure()
@ -391,12 +393,9 @@ void EffectsHandlerImpl::slotDesktopChanged(int old)
}
}
void EffectsHandlerImpl::windowDamaged(EffectWindow* w, const QRect& r)
void EffectsHandlerImpl::slotWindowDamaged(Toplevel* t, const QRect& r)
{
if (w == NULL)
return;
foreach (const EffectPair & ep, loaded_effects)
ep.second->windowDamaged(w, r);
emit windowDamaged(t->effectWindow(), r);
}
void EffectsHandlerImpl::slotClientGeometryShapeChanged(Client* c, const QRect& old)

View file

@ -159,7 +159,6 @@ public:
// internal (used by kwin core or compositing code)
void startPaint();
void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
void windowDamaged(EffectWindow* w, const QRect& r);
bool borderActivated(ElectricBorder border);
void grabbedKeyboardEvent(QKeyEvent* e);
bool hasKeyboardGrab() const;
@ -195,6 +194,7 @@ protected Q_SLOTS:
void slotClientUnminimized(KWin::Client *c, bool animate);
void slotClientGeometryShapeChanged(KWin::Client *c, const QRect &old);
void slotUnmanagedGeometryShapeChanged(KWin::Unmanaged *u, const QRect &old);
void slotWindowDamaged(KWin::Toplevel *t, const QRect& r);
protected:
KLibrary* findEffectLibrary(KService* service);

View file

@ -62,6 +62,7 @@ BoxSwitchEffect::BoxSwitchEffect()
connect(effects, SIGNAL(tabBoxClosed()), this, SLOT(slotTabBoxClosed()));
connect(effects, SIGNAL(tabBoxUpdated()), this, SLOT(slotTabBoxUpdated()));
connect(effects, SIGNAL(windowGeometryShapeChanged(EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(EffectWindow*,QRect)));
connect(effects, SIGNAL(windowDamaged(EffectWindow*,QRect)), this, SLOT(slotWindowDamaged(EffectWindow*,QRect)));
}
BoxSwitchEffect::~BoxSwitchEffect()
@ -255,7 +256,7 @@ void BoxSwitchEffect::windowInputMouseEvent(Window w, QEvent* e)
}
}
void BoxSwitchEffect::windowDamaged(EffectWindow* w, const QRect& damage)
void BoxSwitchEffect::slotWindowDamaged(EffectWindow* w, const QRect& damage)
{
Q_UNUSED(damage);
if (mActivated) {

View file

@ -53,7 +53,6 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void windowInputMouseEvent(Window w, QEvent* e);
virtual void windowDamaged(EffectWindow* w, const QRect& damage);
virtual void* proxy();
void activateFromProxy(int mode, bool animate, bool showText, float positioningFactor);
void paintWindowsBox(const QRegion& region);
@ -64,6 +63,7 @@ public Q_SLOTS:
void slotTabBoxClosed();
void slotTabBoxUpdated();
void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old);
void slotWindowDamaged(EffectWindow* w, const QRect& damage);
private:
class ItemInfo;

View file

@ -45,6 +45,7 @@ TaskbarThumbnailEffect::TaskbarThumbnailEffect()
XChangeProperty(display(), rootWindow(), atom, atom, 8, PropModeReplace, &dummy, 1);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(windowDamaged(EffectWindow*,QRect)), this, SLOT(slotWindowDamaged(EffectWindow*,QRect)));
}
TaskbarThumbnailEffect::~TaskbarThumbnailEffect()
@ -110,7 +111,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi
}
} // End of function
void TaskbarThumbnailEffect::windowDamaged(EffectWindow* w, const QRect& damage)
void TaskbarThumbnailEffect::slotWindowDamaged(EffectWindow* w, const QRect& damage)
{
Q_UNUSED(damage);
// Update the thumbnail if the window was damaged

View file

@ -38,12 +38,12 @@ public:
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void windowDamaged(EffectWindow* w, const QRect& damage);
virtual void propertyNotify(EffectWindow* w, long atom);
public Q_SLOTS:
void slotWindowAdded(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
void slotWindowDamaged(EffectWindow* w, const QRect& damage);
private:
struct Data {
Window window; // thumbnail of this window

View file

@ -40,6 +40,7 @@ ThumbnailAsideEffect::ThumbnailAsideEffect()
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail()));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowGeometryShapeChanged(EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(EffectWindow*,QRect)));
connect(effects, SIGNAL(windowDamaged(EffectWindow*,QRect)), this, SLOT(slotWindowDamaged(EffectWindow*,QRect)));
reconfigure(ReconfigureAll);
}
@ -68,7 +69,7 @@ void ThumbnailAsideEffect::paintScreen(int mask, QRegion region, ScreenPaintData
}
}
void ThumbnailAsideEffect::windowDamaged(EffectWindow* w, const QRect&)
void ThumbnailAsideEffect::slotWindowDamaged(EffectWindow* w, const QRect&)
{
foreach (const Data & d, windows) {
if (d.window == w)

View file

@ -43,11 +43,11 @@ public:
ThumbnailAsideEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
virtual void windowDamaged(EffectWindow* w, const QRect& damage);
private slots:
void toggleCurrentThumbnail();
void slotWindowClosed(EffectWindow *w);
void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old);
void slotWindowDamaged(EffectWindow* w, const QRect& damage);
private:
void addThumbnail(EffectWindow* w);
void removeThumbnail(EffectWindow* w);

View file

@ -135,10 +135,6 @@ void Effect::propertyNotify(EffectWindow* , long)
{
}
void Effect::windowDamaged(EffectWindow*, const QRect&)
{
}
bool Effect::borderActivated(ElectricBorder)
{
return false;

View file

@ -443,7 +443,6 @@ public:
/** called when the geometry changed during moving/resizing. */
virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
virtual void windowInputMouseEvent(Window w, QEvent* e);
virtual void windowDamaged(EffectWindow* w, const QRect& r);
virtual void grabbedKeyboardEvent(QKeyEvent* e);
/**
Receives events registered for using EffectsHandler::registerPropertyType().
@ -895,6 +894,14 @@ Q_SIGNALS:
* @since 4.7
**/
void windowUnminimized(EffectWindow *w);
/**
* Signal emitted when an area of a window is scheduled for repainting.
* Use this signal in an effect if another area needs to be synced as well.
* @param w The window which is scheduled for repainting
* @param r The damaged rect
* @since 4.7
**/
void windowDamaged(EffectWindow *w, const QRect &r);
/**
* Signal emitted when a tabbox is added.
* An effect who wants to replace the tabbox with itself should use @link refTabBox.

View file

@ -137,6 +137,7 @@ public:
signals:
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
void damaged(KWin::Toplevel* toplevel, const QRect& damage);
protected:
virtual ~Toplevel();