summaryrefslogtreecommitdiffstats
path: root/kicker/applets
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-27 07:47:44 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-27 07:47:44 +0000
commit6009a3e92e25428830047bd4dd8da300135f8c85 (patch)
tree92970f30f3e20bd1f213076c1ef5744896e5a1ac /kicker/applets
parentb544d338ecf10ede35f1e3eab65efa62bcf02d7e (diff)
downloadtdebase-6009a3e92e25428830047bd4dd8da300135f8c85.tar.gz
tdebase-6009a3e92e25428830047bd4dd8da300135f8c85.zip
Fix up the system tray to handle embedded windows with a different X11 depth than the tray itself
This truly and finally fixes system tray icon transparency when the parent application uses ARGB visuals Part 2/2 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1249645 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker/applets')
-rw-r--r--kicker/applets/systemtray/systemtrayapplet.cpp33
-rw-r--r--kicker/applets/systemtray/systemtrayapplet.h2
2 files changed, 33 insertions, 2 deletions
diff --git a/kicker/applets/systemtray/systemtrayapplet.cpp b/kicker/applets/systemtray/systemtrayapplet.cpp
index 99aa2d020..97d1cd55c 100644
--- a/kicker/applets/systemtray/systemtrayapplet.cpp
+++ b/kicker/applets/systemtray/systemtrayapplet.cpp
@@ -1155,7 +1155,7 @@ void TrayEmbed::getIconSize(int defaultIconSize)
void TrayEmbed::setBackground()
{
const TQPixmap *pbg = parentWidget()->backgroundPixmap();
-
+
if (pbg)
{
TQPixmap bg(width(), height());
@@ -1165,10 +1165,39 @@ void TrayEmbed::setBackground()
}
else
unsetPalette();
-
+
if (!isHidden())
{
XClearArea(x11Display(), embeddedWinId(), 0, 0, 0, 0, True);
+
+ ensureBackgroundSet();
}
}
+void TrayEmbed::ensureBackgroundSet()
+{
+ // This is a nasty little hack to make sure that tray icons / applications which do not match our QXEmbed native depth are still displayed properly,
+ // i.e without irritating white/grey borders where the tray icon's transparency is supposed to be...
+
+ const TQPixmap *pbg = parentWidget()->backgroundPixmap();
+
+ if (pbg)
+ {
+ TQPixmap bg(width(), height());
+ bg.fill(parentWidget(), pos());
+ setPaletteBackgroundPixmap(bg);
+ }
+
+ if (!isHidden())
+ {
+ XFlush(x11Display());
+ TQPixmap bg(width(), height(), 32);
+ TQRgb blend_color = tqRgba(0, 0, 0, 0); // RGBA
+ float alpha = tqAlpha(blend_color) / 255.0;
+ int pixel = tqAlpha(blend_color) << 24 | int(tqRed(blend_color) * alpha) << 16 | int(tqGreen(blend_color) * alpha) << 8 | int(tqBlue(blend_color) * alpha);
+ bg.fill(TQColor(blend_color, pixel));
+ Pixmap bgPm = bg.handle();
+ XSetWindowBackgroundPixmap(x11Display(), embeddedWinId(), bgPm);
+ XClearArea(x11Display(), embeddedWinId(), 0, 0, 0, 0, True);
+ }
+} \ No newline at end of file
diff --git a/kicker/applets/systemtray/systemtrayapplet.h b/kicker/applets/systemtray/systemtrayapplet.h
index a7a6a043d..868941c13 100644
--- a/kicker/applets/systemtray/systemtrayapplet.h
+++ b/kicker/applets/systemtray/systemtrayapplet.h
@@ -134,6 +134,8 @@ public:
private:
bool kde_tray;
TQWidget *m_scaledWidget;
+private slots:
+ void ensureBackgroundSet();
};
#endif