tray: Do not swallow clear_window exceptions

This commit is contained in:
patrick96 2021-05-18 11:05:02 +02:00 committed by Patrick Ziegler
parent ad987098ff
commit cbe4521737
2 changed files with 15 additions and 10 deletions

View File

@ -1,9 +1,10 @@
#include "x11/tray_client.hpp"
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h> #include <xcb/xcb_aux.h>
#include "utils/memory.hpp" #include "utils/memory.hpp"
#include "x11/connection.hpp" #include "x11/connection.hpp"
#include "x11/tray_client.hpp"
#include "x11/xembed.hpp" #include "x11/xembed.hpp"
POLYBAR_NS POLYBAR_NS
@ -28,11 +29,7 @@ unsigned int tray_client::height() const {
} }
void tray_client::clear_window() const { void tray_client::clear_window() const {
try {
m_connection.clear_area_checked(1, window(), 0, 0, width(), height()); m_connection.clear_area_checked(1, window(), 0, 0, width(), height());
} catch (const xpp::x::error::window& err) {
// ignore
}
} }
/** /**

View File

@ -427,14 +427,22 @@ void tray_manager::refresh_window() {
m_connection.poly_fill_rectangle(m_pixmap, m_gc, 1, &rect); m_connection.poly_fill_rectangle(m_pixmap, m_gc, 1, &rect);
} }
if (m_surface) if (m_surface) {
m_surface->flush(); m_surface->flush();
}
m_connection.clear_area(0, m_tray, 0, 0, width, height); m_connection.clear_area(0, m_tray, 0, 0, width, height);
for (auto&& client : m_clients) { for (auto&& client : m_clients) {
try {
if (client->mapped()) {
client->clear_window(); client->clear_window();
} }
} catch (const std::exception& e) {
m_log.err("Failed to clear tray client %s '%s' (%s)", m_connection.id(client->window()),
ewmh_util::get_wm_name(client->window()), e.what());
}
}
m_connection.flush(); m_connection.flush();