diff options
Diffstat (limited to 'kicker')
-rw-r--r-- | kicker/applets/systemtray/systemtrayapplet.cpp | 33 | ||||
-rw-r--r-- | kicker/applets/systemtray/systemtrayapplet.h | 2 |
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 |