On my Linux machine, the systray does not properly paint the alpha channel of 
images.
Attached patch fix this.

The patch get rid of the mask generation, which didn't seem usefull on my 
machine, 
I hope it doesn't break others.

Aurélien 
Index: libs/trayicon/trayicon_x11.cpp
===================================================================
--- libs/trayicon/trayicon_x11.cpp	(revision 8254)
+++ libs/trayicon/trayicon_x11.cpp	(working copy)
@@ -157,32 +157,7 @@
 
 void TrayIcon::TrayIconPrivate::setPixmap(const QPixmap &pm)
 {
-        QBitmap mask( QWidget::size() );
-
-	if( pm.size() != QWidget::size() ) {
-		// let's make a new mask
-		mask.fill(Qt::color0);
-		QPainter maskPainter(&mask);
-
-		// draw the old mask in the center
-		maskPainter.drawPixmap((width()  - pm.width() ) / 2,
-		                       (height() - pm.height()) / 2, pm.mask());
-
-		QPixmap newPix(QWidget::size());
-		QPainter pixPainter( &newPix );
-
-		// draw the old pixmap in the center
-		pixPainter.drawPixmap((width() - pm.width())/2,
-					(height() - pm.height())/2, pm);
-		newPix.setMask(mask);
-		pix = newPix;
-	}
-	else {
-		pix = pm;
-		mask = pm.mask();
-	}
-
-	setMask(mask);
+	pix = pm;
 	setWindowIcon(pix);
 	repaint();
 }
@@ -190,7 +165,11 @@
 void TrayIcon::TrayIconPrivate::paintEvent(QPaintEvent *)
 {
 	QPainter p(this);
-	p.drawPixmap(0, 0, pix);
+
+	// Draw the icon on the center of the widget
+	int posX = (width() - pix.width()) / 2;
+	int posY = (height() - pix.height()) / 2;
+	p.drawPixmap(posX, posY, pix);
 }
 
 void TrayIcon::TrayIconPrivate::enterEvent(QEvent *e)
_______________________________________________
Wengophone-devel mailing list
Wengophone-devel@lists.openwengo.com
http://dev.openwengo.com/mailman/listinfo/wengophone-devel

Reply via email to