Signal for windowUserMovedResize

In core a new signal is added for maximizedState change of client.
Other function calls remain as direct calls for the moment.
This commit is contained in:
Martin Gräßlin 2011-02-28 21:03:13 +01:00
parent e355700e6e
commit eeb10c69d5
18 changed files with 47 additions and 27 deletions

View file

@ -495,6 +495,7 @@ signals:
void s_activated();
void s_fullScreenSet(bool, bool);
void clientClosed(KWin::Client*);
void clientMaximizedStateChanged(KWin::Client*, KDecorationDefines::MaximizeMode);
// To make workspace-client calls, a few slots are also
// required

View file

@ -104,6 +104,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type)
// connect all clients
foreach (Client *c, ws->clientList()) {
connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*)));
connect(c, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)), this, SLOT(slotClientMaximized(KWin::Client*,KDecorationDefines::MaximizeMode)));
}
foreach (Unmanaged *u, ws->unmanagedList()) {
connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*)));
@ -270,10 +271,14 @@ void EffectsHandlerImpl::startPaint()
assert(current_transform == 0);
}
void EffectsHandlerImpl::windowUserMovedResized(EffectWindow* c, bool first, bool last)
void EffectsHandlerImpl::slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode)
{
foreach (const EffectPair & ep, loaded_effects)
ep.second->windowUserMovedResized(c, first, last);
emit windowUserMovedResized(c->effectWindow(), true, true);
}
void EffectsHandlerImpl::slotWindowUserMovedResized(EffectWindow* c, bool first, bool last)
{
emit windowUserMovedResized(c, first, last);
}
void EffectsHandlerImpl::windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry)
@ -295,6 +300,7 @@ void EffectsHandlerImpl::windowOpacityChanged(EffectWindow* c, double old_opacit
void EffectsHandlerImpl::slotClientAdded(Client *c)
{
connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*)));
connect(c, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)), this, SLOT(slotClientMaximized(KWin::Client*,KDecorationDefines::MaximizeMode)));
emit windowAdded(c->effectWindow());
}

View file

@ -158,7 +158,6 @@ public:
// internal (used by kwin core or compositing code)
void startPaint();
void windowUserMovedResized(EffectWindow* c, bool first, bool last);
void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
void windowOpacityChanged(EffectWindow* c, double old_opacity);
void windowMinimized(EffectWindow* c);
@ -191,6 +190,9 @@ public:
QList<EffectWindow*> elevatedWindows() const;
public Q_SLOTS:
void slotWindowUserMovedResized(EffectWindow* c, bool first, bool last);
protected Q_SLOTS:
void slotDesktopChanged(int old);
void slotClientAdded(KWin::Client *c);
@ -199,6 +201,7 @@ protected Q_SLOTS:
void slotUnmanagedClosed(KWin::Unmanaged *u);
void slotClientActivated(KWin::Client *c);
void slotDeletedRemoved(KWin::Deleted *d);
void slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode);
protected:
KLibrary* findEffectLibrary(KService* service);

View file

