VirtualBox

Changeset 21480 in vbox


Ignore:
Timestamp:
Jul 10, 2009 1:37:49 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49913
Message:

FE/Qt4: proper fix for ARGB visual bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r21105 r21480  
    3737#ifdef Q_WS_X11
    3838#include <QFontDatabase>
     39#include <iprt/env.h>
    3940#endif
    4041
     
    323324    /* scope the QIApplication variable */
    324325    {
     326#if defined(Q_WS_X11) && (QT_VERSION >= 0x040500)
     327        /* There are some buggy/strange driver/compiz combinations which lead
     328         * to transparent backgrounds on ARGB visuals. Try to fix it by not
     329         * allowing an ARGB visual with the help of the Xlib. After that we
     330         * restore the original environment, so that others like the OpenGL
     331         * service will proper work. */
     332        RTENV env = NIL_RTENV;
     333        char envval[1024];
     334        bool found = false;
     335        int rc = RTEnvClone (&env, RTENV_DEFAULT);
     336        if (RT_SUCCESS (rc))
     337        {
     338            found = RTEnvGetEx (env, "XLIB_SKIP_ARGB_VISUALS", envval, sizeof(envval), NULL) == VINF_SUCCESS;
     339            RTEnvSetEx (env, "XLIB_SKIP_ARGB_VISUALS", "1");
     340        }
     341        /* Now create the application object */
    325342        QIApplication a (argc, argv);
     343        /* Restore previous environment */
     344        if (env != NIL_RTENV)
     345        {
     346            if (found)
     347                RTEnvSetEx (env, "XLIB_SKIP_ARGB_VISUALS", envval);
     348            else
     349                RTEnvUnsetEx (env, "XLIB_SKIP_ARGB_VISUALS");
     350            RTEnvDestroy (env);
     351        }
     352#else /* defined(Q_WS_X11) && (QT_VERSION >= 0x040500) */
     353        QIApplication a (argc, argv);
     354#endif /* defined(Q_WS_X11) && (QT_VERSION >= 0x040500) */
    326355
    327356        /* Qt4.3 version has the QProcess bug which freezing the application
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette