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.
wilder-portage
Jekyll Wu 14 years ago
parent 66b4a96e93
commit 927848c580
  1. 15
      src/MainWindow.cpp
  2. 2
      src/TerminalDisplay.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();

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

Loading…
Cancel
Save