2009-06-19 09:18:07 +00:00
|
|
|
/********************************************************************
|
2012-01-07 16:05:22 +00:00
|
|
|
Copyright (C) 2009, 2010, 2012 Martin Gräßlin <mgraesslin@kde.org>
|
2009-06-19 09:18:07 +00:00
|
|
|
|
|
|
|
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/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#include "aurorae.h"
|
2010-04-12 19:28:58 +00:00
|
|
|
#include "auroraetheme.h"
|
2009-06-19 09:18:07 +00:00
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
#include <QApplication>
|
2012-01-11 20:14:29 +00:00
|
|
|
#include <QtDeclarative/QDeclarativeComponent>
|
2012-01-04 20:11:28 +00:00
|
|
|
#include <QtDeclarative/QDeclarativeContext>
|
2012-01-07 16:25:21 +00:00
|
|
|
#include <QtDeclarative/QDeclarativeEngine>
|
2012-01-11 20:14:29 +00:00
|
|
|
#include <QtDeclarative/QDeclarativeItem>
|
|
|
|
#include <QtGui/QGraphicsView>
|
2009-06-19 09:18:07 +00:00
|
|
|
|
|
|
|
#include <KConfig>
|
|
|
|
#include <KConfigGroup>
|
2012-01-07 16:25:21 +00:00
|
|
|
#include <KStandardDirs>
|
2010-04-12 19:28:58 +00:00
|
|
|
#include <Plasma/FrameSvg>
|
2009-06-19 09:18:07 +00:00
|
|
|
|
|
|
|
namespace Aurorae
|
|
|
|
{
|
|
|
|
|
|
|
|
AuroraeFactory::AuroraeFactory()
|
|
|
|
: QObject()
|
|
|
|
, KDecorationFactoryUnstable()
|
2010-04-12 19:28:58 +00:00
|
|
|
, m_theme(new AuroraeTheme(this))
|
2012-01-11 20:14:29 +00:00
|
|
|
, m_engine(new QDeclarativeEngine(this))
|
|
|
|
, m_component(new QDeclarativeComponent(m_engine, this))
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AuroraeFactory::init()
|
|
|
|
{
|
2011-12-05 14:29:26 +00:00
|
|
|
qRegisterMetaType<uint>("Qt::MouseButtons");
|
|
|
|
|
2009-06-19 09:18:07 +00:00
|
|
|
KConfig conf("auroraerc");
|
|
|
|
KConfigGroup group(&conf, "Engine");
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
const QString themeName = group.readEntry("ThemeName", "example-deco");
|
|
|
|
KConfig config("aurorae/themes/" + themeName + '/' + themeName + "rc", KConfig::FullConfig, "data");
|
2010-04-21 18:18:45 +00:00
|
|
|
KConfigGroup themeGroup(&conf, themeName);
|
2010-04-12 19:28:58 +00:00
|
|
|
m_theme->loadTheme(themeName, config);
|
2010-04-21 18:18:45 +00:00
|
|
|
m_theme->setBorderSize((KDecorationDefines::BorderSize)themeGroup.readEntry<int>("BorderSize", KDecorationDefines::BorderNormal));
|
|
|
|
m_theme->setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry<int>("ButtonSize", KDecorationDefines::BorderNormal));
|
2010-05-09 16:34:58 +00:00
|
|
|
m_theme->setTabDragMimeType(clientGroupItemDragMimeType());
|
2012-01-11 20:14:29 +00:00
|
|
|
// setup the QML engine
|
|
|
|
foreach (const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) {
|
|
|
|
m_engine->addImportPath(importPath);
|
|
|
|
}
|
|
|
|
m_component->loadUrl(QUrl(KStandardDirs::locate("data", "kwin/aurorae/aurorae.qml")));
|
|
|
|
m_engine->rootContext()->setContextProperty("auroraeTheme", m_theme);
|
2012-01-13 10:48:04 +00:00
|
|
|
m_engine->rootContext()->setContextProperty("options", this);
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AuroraeFactory::~AuroraeFactory()
|
|
|
|
{
|
|
|
|
s_instance = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
AuroraeFactory *AuroraeFactory::instance()
|
|
|
|
{
|
|
|
|
if (!s_instance) {
|
|
|
|
s_instance = new AuroraeFactory;
|
|
|
|
}
|
|
|
|
|
|
|
|
return s_instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AuroraeFactory::reset(unsigned long changed)
|
|
|
|
{
|
2012-01-13 10:48:04 +00:00
|
|
|
if (changed & SettingButtons) {
|
|
|
|
emit buttonsChanged();
|
|
|
|
}
|
2012-01-13 11:58:00 +00:00
|
|
|
const KConfig conf("auroraerc");
|
|
|
|
const KConfigGroup group(&conf, "Engine");
|
|
|
|
const QString themeName = group.readEntry("ThemeName", "example-deco");
|
|
|
|
const KConfig config("aurorae/themes/" + themeName + '/' + themeName + "rc", KConfig::FullConfig, "data");
|
|
|
|
const KConfigGroup themeGroup(&conf, themeName);
|
|
|
|
if (themeName != m_theme->themeName()) {
|
|
|
|
m_theme->loadTheme(themeName, config);
|
|
|
|
resetDecorations(changed);
|
|
|
|
}
|
|
|
|
m_theme->setBorderSize((KDecorationDefines::BorderSize)themeGroup.readEntry<int>("BorderSize", KDecorationDefines::BorderNormal));
|
|
|
|
m_theme->setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry<int>("ButtonSize", KDecorationDefines::BorderNormal));
|
2009-06-19 09:18:07 +00:00
|
|
|
return false; // need hard reset
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AuroraeFactory::supports(Ability ability) const
|
|
|
|
{
|
|
|
|
switch (ability) {
|
|
|
|
case AbilityAnnounceButtons:
|
|
|
|
case AbilityUsesAlphaChannel:
|
|
|
|
case AbilityButtonMenu:
|
|
|
|
case AbilityButtonSpacer:
|
2009-12-16 17:51:58 +00:00
|
|
|
case AbilityExtendIntoClientArea:
|
2009-06-19 09:18:07 +00:00
|
|
|
case AbilityButtonMinimize:
|
|
|
|
case AbilityButtonMaximize:
|
|
|
|
case AbilityButtonClose:
|
|
|
|
case AbilityButtonAboveOthers:
|
|
|
|
case AbilityButtonBelowOthers:
|
|
|
|
case AbilityButtonShade:
|
|
|
|
case AbilityButtonOnAllDesktops:
|
|
|
|
case AbilityButtonHelp:
|
|
|
|
case AbilityProvidesShadow:
|
2010-04-12 19:28:58 +00:00
|
|
|
return true; // TODO: correct value from theme
|
2010-05-09 09:08:09 +00:00
|
|
|
case AbilityClientGrouping:
|
2012-01-10 19:53:41 +00:00
|
|
|
return false;
|
2010-11-10 18:33:07 +00:00
|
|
|
case AbilityUsesBlurBehind:
|
|
|
|
return true;
|
2009-06-19 09:18:07 +00:00
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
KDecoration *AuroraeFactory::createDecoration(KDecorationBridge *bridge)
|
|
|
|
{
|
|
|
|
AuroraeClient *client = new AuroraeClient(bridge, this);
|
2010-04-12 19:28:58 +00:00
|
|
|
return client;
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2009-11-08 20:35:34 +00:00
|
|
|
QList< KDecorationDefines::BorderSize > AuroraeFactory::borderSizes() const
|
|
|
|
{
|
|
|
|
return QList< BorderSize >() << BorderTiny << BorderNormal <<
|
|
|
|
BorderLarge << BorderVeryLarge << BorderHuge <<
|
|
|
|
BorderVeryHuge << BorderOversized;
|
|
|
|
}
|
|
|
|
|
2012-01-11 20:14:29 +00:00
|
|
|
QDeclarativeItem *AuroraeFactory::createQmlDecoration(Aurorae::AuroraeClient *client)
|
|
|
|
{
|
|
|
|
QDeclarativeContext *context = new QDeclarativeContext(m_engine->rootContext(), this);
|
|
|
|
context->setContextProperty("decoration", client);
|
|
|
|
return qobject_cast< QDeclarativeItem* >(m_component->create(context));
|
|
|
|
}
|
2009-06-19 09:18:07 +00:00
|
|
|
|
2012-01-13 10:48:04 +00:00
|
|
|
QString AuroraeFactory::rightButtons()
|
|
|
|
{
|
|
|
|
return options()->titleButtonsRight();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AuroraeFactory::leftButtons()
|
|
|
|
{
|
|
|
|
return options()->titleButtonsLeft();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AuroraeFactory::customButtonPositions()
|
|
|
|
{
|
|
|
|
return options()->customButtonPositions();
|
|
|
|
}
|
|
|
|
|
2009-06-19 09:18:07 +00:00
|
|
|
AuroraeFactory *AuroraeFactory::s_instance = NULL;
|
|
|
|
|
|
|
|
/*******************************************************
|
2010-04-12 19:28:58 +00:00
|
|
|
* Client
|
2009-06-19 09:18:07 +00:00
|
|
|
*******************************************************/
|
2010-04-12 19:28:58 +00:00
|
|
|
AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *factory)
|
|
|
|
: KDecorationUnstable(bridge, factory)
|
2012-01-11 20:14:29 +00:00
|
|
|
, m_view(NULL)
|
|
|
|
, m_scene(new QGraphicsScene(this))
|
|
|
|
, m_item(AuroraeFactory::instance()->createQmlDecoration(this))
|
2012-01-07 16:25:21 +00:00
|
|
|
{
|
|
|
|
connect(this, SIGNAL(keepAboveChanged(bool)), SIGNAL(keepAboveChangedWrapper()));
|
|
|
|
connect(this, SIGNAL(keepBelowChanged(bool)), SIGNAL(keepBelowChangedWrapper()));
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-06-19 15:23:48 +00:00
|
|
|
AuroraeClient::~AuroraeClient()
|
|
|
|
{
|
|
|
|
m_view->setParent(NULL);
|
|
|
|
m_view->deleteLater();
|
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::init()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2012-01-11 20:14:29 +00:00
|
|
|
m_scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
2010-04-12 19:28:58 +00:00
|
|
|
// HACK: we need to add the GraphicsView as a child widget to a normal widget
|
|
|
|
// the GraphicsView eats the mouse release event and by that kwin core starts to move
|
|
|
|
// the decoration each time the decoration is clicked
|
|
|
|
// therefore we use two widgets and inject an own mouse release event to the parent widget
|
|
|
|
// when the graphics view eats a mouse event
|
|
|
|
createMainWidget();
|
|
|
|
widget()->setAttribute(Qt::WA_TranslucentBackground);
|
|
|
|
widget()->setAttribute(Qt::WA_NoSystemBackground);
|
2012-01-11 20:14:29 +00:00
|
|
|
m_view = new QGraphicsView(m_scene, widget());
|
2010-04-12 19:28:58 +00:00
|
|
|
m_view->setAttribute(Qt::WA_TranslucentBackground);
|
2012-01-04 20:11:28 +00:00
|
|
|
m_view->setWindowFlags(Qt::X11BypassWindowManagerHint);
|
2012-01-11 20:14:29 +00:00
|
|
|
m_view->setFrameShape(QFrame::NoFrame);
|
|
|
|
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
m_view->setOptimizationFlags(QGraphicsView::DontSavePainterState);
|
|
|
|
m_view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
2010-04-12 19:28:58 +00:00
|
|
|
QPalette pal = m_view->palette();
|
|
|
|
pal.setColor(m_view->backgroundRole(), Qt::transparent);
|
|
|
|
m_view->setPalette(pal);
|
|
|
|
QPalette pal2 = widget()->palette();
|
|
|
|
pal2.setColor(widget()->backgroundRole(), Qt::transparent);
|
|
|
|
widget()->setPalette(pal2);
|
2012-01-11 20:14:29 +00:00
|
|
|
m_scene->addItem(m_item);
|
2012-01-07 16:25:21 +00:00
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
AuroraeFactory::instance()->theme()->setCompositingActive(compositingActive());
|
2012-01-11 20:14:29 +00:00
|
|
|
connect(AuroraeFactory::instance()->theme(), SIGNAL(themeChanged()), SLOT(themeChanged()));
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::activeChange()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2012-01-04 18:51:51 +00:00
|
|
|
emit activeChanged();
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::captionChange()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2012-01-04 18:51:51 +00:00
|
|
|
emit captionChanged();
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::iconChange()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2012-01-04 18:51:51 +00:00
|
|
|
emit iconChanged();
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::desktopChange()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2012-01-04 18:51:51 +00:00
|
|
|
emit desktopChanged();
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::maximizeChange()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
if (!options()->moveResizeMaximizedWindows()) {
|
2012-01-07 16:25:21 +00:00
|
|
|
emit maximizeChanged();
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::resize(const QSize &s)
|
2010-01-29 12:37:42 +00:00
|
|
|
{
|
2012-01-11 20:14:29 +00:00
|
|
|
if (m_item) {
|
|
|
|
m_item->setWidth(s.width());
|
|
|
|
m_item->setHeight(s.height());
|
|
|
|
}
|
|
|
|
m_scene->setSceneRect(QRectF(QPoint(0, 0), s));
|
2010-04-12 19:28:58 +00:00
|
|
|
m_view->resize(s);
|
|
|
|
widget()->resize(s);
|
2010-01-29 12:37:42 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::shadeChange()
|
2010-01-29 12:37:42 +00:00
|
|
|
{
|
2012-01-04 18:51:51 +00:00
|
|
|
emit shadeChanged();
|
2010-01-29 12:37:42 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::borders(int &left, int &right, int &top, int &bottom) const
|
2010-01-29 12:37:42 +00:00
|
|
|
{
|
2012-01-11 20:14:29 +00:00
|
|
|
if (!m_item) {
|
2012-01-09 22:07:22 +00:00
|
|
|
left = right = top = bottom = 0;
|
|
|
|
return;
|
|
|
|
}
|
2010-04-12 19:28:58 +00:00
|
|
|
const bool maximized = maximizeMode() == MaximizeFull && !options()->moveResizeMaximizedWindows();
|
2012-01-07 16:25:21 +00:00
|
|
|
if (maximized) {
|
2012-01-11 20:14:29 +00:00
|
|
|
left = m_item->property("borderLeftMaximized").toInt();
|
|
|
|
right = m_item->property("borderRightMaximized").toInt();
|
|
|
|
top = m_item->property("borderTopMaximized").toInt();
|
|
|
|
bottom = m_item->property("borderBottomMaximized").toInt();
|
2012-01-07 16:25:21 +00:00
|
|
|
} else {
|
2012-01-11 20:14:29 +00:00
|
|
|
left = m_item->property("borderLeft").toInt();
|
|
|
|
right = m_item->property("borderRight").toInt();
|
|
|
|
top = m_item->property("borderTop").toInt();
|
|
|
|
bottom = m_item->property("borderBottom").toInt();
|
2012-01-07 16:25:21 +00:00
|
|
|
}
|
2010-01-29 12:37:42 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::padding(int &left, int &right, int &top, int &bottom) const
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2012-01-11 20:14:29 +00:00
|
|
|
if (!m_item) {
|
2012-01-09 22:07:22 +00:00
|
|
|
left = right = top = bottom = 0;
|
|
|
|
return;
|
|
|
|
}
|
2012-01-11 20:14:29 +00:00
|
|
|
left = m_item->property("paddingLeft").toInt();
|
|
|
|
right = m_item->property("paddingRight").toInt();
|
|
|
|
top = m_item->property("paddingTop").toInt();
|
|
|
|
bottom = m_item->property("paddingBottom").toInt();
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
QSize AuroraeClient::minimumSize() const
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
return widget()->minimumSize();
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
KDecorationDefines::Position AuroraeClient::mousePosition(const QPoint &point) const
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
// based on the code from deKorator
|
|
|
|
int pos = PositionCenter;
|
|
|
|
if (isShade()) {
|
|
|
|
return Position(pos);
|
2009-10-31 17:06:31 +00:00
|
|
|
}
|
2009-06-19 09:18:07 +00:00
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
int borderLeft, borderTop, borderRight, borderBottom;
|
|
|
|
borders(borderLeft, borderRight, borderTop, borderBottom);
|
|
|
|
int paddingLeft, paddingTop, paddingRight, paddingBottom;
|
|
|
|
padding(paddingLeft, paddingRight, paddingTop, paddingBottom);
|
2010-04-27 17:50:13 +00:00
|
|
|
const bool maximized = maximizeMode() == MaximizeFull && !options()->moveResizeMaximizedWindows();
|
|
|
|
int titleEdgeLeft, titleEdgeRight, titleEdgeTop, titleEdgeBottom;
|
|
|
|
AuroraeFactory::instance()->theme()->titleEdges(titleEdgeLeft, titleEdgeTop, titleEdgeRight, titleEdgeBottom, maximized);
|
|
|
|
switch (AuroraeFactory::instance()->theme()->decorationPosition()) {
|
|
|
|
case DecorationTop:
|
|
|
|
borderTop = titleEdgeTop;
|
|
|
|
break;
|
|
|
|
case DecorationLeft:
|
|
|
|
borderLeft = titleEdgeLeft;
|
|
|
|
break;
|
|
|
|
case DecorationRight:
|
|
|
|
borderRight = titleEdgeRight;
|
|
|
|
break;
|
|
|
|
case DecorationBottom:
|
|
|
|
borderBottom = titleEdgeBottom;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break; // nothing
|
|
|
|
}
|
2010-04-24 07:45:42 +00:00
|
|
|
if (point.x() >= (m_view->width() - borderRight - paddingRight)) {
|
2010-04-12 19:28:58 +00:00
|
|
|
pos |= PositionRight;
|
|
|
|
} else if (point.x() <= borderLeft + paddingLeft) {
|
|
|
|
pos |= PositionLeft;
|
|
|
|
}
|
2009-06-19 09:18:07 +00:00
|
|
|
|
2010-04-24 07:45:42 +00:00
|
|
|
if (point.y() >= m_view->height() - borderBottom - paddingBottom) {
|
2010-04-12 19:28:58 +00:00
|
|
|
pos |= PositionBottom;
|
2010-04-27 17:50:13 +00:00
|
|
|
} else if (point.y() <= borderTop + paddingTop ) {
|
2010-04-12 19:28:58 +00:00
|
|
|
pos |= PositionTop;
|
|
|
|
}
|
2009-06-19 09:18:07 +00:00
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
return Position(pos);
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::reset(long unsigned int changed)
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
KDecoration::reset(changed);
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::menuClicked()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
showWindowMenu(QCursor::pos());
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::toggleShade()
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
setShade(!isShade());
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::toggleKeepAbove()
|
2009-11-01 12:12:30 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
setKeepAbove(!keepAbove());
|
2009-11-01 12:12:30 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::toggleKeepBelow()
|
2009-11-01 12:12:30 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
setKeepBelow(!keepBelow());
|
2009-06-19 09:18:07 +00:00
|
|
|
}
|
|
|
|
|
2012-01-08 10:36:04 +00:00
|
|
|
bool AuroraeClient::isMaximized() const
|
|
|
|
{
|
|
|
|
return maximizeMode()==KDecorationDefines::MaximizeFull && !options()->moveResizeMaximizedWindows();
|
|
|
|
}
|
|
|
|
|
2012-01-07 16:05:22 +00:00
|
|
|
void AuroraeClient::titlePressed(int button, int buttons)
|
|
|
|
{
|
|
|
|
titlePressed(static_cast<Qt::MouseButton>(button), static_cast<Qt::MouseButtons>(buttons));
|
|
|
|
}
|
|
|
|
|
|
|
|
void AuroraeClient::titleReleased(int button, int buttons)
|
|
|
|
{
|
|
|
|
titleReleased(static_cast<Qt::MouseButton>(button), static_cast<Qt::MouseButtons>(buttons));
|
|
|
|
}
|
|
|
|
|
|
|
|
void AuroraeClient::titleMouseMoved(int button, int buttons)
|
|
|
|
{
|
|
|
|
titleMouseMoved(static_cast<Qt::MouseButton>(button), static_cast<Qt::MouseButtons>(buttons));
|
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::titlePressed(Qt::MouseButton button, Qt::MouseButtons buttons)
|
2010-01-29 12:37:42 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, widget()->mapFromGlobal(QCursor::pos()),
|
|
|
|
QCursor::pos(), button, buttons, Qt::NoModifier);
|
|
|
|
processMousePressEvent(event);
|
|
|
|
delete event;
|
|
|
|
event = 0;
|
2010-01-29 12:37:42 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::titleReleased(Qt::MouseButton button, Qt::MouseButtons buttons)
|
2010-01-29 12:37:42 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonRelease, widget()->mapFromGlobal(QCursor::pos()),
|
|
|
|
QCursor::pos(), button, buttons, Qt::NoModifier);
|
|
|
|
QApplication::sendEvent(widget(), event);
|
|
|
|
delete event;
|
|
|
|
event = 0;
|
2010-01-29 12:37:42 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
void AuroraeClient::titleMouseMoved(Qt::MouseButton button, Qt::MouseButtons buttons)
|
2010-01-29 12:37:42 +00:00
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
QMouseEvent *event = new QMouseEvent(QEvent::MouseMove, widget()->mapFromGlobal(QCursor::pos()),
|
|
|
|
QCursor::pos(), button, buttons, Qt::NoModifier);
|
|
|
|
QApplication::sendEvent(widget(), event);
|
|
|
|
delete event;
|
|
|
|
event = 0;
|
2010-01-29 12:37:42 +00:00
|
|
|
}
|
|
|
|
|
2012-01-11 20:14:29 +00:00
|
|
|
void AuroraeClient::themeChanged()
|
|
|
|
{
|
|
|
|
m_scene->clear();
|
|
|
|
m_item = AuroraeFactory::instance()->createQmlDecoration(this);
|
|
|
|
if (m_item) {
|
2012-01-12 19:31:25 +00:00
|
|
|
m_item->setWidth(m_scene->sceneRect().width());
|
|
|
|
m_item->setHeight(m_scene->sceneRect().height());
|
2012-01-11 20:14:29 +00:00
|
|
|
}
|
|
|
|
m_scene->addItem(m_item);
|
|
|
|
}
|
|
|
|
|
2009-06-19 09:18:07 +00:00
|
|
|
} // namespace Aurorae
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
KDE_EXPORT KDecorationFactory *create_factory() {
|
|
|
|
return Aurorae::AuroraeFactory::instance();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "aurorae.moc"
|