export the baseincrement size to the effectwindow and utilize it in the windowgeometry effect

BUG: 283518
REVIEW: 103033
FIXED-IN: 4.8
This commit is contained in:
Thomas Lübking 2011-11-02 23:05:03 +01:00
parent 4cd4481663
commit d3331eed9c
6 changed files with 22 additions and 2 deletions

View file

@ -133,6 +133,7 @@ public:
QSize minSize() const;
QSize maxSize() const;
QSize basicUnit() const;
virtual QPoint clientPos() const; // Inside of geometry()
virtual QSize clientSize() const;
virtual QRect visibleRect() const;

View file

@ -1443,6 +1443,12 @@ int EffectWindowImpl::height() const
return toplevel->height();
}
QSize EffectWindowImpl::basicUnit() const
{
Client *client = dynamic_cast<Client*>(toplevel);
return client ? client->basicUnit() : QSize(1,1);
}
QRect EffectWindowImpl::geometry() const
{
return toplevel->geometry();

View file

@ -253,6 +253,7 @@ public:
virtual int y() const;
virtual int width() const;
virtual int height() const;
virtual QSize basicUnit() const;
virtual QRect geometry() const;
virtual QRegion shape() const;
virtual int screen() const;

View file

@ -157,7 +157,9 @@ void WindowGeometry::slotWindowStepUserMovedResized(EffectWindow *w, const QRect
dx = r.width() - r2.width();
dy = r.height() - r2.height();
myMeasure[1]->setText( i18nc(myResizeString, r.width(), r.height(), number(dx), number(dy) ) );
const QSize baseInc = w->basicUnit();
Q_ASSERT(baseInc.width() && baseInc.height());
myMeasure[1]->setText( i18nc(myResizeString, r.width()/baseInc.width(), r.height()/baseInc.height(), number(dx/baseInc.width()), number(dy/baseInc.height()) ) );
// calc width for bottomright element, superfluous otherwise
dx = r.right() - r2.right();

View file

@ -1524,6 +1524,11 @@ QSize Client::maxSize() const
return rules()->checkMaxSize(QSize(xSizeHint.max_width, xSizeHint.max_height));
}
QSize Client::basicUnit() const
{
return QSize(xSizeHint.width_inc, xSizeHint.height_inc);
}
/*!
Auxiliary function to inform the client about the current window
configuration.

View file

@ -167,7 +167,7 @@ X-KDE-Library=kwin4_effect_cooleffect
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
#define KWIN_EFFECT_API_VERSION_MAJOR 0
#define KWIN_EFFECT_API_VERSION_MINOR 181
#define KWIN_EFFECT_API_VERSION_MINOR 182
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
@ -1101,6 +1101,11 @@ public:
virtual int y() const = 0;
virtual int width() const = 0;
virtual int height() const = 0;
/**
* By how much the window wishes to grow/shrink at least. Usually QSize(1,1).
* MAY BE DISOBEYED BY THE WM! It's only for information, do NOT rely on it at all.
*/
virtual QSize basicUnit() const = 0;
virtual QRect geometry() const = 0;
virtual QRegion shape() const = 0;
virtual int screen() const = 0;