Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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
parent 13684beb
......@@ -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);
......
......@@ -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();
......
......@@ -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;
};
}
......
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