summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-13 13:41:31 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-13 18:33:48 (GMT)
commita28902e9120798c67844864a11bbe3f1c2549b74 (patch)
tree99316df8d5feb90432fca6d0b8da9b2065a2a561
parent13684bebe2a421157032bc3cfaf28e468d0c1eef (diff)
Fix transparent backgrounds
It's apparently not possible to set WA_TranslucentBackground after show(). The MainWindow constructor calls applyKonsoleSettings() which calls KMainWindow::setAutoSaveSettings() which in turn calls setVisible(true), which makes any calls to setTransparency() from the Application::newMainWindow() irrelevant, even if updateUseTransparency() is called from it. REVIEW: 128669 BUG: 366368
-rw-r--r--src/Application.cpp4
-rw-r--r--src/MainWindow.cpp15
-rw-r--r--src/MainWindow.h2
3 files changed, 8 insertions, 13 deletions
diff --git a/src/Application.cpp b/src/Application.cpp
index cbd1373..d5dbbd6 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -40,6 +40,7 @@
#include "KonsoleSettings.h"
#include "ViewManager.h"
#include "SessionController.h"
+#include "WindowSystemInfo.h"
using namespace Konsole;
@@ -56,8 +57,9 @@ Application::~Application()
MainWindow* Application::newMainWindow()
{
+ WindowSystemInfo::HAVE_TRANSPARENCY = !m_parser.isSet(QStringLiteral("notransparency"));
+
MainWindow* window = new MainWindow();
- window->setTransparency(!m_parser.isSet(QStringLiteral("notransparency")));
connect(window, &Konsole::MainWindow::newWindowRequest, this, &Konsole::Application::createWindow);
connect(window, &Konsole::MainWindow::viewDetached, this, &Konsole::Application::detachView);
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index cae8a54..9107939 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -64,7 +64,6 @@ MainWindow::MainWindow()
, _pluggedController(0)
, _menuBarInitialVisibility(true)
, _menuBarInitialVisibilityApplied(false)
- , _useTransparency(false)
{
if (!KonsoleSettings::saveGeometryOnExit()) {
// If we are not using the global Konsole save geometry on exit,
@@ -83,8 +82,6 @@ MainWindow::MainWindow()
}
}
- connect(KWindowSystem::self(), &KWindowSystem::compositingChanged, this, &MainWindow::updateUseTransparency);
-
updateUseTransparency();
// create actions for menus
@@ -129,11 +126,14 @@ MainWindow::MainWindow()
void MainWindow::updateUseTransparency()
{
- bool useTranslucency = KWindowSystem::compositingActive() && _useTransparency;
+ if (!WindowSystemInfo::HAVE_TRANSPARENCY) {
+ return;
+ }
+
+ bool useTranslucency = KWindowSystem::compositingActive();
setAttribute(Qt::WA_TranslucentBackground, useTranslucency);
setAttribute(Qt::WA_NoSystemBackground, false);
-
WindowSystemInfo::HAVE_TRANSPARENCY = useTranslucency;
}
@@ -765,11 +765,6 @@ void MainWindow::setShowQuickButtons(bool show)
_viewManager->setShowQuickButtons(show);
}
-void MainWindow::setTransparency(bool useTransparency)
-{
- _useTransparency = useTransparency;
-}
-
void MainWindow::activateMenuBar()
{
const QList<QAction*> menuActions = menuBar()->actions();
diff --git a/src/MainWindow.h b/src/MainWindow.h
index 978bd93..500b395 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -109,7 +109,6 @@ public:
void setNavigationStyleSheetFromFile(const QUrl& stylesheetfile);
void setNavigationBehavior(int behavior);
void setShowQuickButtons(bool show);
- void setTransparency(bool useTransparency);
signals:
@@ -211,7 +210,6 @@ private:
bool _menuBarInitialVisibility;
bool _menuBarInitialVisibilityApplied;
- bool _useTransparency;
};
}