Move decoration related methods from Workspace to DecorationPlugin
They were all just delegating to the DecorationPlugin.
This commit is contained in:
parent
d8e1b1c00e
commit
265b5523e2
14 changed files with 144 additions and 141 deletions
17
client.cpp
17
client.cpp
|
@ -47,6 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "client_machine.h"
|
#include "client_machine.h"
|
||||||
#include "composite.h"
|
#include "composite.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "focuschain.h"
|
#include "focuschain.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
@ -442,7 +443,11 @@ void Client::updateDecoration(bool check_workspace_pos, bool force)
|
||||||
destroyDecoration();
|
destroyDecoration();
|
||||||
if (!noBorder()) {
|
if (!noBorder()) {
|
||||||
setMask(QRegion()); // Reset shape mask
|
setMask(QRegion()); // Reset shape mask
|
||||||
decoration = workspace()->createDecoration(bridge);
|
if (decorationPlugin()->hasNoDecoration()) {
|
||||||
|
decoration = NULL;
|
||||||
|
} else {
|
||||||
|
decoration = decorationPlugin()->createDecoration(bridge);
|
||||||
|
}
|
||||||
#ifdef KWIN_BUILD_KAPPMENU
|
#ifdef KWIN_BUILD_KAPPMENU
|
||||||
connect(this, SIGNAL(showRequest()), decoration, SIGNAL(showRequest()));
|
connect(this, SIGNAL(showRequest()), decoration, SIGNAL(showRequest()));
|
||||||
connect(this, SIGNAL(appMenuAvailable()), decoration, SIGNAL(appMenuAvailable()));
|
connect(this, SIGNAL(appMenuAvailable()), decoration, SIGNAL(appMenuAvailable()));
|
||||||
|
@ -551,7 +556,7 @@ void Client::layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect
|
||||||
NETStrut strut = info->frameOverlap();
|
NETStrut strut = info->frameOverlap();
|
||||||
|
|
||||||
// Ignore the overlap strut when compositing is disabled
|
// Ignore the overlap strut when compositing is disabled
|
||||||
if (!compositing() || !Workspace::self()->decorationSupportsFrameOverlap())
|
if (!compositing() || !decorationPlugin()->supportsFrameOverlap())
|
||||||
strut.left = strut.top = strut.right = strut.bottom = 0;
|
strut.left = strut.top = strut.right = strut.bottom = 0;
|
||||||
else if (strut.left == -1 && strut.top == -1 && strut.right == -1 && strut.bottom == -1) {
|
else if (strut.left == -1 && strut.top == -1 && strut.right == -1 && strut.bottom == -1) {
|
||||||
top = QRect(r.x(), r.y(), r.width(), r.height() / 3);
|
top = QRect(r.x(), r.y(), r.width(), r.height() / 3);
|
||||||
|
@ -584,7 +589,7 @@ QRect Client::transparentRect() const
|
||||||
|
|
||||||
NETStrut strut = info->frameOverlap();
|
NETStrut strut = info->frameOverlap();
|
||||||
// Ignore the strut when compositing is disabled or the decoration doesn't support it
|
// Ignore the strut when compositing is disabled or the decoration doesn't support it
|
||||||
if (!compositing() || !Workspace::self()->decorationSupportsFrameOverlap())
|
if (!compositing() || !decorationPlugin()->supportsFrameOverlap())
|
||||||
strut.left = strut.top = strut.right = strut.bottom = 0;
|
strut.left = strut.top = strut.right = strut.bottom = 0;
|
||||||
else if (strut.left == -1 && strut.top == -1 && strut.right == -1 && strut.bottom == -1)
|
else if (strut.left == -1 && strut.top == -1 && strut.right == -1 && strut.bottom == -1)
|
||||||
return QRect();
|
return QRect();
|
||||||
|
@ -669,7 +674,7 @@ void Client::resizeDecoration(const QSize& s)
|
||||||
|
|
||||||
bool Client::noBorder() const
|
bool Client::noBorder() const
|
||||||
{
|
{
|
||||||
return !workspace()->hasDecorationPlugin() || noborder || isFullScreen();
|
return decorationPlugin()->hasNoDecoration() || noborder || isFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::userCanSetNoBorder() const
|
bool Client::userCanSetNoBorder() const
|
||||||
|
@ -2527,11 +2532,11 @@ NET::WindowType Client::windowType(bool direct, int supportedTypes) const
|
||||||
|
|
||||||
bool Client::decorationHasAlpha() const
|
bool Client::decorationHasAlpha() const
|
||||||
{
|
{
|
||||||
if (!decoration || !workspace()->decorationHasAlpha()) {
|
if (!decoration || !decorationPlugin()->hasAlpha()) {
|
||||||
// either no decoration or decoration has alpha disabled
|
// either no decoration or decoration has alpha disabled
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (workspace()->decorationSupportsAnnounceAlpha()) {
|
if (decorationPlugin()->supportsAnnounceAlpha()) {
|
||||||
return decoration->isAlphaEnabled();
|
return decoration->isAlphaEnabled();
|
||||||
} else {
|
} else {
|
||||||
// decoration has alpha enabled and does not support alpha announcement
|
// decoration has alpha enabled and does not support alpha announcement
|
||||||
|
|
|
@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// TODO: remove together with deprecated methods
|
// TODO: remove together with deprecated methods
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "composite.h"
|
#include "composite.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "kwinadaptor.h"
|
#include "kwinadaptor.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
@ -119,7 +120,6 @@ rettype DBusInterface::name( ) \
|
||||||
return Workspace::self()->name(); \
|
return Workspace::self()->name(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAP(QList<int>, decorationSupportedColors)
|
|
||||||
WRAP(QString, supportInformation)
|
WRAP(QString, supportInformation)
|
||||||
WRAP(bool, waitForCompositingSetup)
|
WRAP(bool, waitForCompositingSetup)
|
||||||
|
|
||||||
|
@ -245,4 +245,9 @@ void DBusInterface::previousDesktop()
|
||||||
VirtualDesktopManager::self()->moveTo<DesktopPrevious>();
|
VirtualDesktopManager::self()->moveTo<DesktopPrevious>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList< int > DBusInterface::decorationSupportedColors()
|
||||||
|
{
|
||||||
|
return decorationPlugin()->supportedColors();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "decorations.h"
|
#include "decorations.h"
|
||||||
#include "config-kwin.h"
|
#include "config-kwin.h"
|
||||||
|
#include <kdecorationfactory.h>
|
||||||
|
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <KDE/KLocalizedString>
|
#include <KDE/KLocalizedString>
|
||||||
|
@ -74,4 +75,74 @@ bool DecorationPlugin::hasNoDecoration() const
|
||||||
return m_noDecoration;
|
return m_noDecoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DecorationPlugin::hasShadows() const
|
||||||
|
{
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return factory()->supports(AbilityProvidesShadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DecorationPlugin::hasAlpha() const
|
||||||
|
{
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return factory()->supports(AbilityUsesAlphaChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DecorationPlugin::supportsAnnounceAlpha() const
|
||||||
|
{
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return factory()->supports(AbilityAnnounceAlphaChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DecorationPlugin::supportsTabbing() const
|
||||||
|
{
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return factory()->supports(AbilityTabbing);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DecorationPlugin::supportsFrameOverlap() const
|
||||||
|
{
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return factory()->supports(AbilityExtendIntoClientArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DecorationPlugin::supportsBlurBehind() const
|
||||||
|
{
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return factory()->supports(AbilityUsesBlurBehind);
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::Corner DecorationPlugin::closeButtonCorner()
|
||||||
|
{
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return Qt::TopRightCorner;
|
||||||
|
}
|
||||||
|
return factory()->closeButtonCorner();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList< int > DecorationPlugin::supportedColors() const
|
||||||
|
{
|
||||||
|
QList<int> ret;
|
||||||
|
if (hasNoDecoration()) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
for (Ability ab = ABILITYCOLOR_FIRST;
|
||||||
|
ab < ABILITYCOLOR_END;
|
||||||
|
ab = static_cast<Ability>(ab + 1))
|
||||||
|
if (factory()->supports(ab))
|
||||||
|
ret << ab;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -38,6 +38,21 @@ public:
|
||||||
* @returns @c true if there is no decoration plugin.
|
* @returns @c true if there is no decoration plugin.
|
||||||
**/
|
**/
|
||||||
bool hasNoDecoration() const;
|
bool hasNoDecoration() const;
|
||||||
|
|
||||||
|
bool hasShadows() const;
|
||||||
|
bool hasAlpha() const;
|
||||||
|
bool supportsAnnounceAlpha() const;
|
||||||
|
bool supportsTabbing() const;
|
||||||
|
bool supportsFrameOverlap() const;
|
||||||
|
bool supportsBlurBehind() const;
|
||||||
|
Qt::Corner closeButtonCorner();
|
||||||
|
|
||||||
|
// D-Bus interface
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @todo: remove KDE5
|
||||||
|
**/
|
||||||
|
QList<int> supportedColors() const;
|
||||||
protected:
|
protected:
|
||||||
virtual void error(const QString& error_msg);
|
virtual void error(const QString& error_msg);
|
||||||
private:
|
private:
|
||||||
|
@ -46,6 +61,10 @@ private:
|
||||||
KWIN_SINGLETON(DecorationPlugin)
|
KWIN_SINGLETON(DecorationPlugin)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline DecorationPlugin *decorationPlugin() {
|
||||||
|
return DecorationPlugin::self();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
#ifdef KWIN_BUILD_ACTIVITIES
|
||||||
#include "activities.h"
|
#include "activities.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "decorations.h"
|
||||||
#include "deleted.h"
|
#include "deleted.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
|
@ -452,17 +453,17 @@ void EffectsHandlerImpl::buildQuads(EffectWindow* w, WindowQuadList& quadList)
|
||||||
|
|
||||||
bool EffectsHandlerImpl::hasDecorationShadows() const
|
bool EffectsHandlerImpl::hasDecorationShadows() const
|
||||||
{
|
{
|
||||||
return Workspace::self()->hasDecorationShadows();
|
return decorationPlugin()->hasShadows();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectsHandlerImpl::decorationsHaveAlpha() const
|
bool EffectsHandlerImpl::decorationsHaveAlpha() const
|
||||||
{
|
{
|
||||||
return Workspace::self()->decorationHasAlpha();
|
return decorationPlugin()->hasAlpha();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectsHandlerImpl::decorationSupportsBlurBehind() const
|
bool EffectsHandlerImpl::decorationSupportsBlurBehind() const
|
||||||
{
|
{
|
||||||
return Workspace::self()->decorationSupportsBlurBehind();
|
return decorationPlugin()->supportsBlurBehind();
|
||||||
}
|
}
|
||||||
|
|
||||||
// start another painting pass
|
// start another painting pass
|
||||||
|
@ -1584,7 +1585,7 @@ QVariant EffectsHandlerImpl::kwinOption(KWinOption kwopt)
|
||||||
{
|
{
|
||||||
switch (kwopt) {
|
switch (kwopt) {
|
||||||
case CloseButtonCorner:
|
case CloseButtonCorner:
|
||||||
return Workspace::self()->decorationCloseButtonCorner();
|
return decorationPlugin()->closeButtonCorner();
|
||||||
#ifdef KWIN_BUILD_SCREENEDGES
|
#ifdef KWIN_BUILD_SCREENEDGES
|
||||||
case SwitchDesktopOnScreenEdge:
|
case SwitchDesktopOnScreenEdge:
|
||||||
return ScreenEdges::self()->isDesktopSwitching();
|
return ScreenEdges::self()->isDesktopSwitching();
|
||||||
|
|
|
@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "focuschain.h"
|
#include "focuschain.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "atoms.h"
|
#include "atoms.h"
|
||||||
|
@ -1302,7 +1303,7 @@ bool Client::buttonReleaseEvent(Window w, int /*button*/, int state, int x, int
|
||||||
// mouse position is still relative to old Client position, adjust it
|
// mouse position is still relative to old Client position, adjust it
|
||||||
QPoint mousepos(x_root - x + padding_left, y_root - y + padding_top);
|
QPoint mousepos(x_root - x + padding_left, y_root - y + padding_top);
|
||||||
mode = mousePosition(mousepos);
|
mode = mousePosition(mousepos);
|
||||||
} else if (workspace()->decorationSupportsTabbing())
|
} else if (decorationPlugin()->supportsTabbing())
|
||||||
return false;
|
return false;
|
||||||
updateCursor();
|
updateCursor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,11 @@ KDecorationFactory* KDecorationPlugins::factory()
|
||||||
return fact;
|
return fact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const KDecorationFactory *KDecorationPlugins::factory() const
|
||||||
|
{
|
||||||
|
return fact;
|
||||||
|
}
|
||||||
|
|
||||||
// convenience
|
// convenience
|
||||||
KDecoration* KDecorationPlugins::createDecoration(KDecorationBridge* bridge)
|
KDecoration* KDecorationPlugins::createDecoration(KDecorationBridge* bridge)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
bool loadPlugin(QString name);
|
bool loadPlugin(QString name);
|
||||||
void destroyPreviousPlugin();
|
void destroyPreviousPlugin();
|
||||||
KDecorationFactory* factory();
|
KDecorationFactory* factory();
|
||||||
|
const KDecorationFactory* factory() const;
|
||||||
KDecoration* createDecoration(KDecorationBridge*);
|
KDecoration* createDecoration(KDecorationBridge*);
|
||||||
QString currentPlugin();
|
QString currentPlugin();
|
||||||
bool reset(unsigned long changed); // returns true if decorations need to be recreated
|
bool reset(unsigned long changed); // returns true if decorations need to be recreated
|
||||||
|
|
|
@ -74,6 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "deleted.h"
|
#include "deleted.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "overlaywindow.h"
|
#include "overlaywindow.h"
|
||||||
|
@ -624,7 +625,7 @@ WindowQuadList Scene::Window::buildQuads(bool force) const
|
||||||
Client *client = dynamic_cast<Client*>(toplevel);
|
Client *client = dynamic_cast<Client*>(toplevel);
|
||||||
QRegion contents = clientShape();
|
QRegion contents = clientShape();
|
||||||
QRegion center = toplevel->transparentRect();
|
QRegion center = toplevel->transparentRect();
|
||||||
QRegion decoration = (client && Workspace::self()->decorationHasAlpha() ?
|
QRegion decoration = (client && decorationPlugin()->hasAlpha() ?
|
||||||
QRegion(client->decorationRect()) : shape()) - center;
|
QRegion(client->decorationRect()) : shape()) - center;
|
||||||
ret = makeQuads(WindowQuadContents, contents);
|
ret = makeQuads(WindowQuadContents, contents);
|
||||||
if (!client || !(center.isEmpty() || client->isShade()))
|
if (!client || !(center.isEmpty() || client->isShade()))
|
||||||
|
|
|
@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "toplevel.h"
|
#include "toplevel.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "deleted.h"
|
#include "deleted.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "overlaywindow.h"
|
#include "overlaywindow.h"
|
||||||
|
@ -469,7 +470,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
|
||||||
Deleted *deleted = dynamic_cast<Deleted*>(toplevel);
|
Deleted *deleted = dynamic_cast<Deleted*>(toplevel);
|
||||||
const QRect decorationRect = toplevel->decorationRect();
|
const QRect decorationRect = toplevel->decorationRect();
|
||||||
if (((client && !client->noBorder()) || (deleted && !deleted->noBorder())) &&
|
if (((client && !client->noBorder()) || (deleted && !deleted->noBorder())) &&
|
||||||
Workspace::self()->decorationHasAlpha()) {
|
decorationPlugin()->hasAlpha()) {
|
||||||
// decorated client
|
// decorated client
|
||||||
transformed_shape = decorationRect;
|
transformed_shape = decorationRect;
|
||||||
if (toplevel->shape()) {
|
if (toplevel->shape()) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "tabgroup.h"
|
#include "tabgroup.h"
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -62,7 +63,7 @@ bool TabGroup::add(Client* c, Client *other, bool after, bool becomeVisible)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!c->tabGroup());
|
Q_ASSERT(!c->tabGroup());
|
||||||
|
|
||||||
if (!c->workspace()->decorationSupportsTabbing() || contains(c) || !contains(other))
|
if (!decorationPlugin()->supportsTabbing() || contains(c) || !contains(other))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Tabbed windows MUST have a decoration
|
// Tabbed windows MUST have a decoration
|
||||||
|
|
|
@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "useractions.h"
|
#include "useractions.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "virtualdesktops.h"
|
#include "virtualdesktops.h"
|
||||||
|
@ -357,7 +358,7 @@ void UserActionsMenu::init()
|
||||||
m_menu->addSeparator();
|
m_menu->addSeparator();
|
||||||
|
|
||||||
// Actions for window tabbing
|
// Actions for window tabbing
|
||||||
if (Workspace::self()->decorationSupportsTabbing()) {
|
if (decorationPlugin()->supportsTabbing()) {
|
||||||
m_removeFromTabGroup = m_menu->addAction(i18n("&Untab"));
|
m_removeFromTabGroup = m_menu->addAction(i18n("&Untab"));
|
||||||
kaction = qobject_cast<KAction*>(keys->action("Untab"));
|
kaction = qobject_cast<KAction*>(keys->action("Untab"));
|
||||||
if (kaction != 0)
|
if (kaction != 0)
|
||||||
|
@ -440,7 +441,7 @@ void UserActionsMenu::menuAboutToShow()
|
||||||
m_minimizeOperation->setEnabled(m_client.data()->isMinimizable());
|
m_minimizeOperation->setEnabled(m_client.data()->isMinimizable());
|
||||||
m_closeOperation->setEnabled(m_client.data()->isCloseable());
|
m_closeOperation->setEnabled(m_client.data()->isCloseable());
|
||||||
|
|
||||||
if (ws->decorationSupportsTabbing()) {
|
if (decorationPlugin()->supportsTabbing()) {
|
||||||
initTabbingPopups();
|
initTabbingPopups();
|
||||||
} else {
|
} else {
|
||||||
delete m_addTabsMenu;
|
delete m_addTabsMenu;
|
||||||
|
|
|
@ -47,6 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "composite.h"
|
#include "composite.h"
|
||||||
|
#include "decorations.h"
|
||||||
#include "focuschain.h"
|
#include "focuschain.h"
|
||||||
#ifdef KWIN_BUILD_TABBOX
|
#ifdef KWIN_BUILD_TABBOX
|
||||||
#include "tabbox.h"
|
#include "tabbox.h"
|
||||||
|
@ -66,6 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "useractions.h"
|
#include "useractions.h"
|
||||||
#include "virtualdesktops.h"
|
#include "virtualdesktops.h"
|
||||||
#include "xcbutils.h"
|
#include "xcbutils.h"
|
||||||
|
#include <kdecorationfactory.h>
|
||||||
#include <kwinglplatform.h>
|
#include <kwinglplatform.h>
|
||||||
#include <kwinglutils.h>
|
#include <kwinglutils.h>
|
||||||
#ifdef KWIN_BUILD_SCREENEDGES
|
#ifdef KWIN_BUILD_SCREENEDGES
|
||||||
|
@ -159,7 +161,7 @@ Workspace::Workspace(bool restore)
|
||||||
reparseConfigFuture.waitForFinished();
|
reparseConfigFuture.waitForFinished();
|
||||||
options->loadConfig();
|
options->loadConfig();
|
||||||
options->loadCompositingConfig(false);
|
options->loadCompositingConfig(false);
|
||||||
mgr = DecorationPlugin::create(this);
|
DecorationPlugin::create(this);
|
||||||
default_colormap = DefaultColormap(display(), screen_number);
|
default_colormap = DefaultColormap(display(), screen_number);
|
||||||
installed_colormap = default_colormap;
|
installed_colormap = default_colormap;
|
||||||
|
|
||||||
|
@ -354,7 +356,8 @@ void Workspace::init()
|
||||||
,
|
,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasDecorationPlugin() && mgr->factory()->supports(AbilityExtendIntoClientArea))
|
DecorationPlugin *deco = DecorationPlugin::self();
|
||||||
|
if (!deco->hasNoDecoration() && deco->factory()->supports(AbilityExtendIntoClientArea))
|
||||||
protocols[ NETRootInfo::PROTOCOLS2 ] |= NET::WM2FrameOverlap;
|
protocols[ NETRootInfo::PROTOCOLS2 ] |= NET::WM2FrameOverlap;
|
||||||
|
|
||||||
rootInfo = new RootInfo(this, display(), supportWindow->winId(), "KWin", protocols, 5, screen_number);
|
rootInfo = new RootInfo(this, display(), supportWindow->winId(), "KWin", protocols, 5, screen_number);
|
||||||
|
@ -534,7 +537,7 @@ Workspace::~Workspace()
|
||||||
|
|
||||||
delete rootInfo;
|
delete rootInfo;
|
||||||
delete supportWindow;
|
delete supportWindow;
|
||||||
delete DecorationManager::self();
|
delete decorationPlugin();
|
||||||
delete startup;
|
delete startup;
|
||||||
delete Placement::self();
|
delete Placement::self();
|
||||||
delete client_keys_dialog;
|
delete client_keys_dialog;
|
||||||
|
@ -913,7 +916,8 @@ void Workspace::slotReconfigure()
|
||||||
m_userActionsMenu->discard();
|
m_userActionsMenu->discard();
|
||||||
updateToolWindows(true);
|
updateToolWindows(true);
|
||||||
|
|
||||||
if (hasDecorationPlugin() && mgr->reset(changed)) {
|
DecorationPlugin *deco = DecorationPlugin::self();
|
||||||
|
if (!deco->hasNoDecoration() && deco->reset(changed)) {
|
||||||
// Decorations need to be recreated
|
// Decorations need to be recreated
|
||||||
|
|
||||||
// This actually seems to make things worse now
|
// This actually seems to make things worse now
|
||||||
|
@ -925,11 +929,11 @@ void Workspace::slotReconfigure()
|
||||||
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
|
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
|
||||||
(*it)->updateDecoration(true, true);
|
(*it)->updateDecoration(true, true);
|
||||||
// If the new decoration doesn't supports tabs then ungroup clients
|
// If the new decoration doesn't supports tabs then ungroup clients
|
||||||
if (!decorationSupportsTabbing()) {
|
if (!decorationPlugin()->supportsTabbing()) {
|
||||||
foreach (Client * c, clients)
|
foreach (Client * c, clients)
|
||||||
c->untab();
|
c->untab();
|
||||||
}
|
}
|
||||||
mgr->destroyPreviousPlugin();
|
deco->destroyPreviousPlugin();
|
||||||
} else {
|
} else {
|
||||||
forEachClient(CheckBorderSizesProcedure());
|
forEachClient(CheckBorderSizesProcedure());
|
||||||
foreach (Client * c, clients)
|
foreach (Client * c, clients)
|
||||||
|
@ -957,8 +961,8 @@ void Workspace::slotReconfigure()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasDecorationPlugin()) {
|
if (!deco->hasNoDecoration()) {
|
||||||
rootInfo->setSupported(NET::WM2FrameOverlap, mgr->factory()->supports(AbilityExtendIntoClientArea));
|
rootInfo->setSupported(NET::WM2FrameOverlap, deco->factory()->supports(AbilityExtendIntoClientArea));
|
||||||
} else {
|
} else {
|
||||||
rootInfo->setSupported(NET::WM2FrameOverlap, false);
|
rootInfo->setSupported(NET::WM2FrameOverlap, false);
|
||||||
}
|
}
|
||||||
|
@ -1476,33 +1480,6 @@ void Workspace::cancelDelayFocus()
|
||||||
delayFocusTimer = 0;
|
delayFocusTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
KDecoration* Workspace::createDecoration(KDecorationBridge* bridge)
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return mgr->createDecoration(bridge);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of all colors (KDecorationDefines::ColorType) the current
|
|
||||||
* decoration supports
|
|
||||||
*/
|
|
||||||
QList<int> Workspace::decorationSupportedColors() const
|
|
||||||
{
|
|
||||||
QList<int> ret;
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
KDecorationFactory* factory = mgr->factory();
|
|
||||||
for (Ability ab = ABILITYCOLOR_FIRST;
|
|
||||||
ab < ABILITYCOLOR_END;
|
|
||||||
ab = static_cast<Ability>(ab + 1))
|
|
||||||
if (factory->supports(ab))
|
|
||||||
ret << ab;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Workspace::checkStartupNotification(Window w, KStartupInfoId& id, KStartupInfoData& data)
|
bool Workspace::checkStartupNotification(Window w, KStartupInfoId& id, KStartupInfoData& data)
|
||||||
{
|
{
|
||||||
return startup->checkStartup(w, id, data) == KStartupInfo::Match;
|
return startup->checkStartup(w, id, data) == KStartupInfo::Match;
|
||||||
|
@ -1837,9 +1814,9 @@ QString Workspace::supportInformation() const
|
||||||
void Workspace::slotCompositingToggled()
|
void Workspace::slotCompositingToggled()
|
||||||
{
|
{
|
||||||
// notify decorations that composition state has changed
|
// notify decorations that composition state has changed
|
||||||
if (hasDecorationPlugin()) {
|
DecorationPlugin *deco = DecorationPlugin::self();
|
||||||
KDecorationFactory* factory = mgr->factory();
|
if (!deco->hasNoDecoration()) {
|
||||||
factory->reset(SettingCompositing);
|
deco->factory()->reset(SettingCompositing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
86
workspace.h
86
workspace.h
|
@ -35,9 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// need to include utils.h before we use the ifdefs
|
// need to include utils.h before we use the ifdefs
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include "decorations.h"
|
|
||||||
#include "kdecoration.h"
|
#include "kdecoration.h"
|
||||||
#include "kdecorationfactory.h"
|
|
||||||
#include "sm.h"
|
#include "sm.h"
|
||||||
#include "killwindow.h"
|
#include "killwindow.h"
|
||||||
|
|
||||||
|
@ -60,7 +58,6 @@ namespace KWin
|
||||||
class Client;
|
class Client;
|
||||||
class Outline;
|
class Outline;
|
||||||
class RootInfo;
|
class RootInfo;
|
||||||
class DecorationPlugin;
|
|
||||||
class Rules;
|
class Rules;
|
||||||
class UserActionsMenu;
|
class UserActionsMenu;
|
||||||
class WindowRules;
|
class WindowRules;
|
||||||
|
@ -80,9 +77,6 @@ public:
|
||||||
bool workspaceEvent(XEvent*);
|
bool workspaceEvent(XEvent*);
|
||||||
bool workspaceEvent(QEvent*);
|
bool workspaceEvent(QEvent*);
|
||||||
|
|
||||||
KDecoration* createDecoration(KDecorationBridge* bridge);
|
|
||||||
bool hasDecorationPlugin() const;
|
|
||||||
|
|
||||||
bool hasClient(const Client*);
|
bool hasClient(const Client*);
|
||||||
|
|
||||||
template<typename T> Client* findClient(T predicate) const;
|
template<typename T> Client* findClient(T predicate) const;
|
||||||
|
@ -281,20 +275,7 @@ public:
|
||||||
void disableRulesUpdates(bool disable);
|
void disableRulesUpdates(bool disable);
|
||||||
bool rulesUpdatesDisabled() const;
|
bool rulesUpdatesDisabled() const;
|
||||||
|
|
||||||
bool hasDecorationShadows() const;
|
|
||||||
Qt::Corner decorationCloseButtonCorner();
|
|
||||||
bool decorationHasAlpha() const;
|
|
||||||
bool decorationSupportsAnnounceAlpha() const;
|
|
||||||
bool decorationSupportsTabbing() const; // Returns true if the decoration supports tabs.
|
|
||||||
bool decorationSupportsFrameOverlap() const;
|
|
||||||
bool decorationSupportsBlurBehind() const;
|
|
||||||
|
|
||||||
// D-Bus interface
|
// D-Bus interface
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @todo: remove KDE5
|
|
||||||
**/
|
|
||||||
QList<int> decorationSupportedColors() const;
|
|
||||||
bool waitForCompositingSetup();
|
bool waitForCompositingSetup();
|
||||||
QString supportInformation() const;
|
QString supportInformation() const;
|
||||||
|
|
||||||
|
@ -592,8 +573,6 @@ private:
|
||||||
bool global_shortcuts_disabled;
|
bool global_shortcuts_disabled;
|
||||||
bool global_shortcuts_disabled_for_client;
|
bool global_shortcuts_disabled_for_client;
|
||||||
|
|
||||||
DecorationPlugin* mgr;
|
|
||||||
|
|
||||||
RootInfo* rootInfo;
|
RootInfo* rootInfo;
|
||||||
QWidget* supportWindow;
|
QWidget* supportWindow;
|
||||||
|
|
||||||
|
@ -835,71 +814,6 @@ inline bool Workspace::hasClient(const Client* c)
|
||||||
return findClient(ClientMatchPredicate(c));
|
return findClient(ClientMatchPredicate(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Workspace::hasDecorationPlugin() const
|
|
||||||
{
|
|
||||||
if (!mgr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !mgr->hasNoDecoration();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool Workspace::hasDecorationShadows() const
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return mgr->factory()->supports(AbilityProvidesShadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Qt::Corner Workspace::decorationCloseButtonCorner()
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return Qt::TopRightCorner;
|
|
||||||
}
|
|
||||||
return mgr->factory()->closeButtonCorner();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool Workspace::decorationHasAlpha() const
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return mgr->factory()->supports(AbilityUsesAlphaChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool Workspace::decorationSupportsAnnounceAlpha() const
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return mgr->factory()->supports(AbilityAnnounceAlphaChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool Workspace::decorationSupportsTabbing() const
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return mgr->factory()->supports(AbilityTabbing);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool Workspace::decorationSupportsFrameOverlap() const
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return mgr->factory()->supports(AbilityExtendIntoClientArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool Workspace::decorationSupportsBlurBehind() const
|
|
||||||
{
|
|
||||||
if (!hasDecorationPlugin()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return mgr->factory()->supports(AbilityUsesBlurBehind);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue