WindowGeometryShapeChanged becomes a signal

This commit is contained in:
Martin Gräßlin 2011-03-12 12:34:59 +01:00
parent dcebc7481b
commit 911098ee76
17 changed files with 59 additions and 36 deletions

View file

@ -366,8 +366,7 @@ void Client::updateDecoration(bool check_workspace_pos, bool force)
discardWindowPixmap();
if (scene != NULL)
scene->windowGeometryShapeChanged(this);
if (effects != NULL)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), oldgeom);
emit clientGeometryShapeChanged(this, oldgeom);
} else
destroyDecoration();
if (check_workspace_pos)
@ -396,8 +395,9 @@ void Client::destroyDecoration()
discardWindowPixmap();
if (scene != NULL && !deleting)
scene->windowGeometryShapeChanged(this);
if (effects != NULL && !deleting)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), oldgeom);
if (!deleting) {
emit clientGeometryShapeChanged(this, oldgeom);
}
}
}
@ -739,8 +739,7 @@ void Client::updateShape()
}
if (scene != NULL)
scene->windowGeometryShapeChanged(this);
if (effects != NULL)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), geometry());
emit clientGeometryShapeChanged(this, geometry());
}
static Window shape_helper_window = None;
@ -818,8 +817,7 @@ void Client::setMask(const QRegion& reg, int mode)
}
if (scene != NULL)
scene->windowGeometryShapeChanged(this);
if (effects != NULL)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), geometry());
emit clientGeometryShapeChanged(this, geometry());
updateShape();
}

View file

@ -498,6 +498,7 @@ signals:
void clientMaximizedStateChanged(KWin::Client*, KDecorationDefines::MaximizeMode);
void clientMinimized(KWin::Client* client, bool animate);
void clientUnminimized(KWin::Client* client, bool animate);
void clientGeometryShapeChanged(KWin::Client* client, const QRect& old);
// To make workspace-client calls, a few slots are also
// required

View file

@ -134,12 +134,14 @@ void EffectsHandlerImpl::setupClientConnections(Client* c)
connect(c, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal)));
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)));
}
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)));
}
void EffectsHandlerImpl::reconfigure()
@ -395,12 +397,22 @@ void EffectsHandlerImpl::windowDamaged(EffectWindow* w, const QRect& r)
ep.second->windowDamaged(w, r);
}
void EffectsHandlerImpl::windowGeometryShapeChanged(EffectWindow* w, const QRect& old)
void EffectsHandlerImpl::slotClientGeometryShapeChanged(Client* c, const QRect& old)
{
if (w == NULL) // during late cleanup effectWindow() may be already NULL
return; // in some functions that may still call this
foreach (const EffectPair & ep, loaded_effects)
ep.second->windowGeometryShapeChanged(w, old);
// during late cleanup effectWindow() may be already NULL
// in some functions that may still call this
if (c == NULL || c->effectWindow() == NULL)
return;
emit windowGeometryShapeChanged(c->effectWindow(), old);
}
void EffectsHandlerImpl::slotUnmanagedGeometryShapeChanged(Unmanaged* u, const QRect& old)
{
// during late cleanup effectWindow() may be already NULL
// in some functions that may still call this
if (u == NULL || u->effectWindow() == NULL)
return;
emit windowGeometryShapeChanged(u->effectWindow(), old);
}
void EffectsHandlerImpl::setActiveFullScreenEffect(Effect* e)

View file

