Do not include kdecoration.h in plastik decoration plugin

This commit is contained in:
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}) 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(TARGETS plastikplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kwin/decorations/plastik)
install(FILES qmldir 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/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
#include "plastikbutton.h" #include "plastikbutton.h"
#include <kdecoration.h>
#include <KColorScheme> #include <KColorScheme>
#include <KConfigGroup> #include <KConfigGroup>
#include <KSharedConfig> #include <KSharedConfig>
@ -57,52 +56,52 @@ QPixmap PlastikButtonProvider::requestPixmap(const QString &id, QSize *size, con
shadow = true; shadow = true;
} }
ButtonIcon button; ButtonIcon button;
switch (static_cast<KDecorationDefines::DecorationButton>(idParts[0].toInt())) { switch (static_cast<DecorationButton>(idParts[0].toInt())) {
case KDecorationDefines::DecorationButtonClose: case DecorationButtonClose:
button = CloseIcon; button = CloseIcon;
break; break;
case KDecorationDefines::DecorationButtonMaximizeRestore: case DecorationButtonMaximizeRestore:
if (toggled) { if (toggled) {
button = MaxRestoreIcon; button = MaxRestoreIcon;
} else { } else {
button = MaxIcon; button = MaxIcon;
} }
break; break;
case KDecorationDefines::DecorationButtonMinimize: case DecorationButtonMinimize:
button = MinIcon; button = MinIcon;
break; break;
case KDecorationDefines::DecorationButtonQuickHelp: case DecorationButtonQuickHelp:
button = HelpIcon; button = HelpIcon;
break; break;
case KDecorationDefines::DecorationButtonOnAllDesktops: case DecorationButtonOnAllDesktops:
if (toggled) { if (toggled) {
button = NotOnAllDesktopsIcon; button = NotOnAllDesktopsIcon;
} else { } else {
button = OnAllDesktopsIcon; button = OnAllDesktopsIcon;
} }
break; break;
case KDecorationDefines::DecorationButtonKeepAbove: case DecorationButtonKeepAbove:
if (toggled) { if (toggled) {
button = NoKeepAboveIcon; button = NoKeepAboveIcon;
} else { } else {
button = KeepAboveIcon; button = KeepAboveIcon;
} }
break; break;
case KDecorationDefines::DecorationButtonKeepBelow: case DecorationButtonKeepBelow:
if (toggled) { if (toggled) {
button = NoKeepBelowIcon; button = NoKeepBelowIcon;
} else { } else {
button = KeepBelowIcon; button = KeepBelowIcon;
} }
break; break;
case KDecorationDefines::DecorationButtonShade: case DecorationButtonShade:
if (toggled) { if (toggled) {
button = UnShadeIcon; button = UnShadeIcon;
} else { } else {
button = ShadeIcon; button = ShadeIcon;
} }
break; break;
case KDecorationDefines::DecorationButtonApplicationMenu: case DecorationButtonApplicationMenu:
button = AppMenuIcon; button = AppMenuIcon;
break; break;
default: default:

View file

@ -52,6 +52,29 @@ private:
DiagonalLine, DiagonalLine,
CrossDiagonalLine 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); QPixmap icon(ButtonIcon icon, int size, bool active, bool shadow);
void drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth); void drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth);
}; };