FYI, I don't know enough about this to know if there are issues with these changes.<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Fredrik Höglund</b> <span dir="ltr"><<a href="mailto:fredrik@kde.org">fredrik@kde.org</a>></span><br>
Date: Tue, Oct 6, 2009 at 6:46 PM<br>Subject: KDE/kdebase/apps/konsole/src<br>To: <a href="mailto:kde-commits@kde.org">kde-commits@kde.org</a><br><br><br>SVN commit 1032123 by fredrik:<br>
<br>
Get rid of the ARGB visual hack, and use Qt::WA_TranslucentBackground instead.<br>
<br>
<br>
M +0 -8 Application.cpp<br>
M +0 -5 Application.h<br>
M +15 -0 MainWindow.cpp<br>
M +5 -79 main.cpp<br>
<br>
<br>
--- trunk/KDE/kdebase/apps/konsole/src/Application.cpp #1032122:1032123<br>
@@ -48,14 +48,6 @@<br>
<br>
using namespace Konsole;<br>
<br>
-#ifdef Q_WS_X11<br>
-Application::Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colormap)<br>
- : KUniqueApplication(display,visual,colormap)<br>
-{<br>
- init();<br>
-}<br>
-#endif<br>
-<br>
Application::Application() : KUniqueApplication()<br>
{<br>
init();<br>
--- trunk/KDE/kdebase/apps/konsole/src/Application.h #1032122:1032123<br>
@@ -52,11 +52,6 @@<br>
<br>
public:<br>
/** Constructs a new Konsole application. */<br>
-#ifdef Q_WS_X11<br>
- Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colormap);<br>
-#endif<br>
-<br>
- /** Constructs a new Konsole application. */<br>
Application();<br>
<br>
virtual ~Application();<br>
--- trunk/KDE/kdebase/apps/konsole/src/MainWindow.cpp #1032122:1032123<br>
@@ -30,6 +30,7 @@<br>
#include <KActionCollection><br>
#include <KActionMenu><br>
#include <KApplication><br>
+#include <KCmdLineArgs><br>
#include <KShortcutsDialog><br>
#include <KLocale><br>
#include <KMenu><br>
@@ -41,6 +42,7 @@<br>
#include <KToolInvocation><br>
#include <KStandardAction><br>
#include <KStandardGuiItem><br>
+#include <KWindowSystem><br>
#include <KXMLGUIFactory><br>
#include <KNotifyConfigWidget><br>
<br>
@@ -57,12 +59,25 @@<br>
<br>
using namespace Konsole;<br>
<br>
+static bool useTransparency()<br>
+{<br>
+ KCmdLineArgs* args = KCmdLineArgs::parsedArgs();<br>
+ bool compositingAvailable = KWindowSystem::compositingActive() ||<br>
+ args->isSet("force-transparency");<br>
+ return compositingAvailable && args->isSet("transparency");<br>
+}<br>
+<br>
MainWindow::MainWindow()<br>
: KXmlGuiWindow() ,<br>
_bookmarkHandler(0),<br>
_pluggedController(0),<br>
_menuBarVisibilitySet(false)<br>
{<br>
+ if (useTransparency()) {<br>
+ setAttribute(Qt::WA_TranslucentBackground);<br>
+ setAttribute(Qt::WA_NoSystemBackground, false);<br>
+ }<br>
+<br>
// create actions for menus<br>
setupActions();<br>
<br>
--- trunk/KDE/kdebase/apps/konsole/src/main.cpp #1032122:1032123<br>
@@ -25,31 +25,19 @@<br>
// Unix<br>
#include <unistd.h><br>
<br>
-// X11<br>
-#ifdef Q_WS_X11<br>
-#include <X11/Xlib.h><br>
-#include <X11/extensions/Xrender.h><br>
-#endif<br>
-<br>
// KDE<br>
#include <KAboutData><br>
#include <KCmdLineArgs><br>
#include <KLocale><br>
-#include <KWindowSystem><br>
<br>
#define KONSOLE_VERSION "2.4"<br>
<br>
using namespace Konsole;<br>
<br>
-#ifdef Q_WS_X11<br>
-void getDisplayInformation(Display*& display , Visual*& visual , Colormap& colormap);<br>
-#endif<br>
-<br>
// fills the KAboutData structure with information about contributors to<br>
// Konsole<br>
void fillAboutData(KAboutData& aboutData);<br>
void fillCommandLineOptions(KCmdLineOptions& options);<br>
-bool useTransparency(); // returns true if transparency should be enabled<br>
bool forceNewProcess(); // returns true if new instance should use a new<br>
// process (instead of re-using an existing one)<br>
void restoreSession(Application& app);<br>
@@ -83,26 +71,10 @@<br>
{<br>
exit(0);<br>
}<br>
-#ifdef Q_WS_X11<br>
- if ( useTransparency() )<br>
- {<br>
- Display* display = 0;<br>
- Visual* visual = 0;<br>
- Colormap colormap = 0;<br>
-<br>
- getDisplayInformation(display,visual,colormap);<br>
-<br>
- Application app(display,(Qt::HANDLE)visual,(Qt::HANDLE)colormap);<br>
- restoreSession(app);<br>
- return app.exec();<br>
- }<br>
- else<br>
-#endif<br>
- {<br>
- Application app;<br>
- restoreSession(app);<br>
- return app.exec();<br>
- }<br>
+<br>
+ Application app;<br>
+ restoreSession(app);<br>
+ return app.exec();<br>
}<br>
bool forceNewProcess()<br>
{<br>
@@ -113,13 +85,7 @@<br>
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();<br>
return isatty(1) && !args->isSet("new-tab");<br>
}<br>
-bool useTransparency()<br>
-{<br>
- KCmdLineArgs* args = KCmdLineArgs::parsedArgs();<br>
- bool compositingAvailable = KWindowSystem::compositingActive() ||<br>
- args->isSet("force-transparency");<br>
- return compositingAvailable && args->isSet("transparency");<br>
-}<br>
+<br>
void fillCommandLineOptions(KCmdLineOptions& options)<br>
{<br>
options.add("profile <file>", ki18n("Name of profile to use for new Konsole instance"));<br>
@@ -209,46 +175,6 @@<br>
aboutData.setProgramIconName("utilities-terminal");<br>
}<br>
<br>
-// code taken from the Qt 4 graphics dojo examples<br>
-// at <a href="http://labs.trolltech.com" target="_blank">http://labs.trolltech.com</a><br>
-#ifdef Q_WS_X11<br>
-void getDisplayInformation(Display*& display , Visual*& visual , Colormap& colormap)<br>
-{<br>
- display = XOpenDisplay(0); // open default display<br>
- if (!display) {<br>
- kWarning("Cannot connect to the X server");<br>
- exit(1);<br>
- }<br>
-<br>
- int screen = DefaultScreen(display);<br>
- int eventBase, errorBase;<br>
-<br>
- if (XRenderQueryExtension(display, &eventBase, &errorBase)) {<br>
- int nvi;<br>
- XVisualInfo templ;<br>
- templ.screen = screen;<br>
- templ.depth = 32;<br>
- templ.c_class = TrueColor;<br>
- XVisualInfo *xvi = XGetVisualInfo(display, VisualScreenMask |<br>
- VisualDepthMask |<br>
- VisualClassMask, &templ, &nvi);<br>
-<br>
- for (int i = 0; i < nvi; ++i) {<br>
- XRenderPictFormat* format = XRenderFindVisualFormat(display,<br>
- xvi[i].visual);<br>
- if (format->type == PictTypeDirect && format->direct.alphaMask) {<br>
- visual = xvi[i].visual;<br>
- colormap = XCreateColormap(display, RootWindow(display, screen),<br>
- visual, AllocNone);<br>
-<br>
- // found ARGB visual<br>
- break;<br>
- }<br>
- }<br>
- }<br>
-}<br>
-#endif<br>
-<br>
void restoreSession(Application& app)<br>
{<br>
if (app.isSessionRestored())<br>
</div><br>