Commit 640fdc7b authored by Martin Flöser's avatar Martin Flöser

PropertyNotify becomes a signal

parent f134a5c6
......@@ -105,6 +105,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type)
connect(ws, SIGNAL(numberDesktopsChanged(int)), SIGNAL(numberDesktopsChanged(int)));
connect(ws, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
connect(ws, SIGNAL(propertyNotify(long)), this, SLOT(slotPropertyNotify(long)));
connect(ws->tabBox(), SIGNAL(tabBoxAdded(int)), SIGNAL(tabBoxAdded(int)));
connect(ws->tabBox(), SIGNAL(tabBoxUpdated()), SIGNAL(tabBoxUpdated()));
connect(ws->tabBox(), SIGNAL(tabBoxClosed()), SIGNAL(tabBoxClosed()));
......@@ -138,6 +139,7 @@ void EffectsHandlerImpl::setupClientConnections(Client* c)
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)));
connect(c, SIGNAL(propertyNotify(KWin::Toplevel*,long)), this, SLOT(slotPropertyNotify(KWin::Toplevel*,long)));
}
void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u)
......@@ -146,6 +148,7 @@ void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u)
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)));
connect(u, SIGNAL(propertyNotify(KWin::Toplevel*,long)), this, SLOT(slotPropertyNotify(KWin::Toplevel*,long)));
}
void EffectsHandlerImpl::reconfigure()
......@@ -492,12 +495,18 @@ bool EffectsHandlerImpl::hasKeyboardGrab() const
return keyboard_grab_effect != NULL;
}
void EffectsHandlerImpl::propertyNotify(EffectWindow* c, long atom)
void EffectsHandlerImpl::slotPropertyNotify(Toplevel* t, long int atom)
{
if (!registered_atoms.contains(atom))
return;
foreach (const EffectPair & ep, loaded_effects)
ep.second->propertyNotify(c, atom);
emit propertyNotify(t->effectWindow(), atom);
}
void EffectsHandlerImpl::slotPropertyNotify(long int atom)
{
if (!registered_atoms.contains(atom))
return;
emit propertyNotify(NULL, atom);
}
void EffectsHandlerImpl::registerPropertyType(long atom, bool reg)
......
......@@ -162,7 +162,6 @@ public:
bool borderActivated(ElectricBorder border);
void grabbedKeyboardEvent(QKeyEvent* e);
bool hasKeyboardGrab() const;
void propertyNotify(EffectWindow* c, long atom);
bool loadEffect(const QString& name);
void toggleEffect(const QString& name);
......@@ -195,6 +194,8 @@ protected Q_SLOTS:
void slotClientGeometryShapeChanged(KWin::Client *c, const QRect &old);
void slotUnmanagedGeometryShapeChanged(KWin::Unmanaged *u, const QRect &old);
void slotWindowDamaged(KWin::Toplevel *t, const QRect& r);
void slotPropertyNotify(KWin::Toplevel *t, long atom);
void slotPropertyNotify(long atom);
protected:
KLibrary* findEffectLibrary(KService* service);
......
......@@ -58,6 +58,7 @@ BlurEffect::BlurEffect()
XDeleteProperty(display(), rootWindow(), net_wm_blur_region);
}
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(propertyNotify(EffectWindow*,long)), this, SLOT(slotPropertyNotify(EffectWindow*,long)));
}
BlurEffect::~BlurEffect()
......@@ -112,7 +113,7 @@ void BlurEffect::slotWindowAdded(EffectWindow *w)
updateBlurRegion(w);
}
void BlurEffect::propertyNotify(EffectWindow *w, long atom)
void BlurEffect::slotPropertyNotify(EffectWindow *w, long atom)
{
if (w && atom == net_wm_blur_region)
updateBlurRegion(w);
......
......@@ -41,13 +41,13 @@ public:
static bool supported();
void reconfigure(ReconfigureFlags flags);
void propertyNotify(EffectWindow *w, long atom);
void paintScreen(int mask, QRegion region, ScreenPaintData &data);
void drawWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data);
void paintEffectFrame(EffectFrame *frame, QRegion region, double opacity, double frameOpacity);
public Q_SLOTS:
void slotWindowAdded(EffectWindow *w);
void slotPropertyNotify(EffectWindow *w, long atom);
private:
QRect expand(const QRect &rect) const;
......
......@@ -41,6 +41,7 @@ HighlightWindowEffect::HighlightWindowEffect()
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(propertyNotify(EffectWindow*,long)), this, SLOT(slotPropertyNotify(EffectWindow*,long)));
}
HighlightWindowEffect::~HighlightWindowEffect()
......@@ -115,7 +116,7 @@ void HighlightWindowEffect::slotWindowAdded(EffectWindow* w)
else
m_windowOpacity[w] = 1.0;
}
propertyNotify(w, m_atom); // Check initial value
slotPropertyNotify(w, m_atom); // Check initial value
}
void HighlightWindowEffect::slotWindowClosed(EffectWindow* w)
......@@ -129,7 +130,7 @@ void HighlightWindowEffect::slotWindowDeleted(EffectWindow* w)
m_windowOpacity.remove(w);
}
void HighlightWindowEffect::propertyNotify(EffectWindow* w, long a)
void HighlightWindowEffect::slotPropertyNotify(EffectWindow* w, long a)
{
if (a != m_atom)
return; // Not our atom
......
......@@ -37,12 +37,11 @@ public:
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void propertyNotify(EffectWindow* w, long atom);
public Q_SLOTS:
void slotWindowAdded(EffectWindow* w);
void slotWindowClosed(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
void slotPropertyNotify(EffectWindow* w, long atom);
private:
void prepareHighlighting();
......
......@@ -63,6 +63,7 @@ LogoutEffect::LogoutEffect()
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(propertyNotify(EffectWindow*,long)), this, SLOT(slotPropertyNotify(EffectWindow*,long)));
}
LogoutEffect::~LogoutEffect()
......@@ -366,7 +367,7 @@ void LogoutEffect::renderVignetting()
}
#endif
void LogoutEffect::propertyNotify(EffectWindow* w, long a)
void LogoutEffect::slotPropertyNotify(EffectWindow* w, long a)
{
if (w || a != logoutAtom)
return; // Not our atom
......
......@@ -44,11 +44,11 @@ public:
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
virtual void postPaintScreen();
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void propertyNotify(EffectWindow* w, long a);
public Q_SLOTS:
void slotWindowAdded(EffectWindow* w);
void slotWindowClosed(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
void slotPropertyNotify(EffectWindow *w, long a);
private:
bool isLogoutDialog(EffectWindow* w);
double progress; // 0-1
......
......@@ -106,6 +106,7 @@ PresentWindowsEffect::PresentWindowsEffect()
connect(effects, SIGNAL(tabBoxClosed()), this, SLOT(slotTabBoxClosed()));
connect(effects, SIGNAL(tabBoxUpdated()), this, SLOT(slotTabBoxUpdated()));
connect(effects, SIGNAL(tabBoxKeyEvent(QKeyEvent*)), this, SLOT(slotTabBoxKeyEvent(QKeyEvent*)));
connect(effects, SIGNAL(propertyNotify(EffectWindow*,long)), this, SLOT(slotPropertyNotify(EffectWindow*,long)));
}
PresentWindowsEffect::~PresentWindowsEffect()
......@@ -741,7 +742,7 @@ void PresentWindowsEffect::slotTabBoxKeyEvent(QKeyEvent* event)
//-----------------------------------------------------------------------------
// Atom handling
void PresentWindowsEffect::propertyNotify(EffectWindow* w, long a)
void PresentWindowsEffect::slotPropertyNotify(EffectWindow* w, long a)
{
if (!w || (a != m_atomDesktop && a != m_atomWindows))
return; // Not our atom
......
......@@ -106,9 +106,6 @@ public:
virtual void windowInputMouseEvent(Window w, QEvent *e);
virtual void grabbedKeyboardEvent(QKeyEvent *e);
// atoms
virtual void propertyNotify(EffectWindow* w, long atom);
enum { LayoutNatural, LayoutRegularGrid, LayoutFlexibleGrid }; // Layout modes
enum PresentWindowsMode {
ModeAllDesktops, // Shows windows of all desktops
......@@ -160,6 +157,8 @@ public slots:
void slotTabBoxClosed();
void slotTabBoxUpdated();
void slotTabBoxKeyEvent(QKeyEvent* event);
// atoms
void slotPropertyNotify(EffectWindow* w, long atom);
private slots:
void closeWindow();
......
......@@ -41,6 +41,7 @@ SlidingPopupsEffect::SlidingPopupsEffect()
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(propertyNotify(EffectWindow*,long)), this, SLOT(slotPropertyNotify(EffectWindow*,long)));
}
SlidingPopupsEffect::~SlidingPopupsEffect()
......@@ -136,7 +137,7 @@ void SlidingPopupsEffect::postPaintWindow(EffectWindow* w)
void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
{
propertyNotify(w, mAtom);
slotPropertyNotify(w, mAtom);
if (w->isOnCurrentDesktop() && mWindowsData.contains(w)) {
mAppearingWindows[ w ].setDuration(mWindowsData[ w ].fadeInDuration);
mAppearingWindows[ w ].setProgress(0.0);
......@@ -151,7 +152,7 @@ void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
void SlidingPopupsEffect::slotWindowClosed(EffectWindow* w)
{
propertyNotify(w, mAtom);
slotPropertyNotify(w, mAtom);
if (w->isOnCurrentDesktop() && !w->isMinimized() && mWindowsData.contains(w)) {
w->refWindow();
mAppearingWindows.remove(w);
......@@ -174,7 +175,7 @@ void SlidingPopupsEffect::slotWindowDeleted(EffectWindow* w)
effects->addRepaint(w->geometry());
}
void SlidingPopupsEffect::propertyNotify(EffectWindow* w, long a)
void SlidingPopupsEffect::slotPropertyNotify(EffectWindow* w, long a)
{
if (!w || a != mAtom)
return;
......
......@@ -39,12 +39,12 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintWindow(EffectWindow* w);
// TODO react also on virtual desktop changes
virtual void propertyNotify(EffectWindow* w, long a);
public Q_SLOTS:
void slotWindowAdded(EffectWindow *c);
void slotWindowClosed(EffectWindow *c);
void slotWindowDeleted(EffectWindow *w);
void slotPropertyNotify(EffectWindow *w, long a);
private:
enum Position {
West = 0,
......
......@@ -46,6 +46,7 @@ TaskbarThumbnailEffect::TaskbarThumbnailEffect()
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)));
connect(effects, SIGNAL(propertyNotify(EffectWindow*,long)), this, SLOT(slotPropertyNotify(EffectWindow*,long)));
}
TaskbarThumbnailEffect::~TaskbarThumbnailEffect()
......@@ -123,7 +124,7 @@ void TaskbarThumbnailEffect::slotWindowDamaged(EffectWindow* w, const QRect& dam
void TaskbarThumbnailEffect::slotWindowAdded(EffectWindow* w)
{
propertyNotify(w, atom); // read initial value
slotPropertyNotify(w, atom); // read initial value
}
void TaskbarThumbnailEffect::slotWindowDeleted(EffectWindow* w)
......@@ -131,7 +132,7 @@ void TaskbarThumbnailEffect::slotWindowDeleted(EffectWindow* w)
thumbnails.remove(w);
}
void TaskbarThumbnailEffect::propertyNotify(EffectWindow* w, long a)
void TaskbarThumbnailEffect::slotPropertyNotify(EffectWindow* w, long a)
{
if (!w || a != atom)
return;
......
......@@ -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 propertyNotify(EffectWindow* w, long atom);
public Q_SLOTS:
void slotWindowAdded(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
void slotWindowDamaged(EffectWindow* w, const QRect& damage);
void slotPropertyNotify(EffectWindow *w, long atom);
private:
struct Data {
Window window; // thumbnail of this window
......
......@@ -301,9 +301,9 @@ bool Workspace::workspaceEvent(XEvent * e)
}
// We want to pass root window property events to effects
if (e->type == PropertyNotify && e->xany.window == rootWindow() && effects) {
if (e->type == PropertyNotify && e->xany.window == rootWindow()) {
XPropertyEvent* re = &e->xproperty;
static_cast< EffectsHandlerImpl* >(effects)->propertyNotify(NULL, re->atom);
emit propertyNotify(re->atom);
}
}
if (movingClient != NULL && movingClient->moveResizeGrabWindow() == e->xany.window
......@@ -1691,8 +1691,7 @@ void Toplevel::propertyNotifyEvent(XPropertyEvent* e)
getWindowRole();
break;
}
if (effects)
static_cast< EffectsHandlerImpl* >(effects)->propertyNotify(effectWindow(), e->atom);
emit propertyNotify(this, e->atom);
}
// ****************************************
......
......@@ -131,10 +131,6 @@ void Effect::grabbedKeyboardEvent(QKeyEvent*)
{
}
void Effect::propertyNotify(EffectWindow* , long)
{
}
bool Effect::borderActivated(ElectricBorder)
{
return false;
......
......@@ -444,14 +444,6 @@ public:
virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
virtual void windowInputMouseEvent(Window w, QEvent* e);
virtual void grabbedKeyboardEvent(QKeyEvent* e);
/**
Receives events registered for using EffectsHandler::registerPropertyType().
Use readProperty() to get the property data.
Note that the property may be already set on the window, so doing the same
processing from windowAdded() (e.g. simply calling propertyNotify() from it)
is usually needed.
*/
virtual void propertyNotify(EffectWindow* w, long atom);
virtual bool borderActivated(ElectricBorder border);
......@@ -960,6 +952,17 @@ Q_SIGNALS:
void mouseChanged(const QPoint& pos, const QPoint& oldpos,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
/**
* Receives events registered for using @link registerPropertyType.
* Use readProperty() to get the property data.
* Note that the property may be already set on the window, so doing the same
* processing from windowAdded() (e.g. simply calling propertyNotify() from it)
* is usually needed.
* @param w The window whose property changed, is @c null if it is a root window property
* @param atom The property
* @since 4.7
*/
void propertyNotify(EffectWindow* w, long atom);
protected:
QVector< EffectPair > loaded_effects;
......
......@@ -138,6 +138,7 @@ public:
signals:
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
void damaged(KWin::Toplevel* toplevel, const QRect& damage);
void propertyNotify(KWin::Toplevel* toplevel, long a);
protected:
virtual ~Toplevel();
......
......@@ -932,6 +932,7 @@ signals:
void mouseChanged(const QPoint& pos, const QPoint& oldpos,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
void propertyNotify(long a);
private:
void init();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment