[kdecorations] Add a ::palette() to the decoration API

The ::palette() in KDecoration and KCommonDecoration returns the
QPalette the decoration should use for the decorated window. The
call delegates into the bridge and KWin core might provide a special
QPalette for a given Client depending on the _KDE_NET_WM_COLOR_SCHEME
property.
This commit is contained in:
Martin Gräßlin 2013-10-14 07:21:44 +02:00
parent 302271ce97
commit 23a510c0b5
9 changed files with 26 additions and 0 deletions

View file

@ -65,6 +65,7 @@ BRIDGE_HELPER(void, maximize, MaximizeMode m, m,)
BRIDGE_HELPER(void, minimize, , ,)
BRIDGE_HELPER(void, showContextHelp, , ,)
BRIDGE_HELPER(void, setDesktop, int desktop, desktop,)
BRIDGE_HELPER(QPalette, palette, , , const)
bool Bridge::isActive() const
{

View file

@ -81,6 +81,7 @@ public:
virtual QRect transparentRect() const override;
virtual void update(const QRegion &region) override;
virtual QPalette palette() const override;
// Window tabbing
virtual QString caption(int idx) const override;

View file

@ -552,6 +552,11 @@ KDecoration::WindowOperation KDecorationPreviewBridge::buttonToWindowOperation(Q
return KDecoration::NoOp;
}
QPalette KDecorationPreviewBridge::palette() const
{
return QApplication::palette();
}
KDecorationPreviewOptions::KDecorationPreviewOptions()
{
customBorderSize = BordersCount; // invalid

View file

@ -150,6 +150,7 @@ public:
virtual QRect transparentRect() const override;
virtual void update(const QRegion &region) override;
virtual QPalette palette() const override;
// Window tabbing
virtual QString caption(int idx) const override;

View file

@ -1056,6 +1056,11 @@ void KCommonDecoration::update(const QRegion &region)
d->wrapper->update(region);
}
QPalette KCommonDecoration::palette() const
{
return d->wrapper->palette();
}
class KCommonDecorationButtonPrivate
{
public:

View file

@ -235,6 +235,8 @@ public:
*/
QRect transparentRect() const;
QPalette palette() const;
public:
/**
* Handles widget and layout creation, call the base implementation when subclassing this member.

View file

@ -453,6 +453,11 @@ bool KDecoration::compositingActive() const
return d->bridge->compositingActive();
}
QPalette KDecoration::palette() const
{
return d->bridge->palette();
}
void KDecoration::padding(int &left, int &right, int &top, int &bottom) const
{
left = right = top = bottom = 0;

View file

@ -823,6 +823,11 @@ public:
**/
bool isAlphaEnabled() const;
/**
* The recommended palette for the decoration. This can be different per decorated client.
*/
QPalette palette() const;
// requests to decoration
/**

View file

@ -88,6 +88,7 @@ public:
virtual QRect transparentRect() const = 0;
virtual void update(const QRegion &region) = 0;
virtual QPalette palette() const = 0;
// Window tabbing
virtual QString caption(int idx) const = 0;