kwin/tabbox/qml/ShadowedSvgItem.qml
Martin Gräßlin 0c92e1f30c Use translucent/dialogs/background elements where possible
In effects it's obvious that compositing is enabled, so specifying the
translucent element is no problem.

In tabbox a context property "compositing" is injected which decides
whether "translucent" or "opaque" elements should be used. Here the
translucent elements are only used if the Blur effect is available - for
this a new Effect::Feature Blur is introduced and in addition it is
tested whether the theme provides the translucent element.

Also the masking is adjusted to ensure that only the shadow is not
blurred.

Reason for this change is that Plasma theme seems not always to pick up
whether compositing is used when used from inside KWin. It does not cover
the Desktop Change OSD which uses PlasmaCore.Dialog and there we cannot
(yet) inject that we use compositing.

Overall I'm quite unhappy with this patch and I do hope we can fix it in
the proper place in the lifetime of 4.10 and revert this patch.

CCBUG: 311995
REVIEW: 108438
2013-01-30 15:14:54 +01:00

54 lines
2.2 KiB
QML

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2013 Weng Xuetian <wengxt@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 1.0
import org.kde.plasma.core 0.1 as PlasmaCore
Item {
property double leftMargin: shadow.margins.left + background.margins.left
property double topMargin: shadow.margins.top + background.margins.top
property double rightMargin: shadow.margins.right + background.margins.right
property double bottomMargin: shadow.margins.bottom + background.margins.bottom
property double centerWidth: shadow.width - shadow.margins.left - shadow.margins.right
property double centerHeight: shadow.height - shadow.margins.bottom - shadow.margins.top
property int centerTopMargin: shadow.margins.top
property int centerLeftMargin: shadow.margins.left
property alias maskImagePath: shadow.imagePath
PlasmaCore.FrameSvgItem {
id: shadow
imagePath: (compositing ? "translucent" : "opaque") + "/dialogs/background"
prefix: "shadow"
anchors.fill: parent
PlasmaCore.FrameSvgItem {
id: background
imagePath: shadow.imagePath
visible: false
anchors {
fill: parent
leftMargin: shadow.margins.left
topMargin: shadow.margins.top
rightMargin: shadow.margins.right
bottomMargin: shadow.margins.bottom
}
}
}
}