diff --git a/src/Application.cpp b/src/Application.cpp index ccf33c3fc..a28ea656e 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e032a2518..64e06cf1e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 ) diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index 3d8fa0b12..87987d08d 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -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); diff --git a/src/Part.cpp b/src/Part.cpp index 3d8ff055e..135cf9431 100644 --- a/src/Part.cpp +++ b/src/Part.cpp @@ -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(); diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 69263a245..0b7450972 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -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)); diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h index 735499117..53bdcd8d9 100644 --- a/src/TerminalDisplay.h +++ b/src/TerminalDisplay.h @@ -465,8 +465,6 @@ public: static void setXSelection(const QString& text); - static bool HAVE_TRANSPARENCY; - public slots: /** * Scrolls current ScreenWindow diff --git a/src/WindowSystemInfo.cpp b/src/WindowSystemInfo.cpp new file mode 100644 index 000000000..e49772c4e --- /dev/null +++ b/src/WindowSystemInfo.cpp @@ -0,0 +1,28 @@ +/* + Copyright 2012 Jekyll Wu + + 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; + + diff --git a/src/WindowSystemInfo.h b/src/WindowSystemInfo.h new file mode 100644 index 000000000..a3f91e3be --- /dev/null +++ b/src/WindowSystemInfo.h @@ -0,0 +1,39 @@ +/* + Copyright 2012 Jekyll Wu + + 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 +