From 927848c580b3319a56ebc3ea230239e79f82e8a0 Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Fri, 11 May 2012 22:14:49 +0800 Subject: [PATCH] Make sure the translucent background is available whenever possible Now the Qt::WA_TranslucentBackground attribute is always set for the mainwindow of konsole(regardless of whether compositing is available when the window is created), just like in konsolepart. I'm not 100% sure this approach is problem-free, but it works for me so far under various environments and conditions. Do not hesihate to revert it if you notice it causes big trouble. --- src/MainWindow.cpp | 15 ++++----------- src/TerminalDisplay.cpp | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 4a528d3a..766a4b54 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -58,23 +58,16 @@ using namespace Konsole; -static bool useTransparency() -{ - return KWindowSystem::compositingActive(); -} - MainWindow::MainWindow() : KXmlGuiWindow() , _bookmarkHandler(0) , _pluggedController(0) , _menuBarInitialVisibilityApplied(false) { - if (useTransparency()) { - // It is userful to have translucent terminal area - setAttribute(Qt::WA_TranslucentBackground, true); - // But it is mostly annoying to have translucent menubar and tabbar - setAttribute(Qt::WA_NoSystemBackground, false); - } + // It is userful to have translucent terminal area + setAttribute(Qt::WA_TranslucentBackground, true); + // But it is mostly annoying to have translucent menubar and tabbar + setAttribute(Qt::WA_NoSystemBackground, false); // create actions for menus setupActions(); diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 7731ce88..ebf7100c 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -593,7 +593,7 @@ void TerminalDisplay::drawBackground(QPainter& painter, const QRect& rect, const if (useOpacitySetting && !_wallpaper->isNull() && _wallpaper->draw(painter, contentsRect)) { - } else if (WindowSystemInfo::HAVE_TRANSPARENCY && qAlpha(_blendColor) < 0xff && useOpacitySetting) { + } else if (qAlpha(_blendColor) < 0xff && useOpacitySetting) { QColor color(backgroundColor); color.setAlpha(qAlpha(_blendColor));