Details
-
Suggestion
-
Resolution: Out of scope
-
P4: Low
-
4.4.0
-
None
Description
Changing "templ.depth" (variable in the code below) to 16 or 24 works fine.
To reproduce, create an icon called some "someicon.png" and run the following code:
#include <QtGui> #include <X11/extensions/Xrender.h> int main( int argc, char * argv[] ) { Colormap colormap = 0; Visual * visual = 0; int eventBase, errorBase; Display * dpy = XOpenDisplay( 0 ); int screen = DefaultScreen( dpy ); if ( XRenderQueryExtension( dpy, & eventBase, & errorBase) ) { int nvi; XVisualInfo templ; templ.screen = screen; templ.depth = 32; // CHANGE TO 16 OR 24 IN ORDER TO WORK WELL templ.c_class = TrueColor; XVisualInfo * xvi = XGetVisualInfo( dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, & templ, & nvi ); for ( int i = 0; i < nvi; ++i ) { XRenderPictFormat * format = XRenderFindVisualFormat( dpy, xvi[i].visual ); if ( format->type == PictTypeDirect && format->direct.alphaMask ) { visual = xvi[i].visual; colormap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, AllocNone); break; } } } QApplication app( dpy, argc, argv, Qt::HANDLE( visual ), Qt::HANDLE( colormap ) ); QSystemTrayIcon tray; tray.setIcon( QPixmap( "someicon.png") ); tray.show(); return app.exec(); }