Add property shaped for hasOwnShape method

Inclusive notify signal.
This commit is contained in:
Martin Gräßlin 2012-01-15 11:03:15 +01:00
parent bfdcbe60f5
commit 20add1c656
6 changed files with 16 additions and 7 deletions

View file

@ -1408,11 +1408,6 @@ QRegion EffectWindowImpl::shape() const
return sw ? sw->shape() : geometry(); return sw ? sw->shape() : geometry();
} }
bool EffectWindowImpl::hasOwnShape() const
{
return toplevel->shape();
}
QRect EffectWindowImpl::decorationInnerRect() const QRect EffectWindowImpl::decorationInnerRect() const
{ {
Client *client = dynamic_cast<Client*>(toplevel); Client *client = dynamic_cast<Client*>(toplevel);

View file

@ -244,7 +244,6 @@ public:
virtual const EffectWindowGroup* group() const; virtual const EffectWindowGroup* group() const;
virtual QRegion shape() const; virtual QRegion shape() const;
virtual bool hasOwnShape() const;
virtual QRect decorationInnerRect() const; virtual QRect decorationInnerRect() const;
virtual QByteArray readProperty(long atom, long type, int format) const; virtual QByteArray readProperty(long atom, long type, int format) const;
virtual void deleteProperty(long atom) const; virtual void deleteProperty(long atom) const;

View file

@ -325,6 +325,7 @@ WINDOW_HELPER(bool, isComboBox, "comboBox")
WINDOW_HELPER(bool, isDNDIcon, "dndIcon") WINDOW_HELPER(bool, isDNDIcon, "dndIcon")
WINDOW_HELPER(bool, isManaged, "managed") WINDOW_HELPER(bool, isManaged, "managed")
WINDOW_HELPER(bool, isDeleted, "deleted") WINDOW_HELPER(bool, isDeleted, "deleted")
WINDOW_HELPER(bool, hasOwnShape, "shaped")
WINDOW_HELPER(QString, windowRole, "windowRole") WINDOW_HELPER(QString, windowRole, "windowRole")
QString EffectWindow::windowClass() const QString EffectWindow::windowClass() const

View file

@ -1127,7 +1127,7 @@ public:
virtual QRegion shape() const = 0; virtual QRegion shape() const = 0;
int screen() const; int screen() const;
/** @internal Do not use */ /** @internal Do not use */
virtual bool hasOwnShape() const = 0; // only for shadow effect, for now bool hasOwnShape() const; // only for shadow effect, for now
QPoint pos() const; QPoint pos() const;
QSize size() const; QSize size() const;
QRect rect() const; QRect rect() const;

View file

@ -104,7 +104,11 @@ QRect Toplevel::decorationRect() const
void Toplevel::detectShape(Window id) void Toplevel::detectShape(Window id)
{ {
const bool wasShape = is_shape;
is_shape = Extensions::hasShape(id); is_shape = Extensions::hasShape(id);
if (wasShape != is_shape) {
emit shapedChanged();
}
} }
// used only by Deleted::copy() // used only by Deleted::copy()

View file

@ -153,6 +153,10 @@ class Toplevel
* Whether this Toplevel represents an already deleted window and only kept for the compositor for animations. * Whether this Toplevel represents an already deleted window and only kept for the compositor for animations.
**/ **/
Q_PROPERTY(bool deleted READ isDeleted CONSTANT) Q_PROPERTY(bool deleted READ isDeleted CONSTANT)
/**
* Whether the window has an own shape
**/
Q_PROPERTY(bool shaped READ shape NOTIFY shapedChanged)
public: public:
Toplevel(Workspace *ws); Toplevel(Workspace *ws);
Window frameId() const; Window frameId() const;
@ -278,6 +282,12 @@ signals:
void geometryShapeChanged(KWin::Toplevel* toplevel, const QRect& old); void geometryShapeChanged(KWin::Toplevel* toplevel, const QRect& old);
void windowClosed(KWin::Toplevel* toplevel, KWin::Deleted* deleted); void windowClosed(KWin::Toplevel* toplevel, KWin::Deleted* deleted);
void windowShown(KWin::Toplevel* toplevel); void windowShown(KWin::Toplevel* toplevel);
/**
* Signal emitted when the window's shape state changed. That is if it did not have a shape
* and received one or if the shape was withdrawn. Think of Chromium enabling/disabling KWin's
* decoration.
**/
void shapedChanged();
protected: protected:
virtual ~Toplevel(); virtual ~Toplevel();