Add support for XComposite translucency to the Konsole KPart.

The decision to support translucent painting is made at part 
creation depending on whether the hosting application is using 
an ARGB visual and a composition manager has claimed the re-
levant X selection (via KWindowSystem).


svn path=/trunk/KDE/kdebase/apps/konsole/; revision=758145
wilder-portage
Eike Hein 18 years ago
parent 69c3cbd967
commit 5246e75c2f
  1. 40
      src/Part.cpp
  2. 1
      src/Part.h
  3. 3
      src/TerminalDisplay.h

@ -23,11 +23,13 @@
// Qt
#include <QtCore/QStringList>
// KDE
#include <KAction>
#include <KActionCollection>
#include <KDebug>
#include <KLocale>
#include <KWindowSystem>
#include <kdeversion.h>
// Konsole
@ -39,9 +41,16 @@
#include "Session.h"
#include "SessionController.h"
#include "SessionManager.h"
#include "TerminalDisplay.h"
#include "ViewManager.h"
#include "MainWindow.h"
// X
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
#endif
extern "C"
{
// entry point for Konsole part library,
@ -70,6 +79,8 @@ Part::Part(QWidget* parentWidget , QObject* parent)
,_pluggedController(0)
,_manageProfilesAction(0)
{
TerminalDisplay::HAVE_TRANSPARENCY = transparencyAvailable();
// setup global actions
createGlobalActions();
@ -109,6 +120,35 @@ void Part::setupActionsForSession(SessionController* session)
KActionCollection* collection = session->actionCollection();
collection->addAction("manage-profiles",_manageProfilesAction);
}
bool Part::transparencyAvailable()
{
#ifdef Q_WS_X11
bool ARGB = false;
int screen = QX11Info::appScreen();
bool depth = (QX11Info::appDepth() == 32);
Display* display = QX11Info::display();
Visual* visual = static_cast<Visual*>(QX11Info::appVisual(screen));
XRenderPictFormat* format = XRenderFindVisualFormat(display, visual);
if (depth && format->type == PictTypeDirect && format->direct.alphaMask)
{
ARGB = true;
}
if (ARGB)
{
return KWindowSystem::compositingActive();
}
else
#endif
{
return false;
}
}
bool Part::openFile()
{
return false;

@ -119,6 +119,7 @@ private:
Session* activeSession() const;
void setupActionsForSession(SessionController* session);
void createGlobalActions();
bool transparencyAvailable();
private:
ViewManager* _viewManager;

@ -386,6 +386,8 @@ public:
/** Returns the terminal screen section which is displayed in this widget. See setScreenWindow() */
ScreenWindow* screenWindow() const;
static bool HAVE_TRANSPARENCY;
public slots:
/**
@ -728,7 +730,6 @@ private:
};
InputMethodData _inputMethodData;
static bool HAVE_TRANSPARENCY;
static bool _antialiasText; // do we antialias or not
//the delay in milliseconds between redrawing blinking text

Loading…
Cancel
Save