@ -160,7 +160,6 @@ public:
void startPaint();
void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
void windowDamaged(EffectWindow* w, const QRect& r);
void windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
bool borderActivated(ElectricBorder border);
void mouseChanged(const QPoint& pos, const QPoint& oldpos,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
@ -197,6 +196,8 @@ protected Q_SLOTS:
void slotOpacityChanged(KWin::Toplevel *t, qreal oldOpacity);
void slotClientMinimized(KWin::Client *c, bool animate);
void slotClientUnminimized(KWin::Client *c, bool animate);
void slotClientGeometryShapeChanged(KWin::Client *c, const QRect &old);
void slotUnmanagedGeometryShapeChanged(KWin::Unmanaged *u, const QRect &old);
protected:
KLibrary* findEffectLibrary(KService* service);

View file

@ -61,6 +61,7 @@ BoxSwitchEffect::BoxSwitchEffect()
connect(effects, SIGNAL(tabBoxAdded(int)), this, SLOT(slotTabBoxAdded(int)));
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)));
}
BoxSwitchEffect::~BoxSwitchEffect()
@ -273,7 +274,7 @@ void BoxSwitchEffect::windowDamaged(EffectWindow* w, const QRect& damage)
}
}
void BoxSwitchEffect::windowGeometryShapeChanged(EffectWindow* w, const QRect& old)
void BoxSwitchEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const QRect& old)
{
if (mActivated) {
if (mMode == TabBoxWindowsMode || mMode == TabBoxWindowsAlternativeMode) {

View file

@ -54,7 +54,6 @@ public:
virtual void windowInputMouseEvent(Window w, QEvent* e);
virtual void windowDamaged(EffectWindow* w, const QRect& damage);
virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
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 slotTabBoxAdded(int mode);
void slotTabBoxClosed();
void slotTabBoxUpdated();
void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old);
private:
class ItemInfo;

View file

@ -77,6 +77,7 @@ DesktopGridEffect::DesktopGridEffect()
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(numberDesktopsChanged(int)), this, SLOT(slotNumberDesktopsChanged(int)));
connect(effects, SIGNAL(windowGeometryShapeChanged(EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(EffectWindow*,QRect)));
// Load all other configuration details
reconfigure(ReconfigureAll);
@ -439,7 +440,7 @@ void DesktopGridEffect::slotWindowDeleted(EffectWindow* w)
}
}
void DesktopGridEffect::windowGeometryShapeChanged(EffectWindow* w, const QRect& old)
void DesktopGridEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const QRect& old)
{
Q_UNUSED(old)
if (!activated)

View file

@ -71,7 +71,6 @@ public:
virtual void postPaintScreen();
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
virtual void windowInputMouseEvent(Window w, QEvent* e);
virtual void grabbedKeyboardEvent(QKeyEvent* e);
virtual bool borderActivated(ElectricBorder border);
@ -89,6 +88,7 @@ private slots:
void slotWindowClosed(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
void slotNumberDesktopsChanged(int old);
void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old);
private:
QPointF scalePos(const QPoint& pos, int desktop, int screen = -1) const;

View file

@ -101,6 +101,7 @@ PresentWindowsEffect::PresentWindowsEffect()
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(windowGeometryShapeChanged(EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(EffectWindow*,QRect)));
connect(effects, SIGNAL(tabBoxAdded(int)), this, SLOT(slotTabBoxAdded(int)));
connect(effects, SIGNAL(tabBoxClosed()), this, SLOT(slotTabBoxClosed()));
connect(effects, SIGNAL(tabBoxUpdated()), this, SLOT(slotTabBoxUpdated()));
@ -419,7 +420,7 @@ void PresentWindowsEffect::slotWindowDeleted(EffectWindow *w)
m_motionManager.unmanage(w);
}
void PresentWindowsEffect::windowGeometryShapeChanged(EffectWindow* w, const QRect& old)
void PresentWindowsEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const QRect& old)
{
Q_UNUSED(old)
if (!m_activated)

View file

@ -102,7 +102,6 @@ public:
virtual void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data);
// User interaction
virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
virtual bool borderActivated(ElectricBorder border);
virtual void windowInputMouseEvent(Window w, QEvent *e);
virtual void grabbedKeyboardEvent(QKeyEvent *e);
@ -155,6 +154,7 @@ public slots:
void slotWindowAdded(EffectWindow *w);
void slotWindowClosed(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
void slotWindowGeometryShapeChanged(EffectWindow *w, const QRect &old);
// Tab box
void slotTabBoxAdded(int mode);
void slotTabBoxClosed();

View file

@ -39,6 +39,7 @@ ThumbnailAsideEffect::ThumbnailAsideEffect()
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T));
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)));
reconfigure(ReconfigureAll);
}
@ -75,7 +76,7 @@ void ThumbnailAsideEffect::windowDamaged(EffectWindow* w, const QRect&)
}
}
void ThumbnailAsideEffect::windowGeometryShapeChanged(EffectWindow* w, const QRect& old)
void ThumbnailAsideEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const QRect& old)
{
foreach (const Data & d, windows) {
if (d.window == w) {

View file

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

View file

@ -1636,8 +1636,7 @@ bool Unmanaged::windowEvent(XEvent* e)
addWorkspaceRepaint(geometry()); // in case shape change removes part of this window
if (scene != NULL)
scene->windowGeometryShapeChanged(this);
if (effects != NULL)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), geometry());
emit unmanagedGeometryShapeChanged(this, geometry());
}
#ifdef HAVE_XDAMAGE
if (e->type == Extensions::damageNotifyEvent())
@ -1672,8 +1671,7 @@ void Unmanaged::configureNotifyEvent(XConfigureEvent* e)
discardWindowPixmap();
if (scene != NULL)
scene->windowGeometryShapeChanged(this);
if (effects != NULL)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), old);
emit unmanagedGeometryShapeChanged(this, old);
}
}

