[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:
parent
302271ce97
commit
23a510c0b5
9 changed files with 26 additions and 0 deletions
|
@ -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
|
||||
{
|
||||
|
|
1
bridge.h
1
bridge.h
|
@ -81,6 +81,7 @@ public:
|
|||
virtual QRect transparentRect() const override;
|
||||
|
||||
virtual void update(const QRegion ®ion) override;
|
||||
virtual QPalette palette() const override;
|
||||
|
||||
// Window tabbing
|
||||
virtual QString caption(int idx) const override;
|
||||
|
|
|
@ -552,6 +552,11 @@ KDecoration::WindowOperation KDecorationPreviewBridge::buttonToWindowOperation(Q
|
|||
return KDecoration::NoOp;
|
||||
}
|
||||
|
||||
QPalette KDecorationPreviewBridge::palette() const
|
||||
{
|
||||
return QApplication::palette();
|
||||
}
|
||||
|
||||
KDecorationPreviewOptions::KDecorationPreviewOptions()
|
||||
{
|
||||
customBorderSize = BordersCount; // invalid
|
||||
|
|
|
@ -150,6 +150,7 @@ public:
|
|||
virtual QRect transparentRect() const override;
|
||||
|
||||
virtual void update(const QRegion ®ion) override;
|
||||
virtual QPalette palette() const override;
|
||||
|
||||
// Window tabbing
|
||||
virtual QString caption(int idx) const override;
|
||||
|
|
|
@ -1056,6 +1056,11 @@ void KCommonDecoration::update(const QRegion ®ion)
|
|||
d->wrapper->update(region);
|
||||
}
|
||||
|
||||
QPalette KCommonDecoration::palette() const
|
||||
{
|
||||
return d->wrapper->palette();
|
||||
}
|
||||
|
||||
class KCommonDecorationButtonPrivate
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
virtual QRect transparentRect() const = 0;
|
||||
|
||||
virtual void update(const QRegion ®ion) = 0;
|
||||
virtual QPalette palette() const = 0;
|
||||
|
||||
// Window tabbing
|
||||
virtual QString caption(int idx) const = 0;
|
||||
|
|
Loading…
Reference in a new issue