New signal for maximize state changed

The signal includes the state for horizontal and vertical maximize state.
It would be better to use the enum fro, KDecorationDefines but we don't want
to depend on decorations library.

Wobbly windows is adjusted to use this new signal - it is the only effect
interested in maximize state change.
This commit is contained in:
Martin Gräßlin 2011-03-13 09:48:51 +01:00
parent 640fdc7b6d
commit 909a678e13
4 changed files with 52 additions and 1 deletions

View file

@ -302,7 +302,25 @@ void EffectsHandlerImpl::startPaint()
void EffectsHandlerImpl::slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode)
{
emit windowUserMovedResized(c->effectWindow(), true, true);
bool horizontal = false;
bool vertical = false;
switch (maxMode) {
case KDecorationDefines::MaximizeHorizontal:
horizontal = true;
break;
case KDecorationDefines::MaximizeVertical:
vertical = true;
break;
case KDecorationDefines::MaximizeFull:
horizontal = true;
vertical = true;
break;
case KDecorationDefines::MaximizeRestore: // fall through
default:
// default - nothing to do
break;
}
emit windowMaximizedStateChanged(c->effectWindow(), horizontal, vertical);
}
void EffectsHandlerImpl::slotWindowUserMovedResized(EffectWindow* c, bool first, bool last)

View file

@ -168,6 +168,7 @@ WobblyWindowsEffect::WobblyWindowsEffect()
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)));
connect(effects, SIGNAL(windowMaximizedStateChanged(EffectWindow*,bool,bool)), this, SLOT(slotWindowMaximizeStateChanged(EffectWindow*,bool,bool)));
}
WobblyWindowsEffect::~WobblyWindowsEffect()
@ -390,6 +391,24 @@ void WobblyWindowsEffect::slotWindowUserMovedResized(EffectWindow* w, bool first
}
}
void WobblyWindowsEffect::slotWindowMaximizeStateChanged(EffectWindow *w, bool horizontal, bool vertical)
{
if (!m_moveEffectEnabled || w->isSpecialWindow())
return;
if (m_moveWobble && m_resizeWobble) {
stepMovedResized(w);
}
if (windows.contains(w)) {
WindowWobblyInfos& wwi = windows[w];
QRect rect = w->geometry();
if (rect.y() != wwi.resize_original_rect.y()) wwi.can_wobble_top = true;
if (rect.x() != wwi.resize_original_rect.x()) wwi.can_wobble_left = true;
if (rect.right() != wwi.resize_original_rect.right()) wwi.can_wobble_right = true;
if (rect.bottom() != wwi.resize_original_rect.bottom()) wwi.can_wobble_bottom = true;
}
}
void WobblyWindowsEffect::startMovedResized(EffectWindow* w)
{

View file

@ -60,6 +60,7 @@ public Q_SLOTS:
void slotWindowAdded(EffectWindow *w);
void slotWindowClosed(EffectWindow *w);
void slotWindowUserMovedResized(EffectWindow *w, bool first, bool last);
void slotWindowMaximizeStateChanged(EffectWindow *w, bool horizontal, bool vertical);
private:

View file

@ -855,6 +855,19 @@ Q_SIGNALS:
* @since 4.7
**/
void windowUserMovedResized(EffectWindow *w, bool first, bool last);
/**
* Signal emitted when the maximized state of the window @p w changed.
* A window can be in one of four states:
* @li restored: both @p horizontal and @p vertical are @c false
* @li horizontally maximized: @p horizontal is @c true and @p vertical is @c false
* @li vertically maximized: @p horizontal is @c false and @p vertical is @c true
* @li completely maximized: both @p horizontal and @p vertical are @C true
* @param w The window whose maximized state changed
* @param horizontal If @c true maximized horizontally
* @param vertical If @c true maximized vertically
* @since 4.7
**/
void windowMaximizedStateChanged(EffectWindow *w, bool horizontal, bool vertical);
/**
* Signal emitted when the geometry or shape of a window changed.
* This is caused if the window changes geometry without user interaction.