Do not include kdecoration.h in plastik decoration plugin

icc-effect-5.14.5
Martin Gräßlin 2014-12-02 10:14:29 +01:00
parent 4188736bc4
commit f5c305bf64
3 changed files with 34 additions and 12 deletions

View File

@ -4,6 +4,6 @@ set(plastik_plugin_SRCS
)
add_library(plastikplugin SHARED ${plastik_plugin_SRCS})
target_link_libraries(plastikplugin Qt5::Core Qt5::Quick KF5::ConfigWidgets KF5::WindowSystem)
target_link_libraries(plastikplugin Qt5::Core Qt5::Quick KF5::ConfigWidgets)
install(TARGETS plastikplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kwin/decorations/plastik)
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/kwin/decorations/plastik)

View File

@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "plastikbutton.h"
#include <kdecoration.h>
#include <KColorScheme>
#include <KConfigGroup>
#include <KSharedConfig>
@ -57,52 +56,52 @@ QPixmap PlastikButtonProvider::requestPixmap(const QString &id, QSize *size, con
shadow = true;
}
ButtonIcon button;
switch (static_cast<KDecorationDefines::DecorationButton>(idParts[0].toInt())) {
case KDecorationDefines::DecorationButtonClose:
switch (static_cast<DecorationButton>(idParts[0].toInt())) {
case DecorationButtonClose:
button = CloseIcon;
break;
case KDecorationDefines::DecorationButtonMaximizeRestore:
case DecorationButtonMaximizeRestore:
if (toggled) {
button = MaxRestoreIcon;
} else {
button = MaxIcon;
}
break;
case KDecorationDefines::DecorationButtonMinimize:
case DecorationButtonMinimize:
button = MinIcon;
break;
case KDecorationDefines::DecorationButtonQuickHelp:
case DecorationButtonQuickHelp:
button = HelpIcon;
break;
case KDecorationDefines::DecorationButtonOnAllDesktops:
case DecorationButtonOnAllDesktops:
if (toggled) {
button = NotOnAllDesktopsIcon;
} else {
button = OnAllDesktopsIcon;
}
break;
case KDecorationDefines::DecorationButtonKeepAbove:
case DecorationButtonKeepAbove:
if (toggled) {
button = NoKeepAboveIcon;
} else {
button = KeepAboveIcon;
}
break;
case KDecorationDefines::DecorationButtonKeepBelow:
case DecorationButtonKeepBelow:
if (toggled) {
button = NoKeepBelowIcon;
} else {
button = KeepBelowIcon;
}
break;
case KDecorationDefines::DecorationButtonShade:
case DecorationButtonShade:
if (toggled) {
button = UnShadeIcon;
} else {
button = ShadeIcon;
}
break;
case KDecorationDefines::DecorationButtonApplicationMenu:
case DecorationButtonApplicationMenu:
button = AppMenuIcon;
break;
default:

View File

@ -52,6 +52,29 @@ private:
DiagonalLine,
CrossDiagonalLine
};
enum DecorationButton {
/**
* Invalid button value. A decoration should not create a button for
* this type.
*/
DecorationButtonNone,
DecorationButtonMenu,
DecorationButtonApplicationMenu,
DecorationButtonOnAllDesktops,
DecorationButtonQuickHelp,
DecorationButtonMinimize,
DecorationButtonMaximizeRestore,
DecorationButtonClose,
DecorationButtonKeepAbove,
DecorationButtonKeepBelow,
DecorationButtonShade,
DecorationButtonResize,
/**
* The decoration should create an empty spacer instead of a button for
* this type.
*/
DecorationButtonExplicitSpacer
};
QPixmap icon(ButtonIcon icon, int size, bool active, bool shadow);
void drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth);
};