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
(cherry picked from commit a28902e912)
wilder-portage
Martin T. H. Sandsmark 10 years ago committed by Kurt Hindenburg
parent f028f17bee
commit fca305ebff
  1. 4
      src/Application.cpp
  2. 15
      src/MainWindow.cpp
  3. 2
      src/MainWindow.h

@ -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;
};
}

Loading…
Cancel
Save