2007-04-29 17:35:43 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
*
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "preview.h"
|
|
|
|
|
|
|
|
#include <kapplication.h>
|
|
|
|
#include <klocale.h>
|
|
|
|
#include <kconfig.h>
|
|
|
|
#include <kglobal.h>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QStyle>
|
2009-08-25 11:13:27 +00:00
|
|
|
#include <QPainter>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QVector>
|
2007-09-01 19:45:04 +00:00
|
|
|
#include <kicon.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <kdecorationfactory.h>
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KDecorationPreview::KDecorationPreview(QWidget* parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
options = new KDecorationPreviewOptions;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bridge[Active] = new KDecorationPreviewBridge(this, true);
|
|
|
|
bridge[Inactive] = new KDecorationPreviewBridge(this, false);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
deco[Active] = deco[Inactive] = NULL;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
setMinimumSize(100, 100);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
KDecorationPreview::~KDecorationPreview()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
for (int i = 0; i < NumWindows; i++) {
|
2007-04-29 17:35:43 +00:00
|
|
|
delete deco[i];
|
|
|
|
delete bridge[i];
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
delete options;
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bool KDecorationPreview::recreateDecoration(KDecorationPlugins* plugins)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < NumWindows; i++) {
|
2007-04-29 17:35:43 +00:00
|
|
|
delete deco[i]; // deletes also window
|
2011-01-30 14:34:42 +00:00
|
|
|
deco[i] = plugins->createDecoration(bridge[i]);
|
2007-04-29 17:35:43 +00:00
|
|
|
deco[i]->init();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-02-04 16:30:24 +00:00
|
|
|
m_activeMask = QRegion();
|
|
|
|
m_inactiveMask = QRegion();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (deco[Active] == NULL || deco[Inactive] == NULL) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreview::disablePreview()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
delete deco[Active];
|
|
|
|
delete deco[Inactive];
|
|
|
|
deco[Active] = deco[Inactive] = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-07-25 07:58:27 +00:00
|
|
|
KDecorationFactory *KDecorationPreview::factory() const
|
|
|
|
{
|
|
|
|
return deco[Active] ? deco[Active]->factory() : 0;
|
|
|
|
}
|
|
|
|
|
2013-02-04 16:30:24 +00:00
|
|
|
QPixmap KDecorationPreview::preview()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
QPixmap pixmap(size());
|
|
|
|
pixmap.fill(Qt::transparent);
|
2013-02-04 16:30:24 +00:00
|
|
|
if (!deco[Active] || !deco[Inactive])
|
|
|
|
return pixmap;
|
2010-01-19 13:44:22 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
int titleBarHeight, leftBorder, rightBorder, xoffset,
|
|
|
|
dummy1, dummy2, dummy3;
|
|
|
|
// don't have more than one reference to the same dummy variable in one borders() call.
|
2011-01-30 14:34:42 +00:00
|
|
|
deco[Active]->borders(dummy1, dummy2, titleBarHeight, dummy3);
|
|
|
|
deco[Inactive]->borders(leftBorder, rightBorder, dummy1, dummy2);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
titleBarHeight = qMin(int(titleBarHeight * .9), 30);
|
|
|
|
xoffset = qMin(qMax(10, QApplication::isRightToLeft()
|
|
|
|
? leftBorder : rightBorder), 30);
|
2013-02-04 16:30:24 +00:00
|
|
|
QPainter p;
|
|
|
|
p.begin(&pixmap);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-02-04 16:30:24 +00:00
|
|
|
const QSize size(width() - xoffset - 20, height() - titleBarHeight - 20);
|
|
|
|
render(&p, deco[Inactive], size, QPoint(10 + xoffset, 10), m_inactiveMask);
|
|
|
|
render(&p, deco[Active], size, QPoint(10, 10 + titleBarHeight), m_activeMask);
|
|
|
|
p.end();
|
|
|
|
return pixmap;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-02-04 16:30:24 +00:00
|
|
|
void KDecorationPreview::render(QPainter *painter, KDecoration *decoration, const QSize &recommendedSize, const QPoint &offset, const QRegion &mask) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-04 16:30:24 +00:00
|
|
|
QWidget *w = decoration->widget();
|
|
|
|
QSize size = QSize(recommendedSize)
|
|
|
|
.expandedTo(decoration->minimumSize());
|
|
|
|
int padLeft, padRight, padTop, padBottom;
|
|
|
|
padLeft = padRight = padTop = padBottom = 0;
|
|
|
|
bool useMask = true;
|
|
|
|
if (KDecorationUnstable *unstable = qobject_cast<KDecorationUnstable *>(decoration)) {
|
|
|
|
unstable->padding(padLeft, padRight, padTop, padBottom);
|
|
|
|
size.setWidth(size.width() + padLeft + padRight);
|
|
|
|
size.setHeight(size.height() + padTop + padBottom);
|
|
|
|
if (padLeft || padRight || padTop || padBottom) {
|
|
|
|
useMask = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
decoration->resize(size);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-02-04 16:30:24 +00:00
|
|
|
// why an if-else block instead of (useMask ? mask : QRegion())?
|
|
|
|
// For what reason ever it completely breaks if the mask is copied.
|
|
|
|
if (useMask) {
|
|
|
|
w->render(painter, offset + QPoint(-padLeft, - padTop), mask,
|
|
|
|
QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask);
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2013-02-04 16:30:24 +00:00
|
|
|
w->render(painter, offset + QPoint(-padLeft, - padTop), QRegion(),
|
|
|
|
QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect KDecorationPreview::windowGeometry(bool active) const
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
QWidget *widget = active ? deco[Active]->widget() : deco[Inactive]->widget();
|
|
|
|
return widget->geometry();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreview::setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
options->setCustomBorderSize(size);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (plugin->factory()->reset(KDecorationDefines::SettingBorder)) {
|
2007-04-29 17:35:43 +00:00
|
|
|
// can't handle the change, recreate decorations then
|
|
|
|
recreateDecoration(plugin);
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreview::setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const QString &left, const QString &right)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
options->setCustomTitleButtonsEnabled(customEnabled);
|
|
|
|
options->setCustomTitleButtons(left, right);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (plugin->factory()->reset(KDecorationDefines::SettingButtons)) {
|
2007-04-29 17:35:43 +00:00
|
|
|
// can't handle the change, recreate decorations then
|
|
|
|
recreateDecoration(plugin);
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QRegion KDecorationPreview::unobscuredRegion(bool active, const QRegion& r) const
|
|
|
|
{
|
2013-02-04 16:30:24 +00:00
|
|
|
Q_UNUSED(active)
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationPreview::setMask(const QRegion ®ion, bool active)
|
|
|
|
{
|
|
|
|
if (active) {
|
|
|
|
m_activeMask = region;
|
|
|
|
} else {
|
|
|
|
m_inactiveMask = region;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KDecorationPreviewBridge::KDecorationPreviewBridge(KDecorationPreview* p, bool a)
|
|
|
|
: preview(p), active(a)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QWidget* KDecorationPreviewBridge::initialParentWidget() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return preview;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
Qt::WFlags KDecorationPreviewBridge::initialWFlags() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isActive() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return active;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isCloseable() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isMaximizable() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
KDecoration::MaximizeMode KDecorationPreviewBridge::maximizeMode() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return KDecoration::MaximizeRestore;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isMinimizable() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::providesContextHelp() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
int KDecorationPreviewBridge::desktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return 1;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isModal() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isShadeable() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isShade() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isSetShade() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::keepAbove() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::keepBelow() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isMovable() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isResizable() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
NET::WindowType KDecorationPreviewBridge::windowType(unsigned long) const
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return NET::Normal;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QIcon KDecorationPreviewBridge::icon() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
return KIcon("xorg");
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QString KDecorationPreviewBridge::caption() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
return active ? i18n("Active Window") : i18n("Inactive Window");
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::processMousePressEvent(QMouseEvent*)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::showWindowMenu(const QRect &)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::showWindowMenu(const QPoint &)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-11-09 12:44:50 +00:00
|
|
|
void KDecorationPreviewBridge::showApplicationMenu(const QPoint &)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::menuAvailable() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::performWindowOperation(WindowOperation)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::setMask(const QRegion& reg, int mode)
|
|
|
|
{
|
2013-02-04 16:30:24 +00:00
|
|
|
Q_UNUSED(mode)
|
|
|
|
preview->setMask(reg, active);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
bool KDecorationPreviewBridge::isPreview() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QRect KDecorationPreviewBridge::geometry() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
return preview->windowGeometry(active);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QRect KDecorationPreviewBridge::iconGeometry() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return QRect();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QRegion KDecorationPreviewBridge::unobscuredRegion(const QRegion& r) const
|
|
|
|
{
|
|
|
|
return preview->unobscuredRegion(active, r);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
WId KDecorationPreviewBridge::windowId() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return 0; // no decorated window
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreviewBridge::closeWindow()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::maximize(MaximizeMode)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreviewBridge::minimize()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreviewBridge::showContextHelp()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::setDesktop(int)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreviewBridge::titlebarDblClickOperation()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::titlebarMouseWheelOperation(int)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::setShade(bool)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::setKeepAbove(bool)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::setKeepBelow(bool)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
int KDecorationPreviewBridge::currentDesktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return 1;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void KDecorationPreviewBridge::grabXServer(bool)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-10-17 10:30:43 +00:00
|
|
|
bool KDecorationPreviewBridge::compositingActive() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-04 16:30:24 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-10-17 10:30:43 +00:00
|
|
|
|
2009-11-25 23:32:35 +00:00
|
|
|
QRect KDecorationPreviewBridge::transparentRect() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-11-25 23:32:35 +00:00
|
|
|
return QRect();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-25 23:32:35 +00:00
|
|
|
|
2009-11-15 03:24:04 +00:00
|
|
|
// Window tabbing
|
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
int KDecorationPreviewBridge::tabCount() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-01-12 06:42:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString KDecorationPreviewBridge::caption(int) const
|
|
|
|
{
|
|
|
|
return active ? "Active Window" : "Inactive Window";
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
QIcon KDecorationPreviewBridge::icon(int) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-01-12 06:42:55 +00:00
|
|
|
return icon();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
long KDecorationPreviewBridge::tabId(int) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-11-15 03:24:04 +00:00
|
|
|
return 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
long KDecorationPreviewBridge::currentTabId() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-11-15 03:24:04 +00:00
|
|
|
return 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void KDecorationPreviewBridge::setCurrentTab(long)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void KDecorationPreviewBridge::tab_A_before_B(long, long)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void KDecorationPreviewBridge::tab_A_behind_B(long, long)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void KDecorationPreviewBridge::untab(long, const QRect&)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void KDecorationPreviewBridge::closeTab(long)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void KDecorationPreviewBridge::closeTabGroup()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void KDecorationPreviewBridge::showWindowMenu(const QPoint &, long)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KDecoration::WindowOperation KDecorationPreviewBridge::buttonToWindowOperation(Qt::MouseButtons)
|
|
|
|
{
|
2009-11-17 07:17:49 +00:00
|
|
|
return KDecoration::NoOp;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
KDecorationPreviewOptions::KDecorationPreviewOptions()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
customBorderSize = BordersCount; // invalid
|
|
|
|
customButtonsChanged = false; // invalid
|
|
|
|
customButtons = true;
|
|
|
|
customTitleButtonsLeft.clear(); // invalid
|
|
|
|
customTitleButtonsRight.clear(); // invalid
|
|
|
|
updateSettings();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
KDecorationPreviewOptions::~KDecorationPreviewOptions()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
unsigned long KDecorationPreviewOptions::updateSettings()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
KConfig cfg("kwinrc");
|
2007-04-29 17:35:43 +00:00
|
|
|
unsigned long changed = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
changed |= KDecorationOptions::updateSettings(&cfg);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// set custom border size/buttons
|
|
|
|
if (customBorderSize != BordersCount)
|
2011-01-30 14:34:42 +00:00
|
|
|
setBorderSize(customBorderSize);
|
2007-04-29 17:35:43 +00:00
|
|
|
if (customButtonsChanged)
|
2011-01-30 14:34:42 +00:00
|
|
|
setCustomButtonPositions(customButtons);
|
2007-04-29 17:35:43 +00:00
|
|
|
if (customButtons) {
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!customTitleButtonsLeft.isNull())
|
|
|
|
setTitleButtonsLeft(customTitleButtonsLeft);
|
|
|
|
if (!customTitleButtonsRight.isNull())
|
|
|
|
setTitleButtonsRight(customTitleButtonsRight);
|
2007-04-29 17:35:43 +00:00
|
|
|
} else {
|
2011-01-30 14:34:42 +00:00
|
|
|
setTitleButtonsLeft(KDecorationOptions::defaultTitleButtonsLeft());
|
|
|
|
setTitleButtonsRight(KDecorationOptions::defaultTitleButtonsRight());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return changed;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreviewOptions::setCustomBorderSize(BorderSize size)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
customBorderSize = size;
|
|
|
|
|
|
|
|
updateSettings();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void KDecorationPreviewOptions::setCustomTitleButtonsEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
customButtonsChanged = true;
|
|
|
|
customButtons = enabled;
|
|
|
|
|
|
|
|
updateSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void KDecorationPreviewOptions::setCustomTitleButtons(const QString &left, const QString &right)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
customTitleButtonsLeft = left;
|
|
|
|
customTitleButtonsRight = right;
|
|
|
|
|
|
|
|
updateSettings();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bool KDecorationPreviewPlugins::provides(Requirement)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include "preview.moc"
|