Redraw tray on wallpaper change, only if transparent (#2604)

The tray manager of polybar listens on multiple atoms for the background of the root window. On change of these atoms, it will redraw its window-background and message its tray-client to redraw also.

On fast changes of of background, this leads to immense messaging and eventual flickering of the systray.

This patch tries to soften the issue in a way, that tray-window and its client will only redraw, if the bar has transparency. If not, there should be no reason to redraw on wallpaper-change.

* Redraw on background change only if transparent

* Replace tab with spaces
This commit is contained in:
Frank Großgasteiger 2022-03-07 19:16:07 +01:00 committed by GitHub
parent 5b2de60353
commit 638a57379b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1013,13 +1013,15 @@ void tray_manager::handle(const evt::selection_clear& evt) {
void tray_manager::handle(const evt::property_notify& evt) { void tray_manager::handle(const evt::property_notify& evt) {
if (!m_activated) { if (!m_activated) {
return; return;
} else if (evt->atom == _XROOTPMAP_ID) { }
// React an wallpaper change, if bar has transparency
if (m_opts.transparent && (evt->atom == _XROOTPMAP_ID || evt->atom == _XSETROOT_ID || evt->atom == ESETROOT_PMAP_ID)) {
redraw_window(true); redraw_window(true);
} else if (evt->atom == _XSETROOT_ID) { return;
redraw_window(true); }
} else if (evt->atom == ESETROOT_PMAP_ID) {
redraw_window(true); if (evt->atom != _XEMBED_INFO) {
} else if (evt->atom != _XEMBED_INFO) {
return; return;
} }