Commit ef62a000 authored by Jekyll Wu's avatar Jekyll Wu
Browse files

Move TerminalDisplay::HAVE_TRANSPARNCEY into its own dedicated class

TerminalDisplay.h is a big header. It is not good for several files to
include that big header only in order to use one of its static member.
parent ff88a65c
......@@ -40,7 +40,7 @@
#include "SessionManager.h"
#include "MainWindow.h"
#include "Session.h"
#include "TerminalDisplay.h"
#include "WindowSystemInfo.h"
#include "ViewManager.h"
using namespace Konsole;
......@@ -55,7 +55,7 @@ void Application::init()
_backgroundInstance = 0;
// check for compositing functionality
TerminalDisplay::HAVE_TRANSPARENCY = KWindowSystem::compositingActive();
WindowSystemInfo::HAVE_TRANSPARENCY = KWindowSystem::compositingActive();
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040600
// this ensures that Ctrl and Meta are not swapped, so CTRL-C and friends
......
......@@ -111,6 +111,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/tests/CTestCustom.cmake)
XKB.cpp
ZModemDialog.cpp
konsole_wcwidth.cpp
WindowSystemInfo.cpp
${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Konsole.xml
${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Session.xml
)
......
......@@ -53,10 +53,7 @@
#include "SessionManager.h"
#include "ShellCommand.h"
#include "TabTitleFormatAction.h"
// FIXME: it feels bad to include a big header file just
// in order to use one of its static members.
#include "TerminalDisplay.h"
#include "WindowSystemInfo.h"
using namespace Konsole;
......@@ -792,7 +789,7 @@ void EditProfileDialog::updateTransparencyWarning()
" which does not appear to be supported on your"
" desktop"));
_ui->transparencyWarningWidget->setHidden(false);
} else if (! TerminalDisplay::HAVE_TRANSPARENCY) {
} else if (! WindowSystemInfo::HAVE_TRANSPARENCY) {
_ui->transparencyWarningWidget->setText(i18n("Konsole was started before desktop effects were enabled."
" You need to restart Konsole to see transparent background."));
_ui->transparencyWarningWidget->setHidden(false);
......
......@@ -41,6 +41,7 @@
#include "SessionController.h"
#include "SessionManager.h"
#include "TerminalDisplay.h"
#include "WindowSystemInfo.h"
#include "ViewManager.h"
using namespace Konsole;
......@@ -81,7 +82,7 @@ Part::Part(QWidget* parentWidget , QObject* parent, const QVariantList&)
// Enable translucency support.
_viewManager->widget()->setAttribute(Qt::WA_TranslucentBackground, true);
TerminalDisplay::HAVE_TRANSPARENCY = KWindowSystem::compositingActive();
WindowSystemInfo::HAVE_TRANSPARENCY = KWindowSystem::compositingActive();
// create basic session
createSession();
......
......@@ -61,6 +61,7 @@
#include "ScreenWindow.h"
#include "LineFont.h"
#include "SessionController.h"
#include "WindowSystemInfo.h"
using namespace Konsole;
......@@ -91,9 +92,6 @@ const ColorEntry Konsole::base_color_table[TABLE_COLORS] = {
ColorEntry(QColor(0x54, 0xFF, 0xFF), 0), ColorEntry(QColor(0xFF, 0xFF, 0xFF), 0)
};
// static
bool TerminalDisplay::HAVE_TRANSPARENCY = false;
// we use this to force QPainter to display text in LTR mode
// more information can be found in: http://unicode.org/reports/tr9/
const QChar LTR_OVERRIDE_CHAR(0x202D);
......@@ -577,7 +575,7 @@ void TerminalDisplay::drawBackground(QPainter& painter, const QRect& rect, const
if (useOpacitySetting && !_wallpaper->isNull() &&
_wallpaper->draw(painter, contentsRect)) {
} else if (HAVE_TRANSPARENCY && qAlpha(_blendColor) < 0xff && useOpacitySetting) {
} else if (WindowSystemInfo::HAVE_TRANSPARENCY && qAlpha(_blendColor) < 0xff && useOpacitySetting) {
QColor color(backgroundColor);
color.setAlpha(qAlpha(_blendColor));
......
......@@ -465,8 +465,6 @@ public:
static void setXSelection(const QString& text);
static bool HAVE_TRANSPARENCY;
public slots:
/**
* Scrolls current ScreenWindow
......
/*
Copyright 2012 Jekyll Wu <adaptee@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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor appro-
ved by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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/.
*/
// Own
#include "WindowSystemInfo.h"
using Konsole::WindowSystemInfo;
bool WindowSystemInfo::HAVE_TRANSPARENCY = false;
/*
Copyright 2012 Jekyll Wu <adaptee@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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor appro-
ved by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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/.
*/
#ifndef WINDOWSYSTEMINFO_H
#define WINDOWSYSTEMINFO_H
#include "konsole_export.h"
namespace Konsole
{
class KONSOLEPRIVATE_EXPORT WindowSystemInfo
{
public:
static bool HAVE_TRANSPARENCY;
};
}
#endif // WINDOWSYSTEMINFO_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment