Index: Application.h =================================================================== --- Application.h (revision 738805) +++ Application.h (working copy) @@ -48,12 +48,10 @@ Q_OBJECT public: -#if 0 /** Constructs a new Konsole application. */ #ifdef Q_WS_X11 Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colormap); #endif -#endif /** Constructs a new Konsole application. */ Application(); Index: main.cpp =================================================================== --- main.cpp (revision 738805) +++ main.cpp (working copy) @@ -43,6 +43,48 @@ void fillAboutData(KAboutData& aboutData); void fillCommandLineOptions(KCmdLineOptions& options); +// code taken from the Qt 4 graphics dojo examples +#ifdef Q_WS_X11 +bool getDisplayInformation(Display*& display , Visual*& visual , Colormap& colormap) +{ + display = XOpenDisplay(0); // open default display + if (!display) { + qWarning("Cannot connect to the X server"); + exit(1); + } + + int screen = DefaultScreen(display); + int eventBase, errorBase; + + if (XRenderQueryExtension(display, &eventBase, &errorBase)) { + int nvi; + XVisualInfo templ; + templ.screen = screen; + templ.depth = 32; + templ.c_class = TrueColor; + XVisualInfo *xvi = XGetVisualInfo(display, VisualScreenMask | + VisualDepthMask | + VisualClassMask, &templ, &nvi); + + for (int i = 0; i < nvi; ++i) { + XRenderPictFormat* format = XRenderFindVisualFormat(display, + xvi[i].visual); + if (format->type == PictTypeDirect && format->direct.alphaMask) { + visual = xvi[i].visual; + colormap = XCreateColormap(display, RootWindow(display, screen), + visual, AllocNone); + + // found ARGB visual + return true; + } + } + } + XCloseDisplay(display); + display = 0; + return false; +} +#endif + // *** // // Entry point into the Konsole terminal application. @@ -77,8 +119,16 @@ qDebug() << "Have compositing: " << KWindowSystem::compositingActive(); + Display* display; + Visual* visual; + Colormap colormap; + if (getDisplayInformation(display, visual, colormap)) { + Application app(display, Qt::HANDLE(visual), Qt::HANDLE(colormap)); + setenv("QT_NO_FAST_SCROLL", "1", 1); + return app.exec(); + } Application app; - return app.exec(); + return app.exec(); } void fillCommandLineOptions(KCmdLineOptions& options) @@ -164,45 +214,4 @@ } -#if 0 -// code taken from the Qt 4 graphics dojo examples -#ifdef Q_WS_X11 -void getDisplayInformation(Display*& display , Visual*& visual , Colormap& colormap) -{ - display = XOpenDisplay(0); // open default display - if (!display) { - qWarning("Cannot connect to the X server"); - exit(1); - } - int screen = DefaultScreen(display); - int eventBase, errorBase; - - if (XRenderQueryExtension(display, &eventBase, &errorBase)) { - int nvi; - XVisualInfo templ; - templ.screen = screen; - templ.depth = 32; - templ.c_class = TrueColor; - XVisualInfo *xvi = XGetVisualInfo(display, VisualScreenMask | - VisualDepthMask | - VisualClassMask, &templ, &nvi); - - for (int i = 0; i < nvi; ++i) { - XRenderPictFormat* format = XRenderFindVisualFormat(display, - xvi[i].visual); - if (format->type == PictTypeDirect && format->direct.alphaMask) { - visual = xvi[i].visual; - colormap = XCreateColormap(display, RootWindow(display, screen), - visual, AllocNone); - - // found ARGB visual - break; - } - } - } -} -#endif -#endif - - Index: Application.cpp =================================================================== --- Application.cpp (revision 738805) +++ Application.cpp (working copy) @@ -46,7 +46,6 @@ using namespace Konsole; -#if 0 #ifdef Q_WS_X11 Application::Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colormap) : KUniqueApplication(display,visual,colormap) @@ -54,7 +53,6 @@ init(); } #endif -#endif Application::Application() : KUniqueApplication() {