@ -39,6 +39,7 @@ CubeSlideEffect::CubeSlideEffect()
, progressRestriction(0.0f)
{
connect(effects, SIGNAL(desktopChanged(int, int)), this, SLOT(slotDesktopChanged(int, int)));
connect(effects, SIGNAL(windowUserMovedResized(EffectWindow*,bool,bool)), this, SLOT(slotWindowUserMovedResized(EffectWindow*,bool,bool)));
reconfigure(ReconfigureAll);
}
@ -529,7 +530,7 @@ void CubeSlideEffect::slotDesktopChanged(int old, int current)
}
}
void CubeSlideEffect::windowUserMovedResized(EffectWindow* c, bool first, bool last)
void CubeSlideEffect::slotWindowUserMovedResized(EffectWindow* c, bool first, bool last)
{
if (!useWindowMoving)
return;

View file

@ -41,12 +41,12 @@ 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 windowUserMovedResized(EffectWindow* c, bool first, bool last);
static bool supported();
private Q_SLOTS:
void slotDesktopChanged(int old, int current);
void slotWindowUserMovedResized(EffectWindow *w, bool first, bool last);
private:
enum RotationDirection {

View file

@ -41,6 +41,7 @@ ResizeEffect::ResizeEffect()
, m_resizeWindow(0)
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowUserMovedResized(EffectWindow*,bool,bool)), this, SLOT(slotWindowUserMovedResized(EffectWindow*,bool,bool)));
}
ResizeEffect::~ResizeEffect()
@ -145,7 +146,7 @@ void ResizeEffect::reconfigure(ReconfigureFlags)
m_features |= Outline;
}
void ResizeEffect::windowUserMovedResized(EffectWindow* w, bool first, bool last)
void ResizeEffect::slotWindowUserMovedResized(EffectWindow* w, bool first, bool last)
{
if (first && last) {
// not interested in maximized

View file

@ -29,6 +29,7 @@ namespace KWin
class ResizeEffect
: public Effect
{
Q_OBJECT
public:
ResizeEffect();
~ResizeEffect();
@ -39,9 +40,11 @@ public:
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void reconfigure(ReconfigureFlags);
virtual void windowUserMovedResized(EffectWindow *w, bool first, bool last);
virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
public Q_SLOTS:
void slotWindowUserMovedResized(EffectWindow *w, bool first, bool last);
private:
enum Feature { TextureScale = 1 << 0, Outline = 1 << 1 };
bool m_active;

View file

@ -36,6 +36,7 @@ SnapHelperEffect::SnapHelperEffect()
m_timeline.setCurveShape(TimeLine::LinearCurve);
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowUserMovedResized(EffectWindow*,bool,bool)), this, SLOT(slotWindowUserMovedResized(EffectWindow*,bool,bool)));
/*if ( effects->compositingType() == XRenderCompositing )
{
@ -196,7 +197,7 @@ void SnapHelperEffect::slotWindowClosed(EffectWindow* w)
}
}
void SnapHelperEffect::windowUserMovedResized(EffectWindow* w, bool first, bool last)
void SnapHelperEffect::slotWindowUserMovedResized(EffectWindow* w, bool first, bool last)
{
if (first && !last && w->isMovable()) {
m_active = true;

View file

@ -38,12 +38,12 @@ public:
virtual void prePaintScreen(ScreenPrePaintData &data, int time);
virtual void postPaintScreen();
virtual void windowUserMovedResized(EffectWindow* w, bool first, bool last);
static bool supported();
public Q_SLOTS:
void slotWindowClosed(EffectWindow *w);
void slotWindowUserMovedResized(EffectWindow *w, bool first, bool last);
private:
bool m_active;

View file

@ -35,6 +35,7 @@ TranslucencyEffect::TranslucencyEffect()
reconfigure(ReconfigureAll);
active = effects->activeWindow();
connect(effects, SIGNAL(windowActivated(EffectWindow*)), this, SLOT(slotWindowActivated(EffectWindow*)));
connect(effects, SIGNAL(windowUserMovedResized(EffectWindow*,bool,bool)), this, SLOT(slotWindowUserMovedResized(EffectWindow*,bool,bool)));
}
void TranslucencyEffect::reconfigure(ReconfigureFlags)
@ -176,7 +177,7 @@ bool TranslucencyEffect::isInactive(const EffectWindow* w) const
return true;
}
void TranslucencyEffect::windowUserMovedResized(EffectWindow* w, bool first, bool last)
void TranslucencyEffect::slotWindowUserMovedResized(EffectWindow* w, bool first, bool last)
{
if (moveresize != 1.0 && (first || last)) {
moveresize_timeline.setProgress(0.0);

View file

@ -33,12 +33,12 @@ class TranslucencyEffect
public:
TranslucencyEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void windowUserMovedResized(EffectWindow* c, bool first, bool last);
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
public Q_SLOTS:
void slotWindowActivated(EffectWindow* w);
void slotWindowUserMovedResized(EffectWindow *c, bool first, bool last);
private:
bool isInactive(const EffectWindow *w) const;

View file

@ -60,6 +60,7 @@ WindowGeometry::WindowGeometry()
a->setText(i18n("Toggle window geometry display (effect only)"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle()));
connect(effects, SIGNAL(windowUserMovedResized(EffectWindow*,bool,bool)), this, SLOT(slotWindowUserMovedResized(EffectWindow*,bool,bool)));
}
WindowGeometry::~WindowGeometry()
@ -89,7 +90,7 @@ void WindowGeometry::toggle()
iAmActivated = !iAmActivated;
}
void WindowGeometry::windowUserMovedResized(EffectWindow* w, bool first, bool last)
void WindowGeometry::slotWindowUserMovedResized(EffectWindow* w, bool first, bool last)
{
if (first && last) // "maximized"
return;

View file

@ -38,11 +38,11 @@ public:
}
void reconfigure(ReconfigureFlags);
void paintScreen(int mask, QRegion region, ScreenPaintData &data);
void windowUserMovedResized(EffectWindow* w, bool first, bool last);
void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
private slots:
void toggle();
void slotWindowUserMovedResized(EffectWindow *w, bool first, bool last);
private:
EffectWindow *myResizeWindow;
EffectFrame *myMeasure[3];

View file

@ -167,6 +167,7 @@ WobblyWindowsEffect::WobblyWindowsEffect()
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowUserMovedResized(EffectWindow*,bool,bool)), this, SLOT(slotWindowUserMovedResized(EffectWindow*,bool,bool)));
}
WobblyWindowsEffect::~WobblyWindowsEffect()
@ -358,7 +359,7 @@ void WobblyWindowsEffect::postPaintScreen()
effects->postPaintScreen();
}
void WobblyWindowsEffect::windowUserMovedResized(EffectWindow* w, bool first, bool last)
void WobblyWindowsEffect::slotWindowUserMovedResized(EffectWindow* w, bool first, bool last)
{
if (!m_moveEffectEnabled || w->isSpecialWindow())
return;

View file

@ -35,7 +35,6 @@ public:
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintScreen();
virtual void windowUserMovedResized(EffectWindow* c, bool first, bool last);
// Wobbly model parameters
void setStiffness(qreal stiffness);
@ -60,6 +59,7 @@ public:
public Q_SLOTS:
void slotWindowAdded(EffectWindow *w);
void slotWindowClosed(EffectWindow *w);
void slotWindowUserMovedResized(EffectWindow *w, bool first, bool last);
private:

View file

@ -2092,8 +2092,7 @@ void Client::setMaximize(bool vertically, bool horizontally)
max_mode & MaximizeVertical ? !vertically : vertically,
max_mode & MaximizeHorizontal ? !horizontally : horizontally,
false);
if (effects)
static_cast<EffectsHandlerImpl*>(effects)->windowUserMovedResized(effectWindow(), true, true);
emit clientMaximizedStateChanged(this, max_mode);
// Update states of all other windows in this group
if (clientGroup())
@ -2645,7 +2644,7 @@ bool Client::startMoveResize()
}
Notify::raise(isResize() ? Notify::ResizeStart : Notify::MoveStart);
if (effects)
static_cast<EffectsHandlerImpl*>(effects)->windowUserMovedResized(effectWindow(), true, false);
static_cast<EffectsHandlerImpl*>(effects)->slotWindowUserMovedResized(effectWindow(), true, false);
if (options->electricBorders() == Options::ElectricMoveOnly ||
options->electricBorderMaximize() ||
options->electricBorderTiling())
@ -2757,7 +2756,7 @@ void Client::finishMoveResize(bool cancel)
Notify::raise(isResize() ? Notify::ResizeEnd : Notify::MoveEnd);
if (effects)
static_cast<EffectsHandlerImpl*>(effects)->windowUserMovedResized(effectWindow(), false, true);
static_cast<EffectsHandlerImpl*>(effects)->slotWindowUserMovedResized(effectWindow(), false, true);
}
void Client::leaveMoveResize()
@ -3148,7 +3147,7 @@ void Client::performMoveResize()
}
if (effects) {
static_cast<EffectsHandlerImpl*>(effects)->windowMoveResizeGeometryUpdate(effectWindow(), moveResizeGeom);
static_cast<EffectsHandlerImpl*>(effects)->windowUserMovedResized(effectWindow(), false, false);
static_cast<EffectsHandlerImpl*>(effects)->slotWindowUserMovedResized(effectWindow(), false, false);
}
}

View file

@ -119,10 +119,6 @@ void* Effect::proxy()
return NULL;
}
void Effect::windowUserMovedResized(EffectWindow* , bool, bool)
{
}
void Effect::windowMoveResizeGeometryUpdate(EffectWindow* , const QRect&)
{
}

View file

@ -440,8 +440,6 @@ public:
**/
virtual QRect transformWindowDamage(EffectWindow* w, const QRect& r);
/** called when moved/resized or once after it's finished */
virtual void windowUserMovedResized(EffectWindow* c, bool first, bool last);
/** called when the geometry changed during moving/resizing. */
virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
virtual void windowOpacityChanged(EffectWindow* c, double old_opacity);
@ -868,6 +866,14 @@ Q_SIGNALS:
* @since 4.7
**/
void windowDeleted(EffectWindow *w);
/** 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.
* @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.
* @since 4.7
**/
void windowUserMovedResized(EffectWindow *w, bool first, bool last);
protected:
QVector< EffectPair > loaded_effects;