kwin/libkdecorations/kdecoration.cpp

689 lines
16 KiB
C++
Raw Normal View History

/*****************************************************************
This file is part of the KDE project.
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
******************************************************************/
#include "kdecoration.h"
#include "kdecoration_p.h"
#include <QApplication>
#include <QMenu>
#include <assert.h>
#include <X11/Xlib.h>
#include <fixx11h.h>
#include "kdecorationfactory.h"
#include "kdecorationbridge.h"
/*
Extending KDecoration:
======================
If KDecoration will ever need to be extended in a way that'd break binary compatibility
(i.e. adding new virtual methods most probably), new class KDecoration2 should be
inherited from KDecoration and those methods added there. Code that would depend
on the new functionality could then dynamic_cast<> to KDecoration2 to check whether
it is available and use it.
KCommonDecoration would have to be extended the same way, adding KCommonDecoration2
inheriting KCommonDecoration and adding the new API matching KDecoration2.
*/
class KDecorationPrivate
{
public:
KDecorationPrivate(KDecorationBridge *b)
: bridge(b)
, alphaEnabled(false)
, w()
{
}
KDecorationBridge *bridge;
bool alphaEnabled;
QScopedPointer<QWidget> w;
};
KDecorationOptions* KDecoration::options_;
2011-01-30 14:34:42 +00:00
KDecoration::KDecoration(KDecorationBridge* bridge, KDecorationFactory* factory)
: factory_(factory),
d(new KDecorationPrivate(bridge))
2011-01-30 14:34:42 +00:00
{
factory->addDecoration(this);
connect(this, static_cast<void (KDecoration::*)(bool)>(&KDecoration::keepAboveChanged),
this, static_cast<void (KDecoration::*)()>(&KDecoration::keepAboveChanged));
connect(this, static_cast<void (KDecoration::*)(bool)>(&KDecoration::keepBelowChanged),
this, static_cast<void (KDecoration::*)()>(&KDecoration::keepBelowChanged));
2011-01-30 14:34:42 +00:00
}
KDecoration::~KDecoration()
2011-01-30 14:34:42 +00:00
{
factory()->removeDecoration(this);
delete d;
2011-01-30 14:34:42 +00:00
}
const KDecorationOptions* KDecoration::options()
2011-01-30 14:34:42 +00:00
{
return options_;
2011-01-30 14:34:42 +00:00
}
void KDecoration::createMainWidget(Qt::WindowFlags flags)
2011-01-30 14:34:42 +00:00
{
// FRAME check flags?
2011-01-30 14:34:42 +00:00
QWidget *w = new QWidget(initialParentWidget(), initialWFlags() | flags);
w->setObjectName(QLatin1String("decoration widget"));
w->setAttribute(Qt::WA_PaintOnScreen);
if (options()->showTooltips())
w->setAttribute(Qt::WA_AlwaysShowToolTips);
setMainWidget(w);
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecoration::setMainWidget(QWidget* w)
{
assert(d->w.isNull());
d->w.reset(w);
2011-01-30 14:34:42 +00:00
w->setMouseTracking(true);
widget()->resize(geometry().size());
}
QWidget* KDecoration::initialParentWidget() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->initialParentWidget();
2011-01-30 14:34:42 +00:00
}
Qt::WindowFlags KDecoration::initialWFlags() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->initialWFlags();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isActive() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isActive();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isCloseable() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isCloseable();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isMaximizable() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isMaximizable();
2011-01-30 14:34:42 +00:00
}
KDecoration::MaximizeMode KDecoration::maximizeMode() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->maximizeMode();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isMaximized() const
{
return maximizeMode() == MaximizeFull;
}
KDecoration::QuickTileMode KDecoration::quickTileMode() const
{
return d->bridge->quickTileMode();
}
bool KDecoration::isMinimizable() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isMinimizable();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::providesContextHelp() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->providesContextHelp();
2011-01-30 14:34:42 +00:00
}
int KDecoration::desktop() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->desktop();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isModal() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isModal();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isShadeable() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isShadeable();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isShade() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isShade();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isSetShade() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isSetShade();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::keepAbove() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->keepAbove();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::keepBelow() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->keepBelow();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isMovable() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isMovable();
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isResizable() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isResizable();
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
NET::WindowType KDecoration::windowType(unsigned long supported_types) const
{
// this one is also duplicated in KDecorationFactory
return d->bridge->windowType(supported_types);
2011-01-30 14:34:42 +00:00
}
QIcon KDecoration::icon() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->icon();
2011-01-30 14:34:42 +00:00
}
QString KDecoration::caption() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->caption();
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecoration::processMousePressEvent(QMouseEvent* e)
{
return d->bridge->processMousePressEvent(e);
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecoration::showWindowMenu(const QRect &pos)
{
d->bridge->showWindowMenu(pos);
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecoration::showWindowMenu(QPoint pos)
{
d->bridge->showWindowMenu(pos);
2011-01-30 14:34:42 +00:00
}
void KDecoration::showApplicationMenu(const QPoint &p)
{
d->bridge->showApplicationMenu(p);
}
bool KDecoration::menuAvailable() const
{
return d->bridge->menuAvailable();
}
2011-01-30 14:34:42 +00:00
void KDecoration::performWindowOperation(WindowOperation op)
{
d->bridge->performWindowOperation(op);
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecoration::setMask(const QRegion& reg, int mode)
{
d->bridge->setMask(reg, mode);
2011-01-30 14:34:42 +00:00
}
void KDecoration::clearMask()
2011-01-30 14:34:42 +00:00
{
d->bridge->setMask(QRegion(), 0);
2011-01-30 14:34:42 +00:00
}
bool KDecoration::isPreview() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->isPreview();
2011-01-30 14:34:42 +00:00
}
QRect KDecoration::geometry() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->geometry();
2011-01-30 14:34:42 +00:00
}
QRect KDecoration::iconGeometry() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->iconGeometry();
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
QRegion KDecoration::unobscuredRegion(const QRegion& r) const
{
return d->bridge->unobscuredRegion(r);
2011-01-30 14:34:42 +00:00
}
WId KDecoration::windowId() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->windowId();
2011-01-30 14:34:42 +00:00
}
void KDecoration::closeWindow()
2011-01-30 14:34:42 +00:00
{
d->bridge->closeWindow();
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecoration::maximize(Qt::MouseButtons button)
{
performWindowOperation(options()->operationMaxButtonClick(button));
}
2011-01-30 14:34:42 +00:00
void KDecoration::maximize(MaximizeMode mode)
{
d->bridge->maximize(mode);
2011-01-30 14:34:42 +00:00
}
void KDecoration::minimize()
2011-01-30 14:34:42 +00:00
{
d->bridge->minimize();
2011-01-30 14:34:42 +00:00
}
void KDecoration::showContextHelp()
2011-01-30 14:34:42 +00:00
{
d->bridge->showContextHelp();
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecoration::setDesktop(int desktop)
{
d->bridge->setDesktop(desktop);
2011-01-30 14:34:42 +00:00
}
void KDecoration::toggleOnAllDesktops()
2011-01-30 14:34:42 +00:00
{
if (isOnAllDesktops())
setDesktop(d->bridge->currentDesktop());
else
2011-01-30 14:34:42 +00:00
setDesktop(NET::OnAllDesktops);
}
void KDecoration::titlebarDblClickOperation()
2011-01-30 14:34:42 +00:00
{
d->bridge->titlebarDblClickOperation();
2011-01-30 14:34:42 +00:00
}
void KDecoration::titlebarMouseWheelOperation(int delta)
{
d->bridge->titlebarMouseWheelOperation(delta);
2011-01-30 14:34:42 +00:00
}
void KDecoration::setShade(bool set)
{
d->bridge->setShade(set);
2011-01-30 14:34:42 +00:00
}
void KDecoration::setKeepAbove(bool set)
{
d->bridge->setKeepAbove(set);
2011-01-30 14:34:42 +00:00
}
void KDecoration::setKeepBelow(bool set)
{
d->bridge->setKeepBelow(set);
2011-01-30 14:34:42 +00:00
}
bool KDecoration::windowDocked(Position)
{
return false;
2011-01-30 14:34:42 +00:00
}
void KDecoration::grabXServer()
2011-01-30 14:34:42 +00:00
{
d->bridge->grabXServer(true);
2011-01-30 14:34:42 +00:00
}
void KDecoration::ungrabXServer()
2011-01-30 14:34:42 +00:00
{
d->bridge->grabXServer(false);
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
KDecoration::Position KDecoration::mousePosition(const QPoint& p) const
{
const int range = 16;
int bleft, bright, btop, bbottom;
2011-01-30 14:34:42 +00:00
borders(bleft, bright, btop, bbottom);
btop = qMin(btop, 4); // otherwise whole titlebar would have resize cursor
Position m = PositionCenter;
2011-01-30 14:34:42 +00:00
if ((p.x() > bleft && p.x() < widget()->width() - bright)
&& (p.y() > btop && p.y() < widget()->height() - bbottom))
return PositionCenter;
2011-01-30 14:34:42 +00:00
if (p.y() <= qMax(range, btop) && p.x() <= qMax(range, bleft))
m = PositionTopLeft;
2011-01-30 14:34:42 +00:00
else if (p.y() >= widget()->height() - qMax(range, bbottom)
&& p.x() >= widget()->width() - qMax(range, bright))
m = PositionBottomRight;
2011-01-30 14:34:42 +00:00
else if (p.y() >= widget()->height() - qMax(range, bbottom) && p.x() <= qMax(range, bleft))
m = PositionBottomLeft;
2011-01-30 14:34:42 +00:00
else if (p.y() <= qMax(range, btop) && p.x() >= widget()->width() - qMax(range, bright))
m = PositionTopRight;
2011-01-30 14:34:42 +00:00
else if (p.y() <= btop)
m = PositionTop;
2011-01-30 14:34:42 +00:00
else if (p.y() >= widget()->height() - bbottom)
m = PositionBottom;
2011-01-30 14:34:42 +00:00
else if (p.x() <= bleft)
m = PositionLeft;
2011-01-30 14:34:42 +00:00
else if (p.x() >= widget()->width() - bright)
m = PositionRight;
else
m = PositionCenter;
return m;
2011-01-30 14:34:42 +00:00
}
QRect KDecoration::transparentRect() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->transparentRect();
2011-01-30 14:34:42 +00:00
}
void KDecoration::setAlphaEnabled(bool enabled)
{
if (d->alphaEnabled == enabled) {
return;
}
d->alphaEnabled = enabled;
emit alphaEnabledChanged(enabled);
}
bool KDecoration::isAlphaEnabled() const
{
return d->alphaEnabled;
}
bool KDecoration::compositingActive() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->compositingActive();
2011-01-30 14:34:42 +00:00
}
void KDecoration::padding(int &left, int &right, int &top, int &bottom) const
2011-01-30 14:34:42 +00:00
{
left = right = top = bottom = 0;
2011-01-30 14:34:42 +00:00
}
//BEGIN Window tabbing
int KDecoration::tabCount() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->tabCount();
2011-01-30 14:34:42 +00:00
}
long KDecoration::tabId(int idx) const
2011-01-30 14:34:42 +00:00
{
return d->bridge->tabId(idx);
2011-01-30 14:34:42 +00:00
}
QString KDecoration::caption(int idx) const
2011-01-30 14:34:42 +00:00
{
return d->bridge->caption(idx);
2011-01-30 14:34:42 +00:00
}
QIcon KDecoration::icon(int idx) const
2011-01-30 14:34:42 +00:00
{
return d->bridge->icon(idx);
2011-01-30 14:34:42 +00:00
}
long KDecoration::currentTabId() const
2011-01-30 14:34:42 +00:00
{
return d->bridge->currentTabId();
2011-01-30 14:34:42 +00:00
}
void KDecoration::setCurrentTab(long id)
2011-01-30 14:34:42 +00:00
{
d->bridge->setCurrentTab(id);
2011-01-30 14:34:42 +00:00
}
void KDecoration::tab_A_before_B(long A, long B)
2011-01-30 14:34:42 +00:00
{
d->bridge->tab_A_before_B(A, B);
2011-01-30 14:34:42 +00:00
}
void KDecoration::tab_A_behind_B(long A, long B)
2011-01-30 14:34:42 +00:00
{
d->bridge->tab_A_behind_B(A, B);
2011-01-30 14:34:42 +00:00
}
void KDecoration::untab(long id, const QRect& newGeom)
2011-01-30 14:34:42 +00:00
{
d->bridge->untab(id, newGeom);
2011-01-30 14:34:42 +00:00
}
void KDecoration::closeTab(long id)
2011-01-30 14:34:42 +00:00
{
d->bridge->closeTab(id);
2011-01-30 14:34:42 +00:00
}
void KDecoration::closeTabGroup()
2011-01-30 14:34:42 +00:00
{
d->bridge->closeTabGroup();
2011-01-30 14:34:42 +00:00
}
void KDecoration::showWindowMenu(const QPoint &pos, long id)
{
d->bridge->showWindowMenu(pos, id);
}
//END tabbing
KDecoration::WindowOperation KDecoration::buttonToWindowOperation(Qt::MouseButtons button)
2011-01-30 14:34:42 +00:00
{
return d->bridge->buttonToWindowOperation(button);
2011-01-30 14:34:42 +00:00
}
QRegion KDecoration::region(KDecorationDefines::Region)
{
return QRegion();
}
KDecorationDefines::Position KDecoration::titlebarPosition()
{
return PositionTop;
}
QWidget* KDecoration::widget()
{
return d->w.data();
}
const QWidget* KDecoration::widget() const
{
return d->w.data();
}
KDecorationFactory* KDecoration::factory() const
{
return factory_;
}
bool KDecoration::isOnAllDesktops() const
{
return desktop() == NET::OnAllDesktops;
}
int KDecoration::width() const
{
return geometry().width();
}
int KDecoration::height() const
{
return geometry().height();
}
QString KDecorationDefines::tabDragMimeType()
2011-01-30 14:34:42 +00:00
{
return QStringLiteral("text/ClientGroupItem");
2011-01-30 14:34:42 +00:00
}
KDecorationOptions::KDecorationOptions(QObject *parent)
: QObject(parent)
, d(new KDecorationOptionsPrivate(this))
2011-01-30 14:34:42 +00:00
{
assert(KDecoration::options_ == NULL);
KDecoration::options_ = this;
connect(this, &KDecorationOptions::activeFontChanged, this, &KDecorationOptions::fontsChanged);
connect(this, &KDecorationOptions::inactiveFontChanged, this, &KDecorationOptions::fontsChanged);
connect(this, &KDecorationOptions::smallActiveFontChanged, this, &KDecorationOptions::fontsChanged);
connect(this, &KDecorationOptions::smallInactiveFontChanged, this, &KDecorationOptions::fontsChanged);
connect(this, &KDecorationOptions::leftButtonsChanged, this, &KDecorationOptions::buttonsChanged);
connect(this, &KDecorationOptions::rightButtonsChanged, this, &KDecorationOptions::buttonsChanged);
connect(this, &KDecorationOptions::customButtonPositionsChanged, this, &KDecorationOptions::buttonsChanged);
2011-01-30 14:34:42 +00:00
}
KDecorationOptions::~KDecorationOptions()
2011-01-30 14:34:42 +00:00
{
assert(KDecoration::options_ == this);
KDecoration::options_ = NULL;
delete d;
2011-01-30 14:34:42 +00:00
}
QColor KDecorationOptions::color(ColorType type, bool active) const
2011-01-30 14:34:42 +00:00
{
return(d->colors[type + (active ? 0 : NUM_COLORS)]);
2011-01-30 14:34:42 +00:00
}
QFont KDecorationOptions::font(bool active, bool small) const
2011-01-30 14:34:42 +00:00
{
if (small)
return(active ? d->activeFontSmall : d->inactiveFontSmall);
else
return(active ? d->activeFont : d->inactiveFont);
2011-01-30 14:34:42 +00:00
}
QPalette KDecorationOptions::palette(ColorType type, bool active) const
2011-01-30 14:34:42 +00:00
{
int idx = type + (active ? 0 : NUM_COLORS);
2011-01-30 14:34:42 +00:00
if (d->pal[idx])
return(*d->pal[idx]);
// TODO: Why construct the palette this way? Is it worth porting to Qt4?
//d->pal[idx] = new QPalette(Qt::black, d->colors[idx], d->colors[idx].light(150),
// d->colors[idx].dark(), d->colors[idx].dark(120),
// Qt::black, QApplication::palette().active().
// base());
d->pal[idx] = new QPalette(d->colors[idx]);
return(*d->pal[idx]);
2011-01-30 14:34:42 +00:00
}
void KDecorationOptions::updateSettings(KConfig* config)
2011-01-30 14:34:42 +00:00
{
d->updateSettings(config);
2011-01-30 14:34:42 +00:00
}
bool KDecorationOptions::customButtonPositions() const
2011-01-30 14:34:42 +00:00
{
return d->custom_button_positions;
2011-01-30 14:34:42 +00:00
}
QString KDecorationOptions::titleButtonsLeft() const
2011-01-30 14:34:42 +00:00
{
return d->title_buttons_left;
2011-01-30 14:34:42 +00:00
}
QString KDecorationOptions::defaultTitleButtonsLeft()
2011-01-30 14:34:42 +00:00
{
return QStringLiteral("MS");
2011-01-30 14:34:42 +00:00
}
QString KDecorationOptions::titleButtonsRight() const
2011-01-30 14:34:42 +00:00
{
return d->title_buttons_right;
2011-01-30 14:34:42 +00:00
}
QString KDecorationOptions::defaultTitleButtonsRight()
2011-01-30 14:34:42 +00:00
{
return QStringLiteral("HIAX");
2011-01-30 14:34:42 +00:00
}
bool KDecorationOptions::showTooltips() const
2011-01-30 14:34:42 +00:00
{
return d->show_tooltips;
2011-01-30 14:34:42 +00:00
}
KDecorationOptions::BorderSize KDecorationOptions::preferredBorderSize(KDecorationFactory* factory) const
{
assert(factory != NULL);
if (d->cached_border_size == BordersCount) // invalid
d->cached_border_size = d->findPreferredBorderSize(d->border_size,
factory->borderSizes());
return d->cached_border_size;
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
KDecorationDefines::WindowOperation KDecorationOptions::operationMaxButtonClick(Qt::MouseButtons button) const
{
return button == Qt::RightButton ? d->opMaxButtonRightClick :
button == Qt::MidButton ? d->opMaxButtonMiddleClick :
d->opMaxButtonLeftClick;
}
2011-01-30 14:34:42 +00:00
void KDecorationOptions::setOpMaxButtonLeftClick(WindowOperation op)
{
d->opMaxButtonLeftClick = op;
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecorationOptions::setOpMaxButtonRightClick(WindowOperation op)
{
d->opMaxButtonRightClick = op;
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecorationOptions::setOpMaxButtonMiddleClick(WindowOperation op)
{
d->opMaxButtonMiddleClick = op;
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecorationOptions::setBorderSize(BorderSize bs)
{
d->border_size = bs;
d->cached_border_size = BordersCount; // invalid
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecorationOptions::setCustomButtonPositions(bool b)
{
d->custom_button_positions = b;
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecorationOptions::setTitleButtonsLeft(const QString& b)
{
d->title_buttons_left = b;
2011-01-30 14:34:42 +00:00
}
2011-01-30 14:34:42 +00:00
void KDecorationOptions::setTitleButtonsRight(const QString& b)
{
d->title_buttons_right = b;
2011-01-30 14:34:42 +00:00
}
KDecorationBridge becomes private again With 4933f08ae49328e36e2654434d28917310882ee5 the KDecorationBridge interface became public to allow Compiz to easily implement the class. From a KWin perspective this change did not make much sense. The Bridge is meant to be the interface towards KWin. It is an internal interface and exporting it doesn't change the fact that it is internal. The change got introduced in a time when it was still common to use Compiz in the kde-workspaces. This has changed. None of the top ten distributions on distrowatch are shipping the integration parts of Compiz in an up to date version. Most distros are still on Compiz 0.8, which requires manual patching to keep up with changes in the decoration API. Distros on Compiz 0.9 are not shipping the KDE integration - this includes Ubuntu. Given this development it is no longer justified to have additional work on KWin side and because of that the API which should be internal is marked as internal again. In case Compiz is still interested in providing the kde-window-decorator the header file can easily be pulled from our repository. In addition this patch includes a method int decoration_bridge_version() which returns the current bridge API version. Kde-window-decorator can resolve this method and verify that the version is not higher than what is supported. The version number is provided in kdecoration.h by the define KWIN_DECORATION_BRIDGE_API_VERSION. We will increate the version number once per release in case the bridge changed. 4.11 will have the version number 1. This change in behavior has been discussed and agreed in [1]. The change also unexports KDecorationBridgeUnstable. This class should have never been exported, it was incorrect and the parent class had not been exported anyway. This is just a note to indicate that it is not an ABI break and there is no reason to increase the so number. [1] http://lists.kde.org/?l=kwin&m=136335502805911&w=2 CCMAIL: compiz@lists.freedesktop.org CCMAIL: dev@lists.compiz.org REVIEW: 109536
2013-03-17 11:24:18 +00:00
extern "C" {
int decoration_bridge_version()
{
return KWIN_DECORATION_BRIDGE_API_VERSION;
}
}
#include "kdecoration.moc"