Fix translucency support.

CCBUG:332408
This commit is contained in:
Eike Hein
2014-05-26 14:00:24 +02:00
parent 57a5f23f1b
commit c4f7f512f3
4 changed files with 20 additions and 20 deletions

View File

@@ -56,23 +56,12 @@
#include "SessionManager.h"
#include "ProfileManager.h"
#include "KonsoleSettings.h"
#include "WindowSystemInfo.h"
#include "settings/GeneralSettings.h"
#include "settings/TabBarSettings.h"
using namespace Konsole;
/* Normally it would be enough to just have this determined via the window
manager. But there exist GPU drivers (NVIDIA) that have serious performance
issues if transparency is enabled inside Konsole. The rest of the system
works fine. NVIDIA users might want to use --notransparency to work
around such issues. */
static bool useTransparency()
{
const KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
const bool compositingAvailable = false; // bko 332408 KWindowSystem::compositingActive();
return compositingAvailable && args->isSet("transparency");
}
MainWindow::MainWindow()
: KXmlGuiWindow()
, _bookmarkHandler(0)
@@ -97,12 +86,9 @@ MainWindow::MainWindow()
}
}
if (useTransparency()) {
// It is useful 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);
}
connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), this, SLOT(updateUseTransparency()));
updateUseTransparency();
// create actions for menus
setupActions();
@@ -151,6 +137,18 @@ MainWindow::MainWindow()
connect(KonsoleSettings::self(), &Konsole::KonsoleSettings::configChanged, this, &Konsole::MainWindow::applyKonsoleSettings);
}
void MainWindow::updateUseTransparency()
{
const KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
bool useTranslucency = KWindowSystem::compositingActive() && args->isSet("transparency");
setAttribute(Qt::WA_TranslucentBackground, useTranslucency);
setAttribute(Qt::WA_NoSystemBackground, false);
WindowSystemInfo::HAVE_TRANSPARENCY = useTranslucency;
}
void MainWindow::rememberMenuAccelerators()
{
foreach(QAction* menuItem, menuBar()->actions()) {