View file

@ -1913,8 +1913,7 @@ void Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force, bool
discardWindowPixmap();
if (scene != NULL)
scene->windowGeometryShapeChanged(this);
if (effects != NULL)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), geom_before_block);
emit clientGeometryShapeChanged(this, geom_before_block);
}
const QRect deco_rect = decorationRect().translated(geom.x(), geom.y());
addWorkspaceRepaint(deco_rect_before_block);
@ -1991,8 +1990,7 @@ void Client::plainResize(int w, int h, ForceGeometry_t force, bool emitJs)
discardWindowPixmap();
if (scene != NULL)
scene->windowGeometryShapeChanged(this);
if (effects != NULL)
static_cast<EffectsHandlerImpl*>(effects)->windowGeometryShapeChanged(effectWindow(), geom_before_block);
emit clientGeometryShapeChanged(this, geom_before_block);
const QRect deco_rect = decorationRect().translated(geom.x(), geom.y());
addWorkspaceRepaint(deco_rect_before_block);
addWorkspaceRepaint(deco_rect);

View file

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

View file

@ -444,7 +444,6 @@ public:
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 windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
virtual void mouseChanged(const QPoint& pos, const QPoint& oldpos,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
@ -856,14 +855,29 @@ Q_SIGNALS:
* @since 4.7
**/
void windowDeleted(EffectWindow *w);
/** Signal emitted when window moved/resized or once after it's finished.
/**
* Signal emitted when window moved/resized or once after it's finished.
* If both @p first and @p last are true, @p w got maximized/restored.
* This signal is emitted during user interaction and not when the window
* changes it's size itself. The latter case triggers the windowGeometryShapeChanged signal.
* @param w The window which is being moved or resized
* @param first @c true if first change
* @param last @c true if last change, that is move/resize finished.
* @see windowGeometryShapeChanged
* @since 4.7
**/
void windowUserMovedResized(EffectWindow *w, bool first, bool last);
/**
* Signal emitted when the geometry or shape of a window changed.
* This is caused if the window changes geometry without user interaction.
* E.g. the decoration is changed. This is in opposite to windowUserMovedResized
* which is caused by direct user interaction.
* @param w The window whose geometry changed
* @param old The previous geometry
* @see windowUserMovedResized
* @since 4.7
**/
void windowGeometryShapeChanged(EffectWindow *w, const QRect &old);
/**
* Signal emitted when the windows opacity is changed.
* @param w The window whose opacity level is changed.

View file

@ -48,6 +48,7 @@ protected:
virtual bool shouldUnredirect() const;
Q_SIGNALS:
void unmanagedClosed(KWin::Unmanaged*);
void unmanagedGeometryShapeChanged(KWin::Unmanaged*, const QRect&);
private:
virtual ~Unmanaged(); // use release()
// handlers for X11 events