This commit is contained in:
patrick96 2022-10-09 18:07:01 +02:00
parent 3cfa01233c
commit d6997659fa
No known key found for this signature in database
GPG Key ID: 521E5E03AEBCA1A7
4 changed files with 12 additions and 7 deletions

View File

@ -69,7 +69,7 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::client_message, e
~tray_manager(); ~tray_manager();
int get_width() const; unsigned get_width() const;
void setup(const config& conf, const string& module_section_name); void setup(const config& conf, const string& module_section_name);
void activate(); void activate();

View File

@ -374,8 +374,6 @@ void renderer::flush() {
m_surface->flush(); m_surface->flush();
m_connection.clear_area(0, m_window, 0, 0, m_bar.size.w, m_bar.size.h); m_connection.clear_area(0, m_window, 0, 0, m_bar.size.w, m_bar.size.h);
// TODO
// m_connection.copy_area(m_pixmap, m_window, m_gcontext, 0, 0, 0, 0, m_bar.size.w, m_bar.size.h);
m_connection.flush(); m_connection.flush();
if (!m_snapshot_dst.empty()) { if (!m_snapshot_dst.empty()) {

View File

@ -130,6 +130,10 @@ unsigned int tray_client::height() const {
} }
void tray_client::clear_window() const { void tray_client::clear_window() const {
if (!mapped()) {
return;
}
// Do not produce Expose events for the embedder because that triggers an infinite loop. // Do not produce Expose events for the embedder because that triggers an infinite loop.
m_connection.clear_area_checked(0, embedder(), 0, 0, width(), height()); m_connection.clear_area_checked(0, embedder(), 0, 0, width(), height());
m_connection.clear_area_checked(1, client(), 0, 0, width(), height()); m_connection.clear_area_checked(1, client(), 0, 0, width(), height());
@ -327,6 +331,7 @@ void tray_client::update_bg() const {
m_log.trace("%s: Update background", name()); m_log.trace("%s: Update background", name());
// Composite background slice with background color. // Composite background slice with background color.
// TODO this doesn't have to be done if the background color is not transparent.
m_context->clear(); m_context->clear();
*m_context << CAIRO_OPERATOR_SOURCE << *m_bg_slice->get_surface(); *m_context << CAIRO_OPERATOR_SOURCE << *m_bg_slice->get_surface();
m_context->paint(); m_context->paint();

View File

@ -77,6 +77,7 @@ void tray_manager::setup(const config& conf, const string& section_name) {
} }
// Apply user-defined scaling // Apply user-defined scaling
// TODO maybe remove
auto scale = conf.get(section_name, "tray-scale", 1.0); auto scale = conf.get(section_name, "tray-scale", 1.0);
client_height *= scale; client_height *= scale;
@ -84,6 +85,7 @@ void tray_manager::setup(const config& conf, const string& section_name) {
// Set user-defined foreground and background colors. // Set user-defined foreground and background colors.
// TODO maybe remove // TODO maybe remove
// TODO only run background manager, etc. when the background has transparency.
m_opts.background = conf.get(section_name, "tray-background", m_bar_opts.background); m_opts.background = conf.get(section_name, "tray-background", m_bar_opts.background);
m_opts.foreground = conf.get(section_name, "tray-foreground", m_bar_opts.foreground); m_opts.foreground = conf.get(section_name, "tray-foreground", m_bar_opts.foreground);
@ -99,7 +101,7 @@ void tray_manager::setup(const config& conf, const string& section_name) {
activate(); activate();
} }
int tray_manager::get_width() const { unsigned tray_manager::get_width() const {
return m_tray_width; return m_tray_width;
} }
@ -331,7 +333,7 @@ void tray_manager::query_atom() {
* Set color atom used by clients when determing icon theme * Set color atom used by clients when determing icon theme
*/ */
void tray_manager::set_tray_colors() { void tray_manager::set_tray_colors() {
m_log.trace("tray: Set _NET_SYSTEM_TRAY_COLORS to %x", m_opts.foreground); m_log.trace("tray: Set _NET_SYSTEM_TRAY_COLORS to 0x%08x", m_opts.foreground);
auto r = m_opts.foreground.red_i(); auto r = m_opts.foreground.red_i();
auto g = m_opts.foreground.green_i(); auto g = m_opts.foreground.green_i();
@ -460,10 +462,10 @@ void tray_manager::process_docking_request(xcb_window_t win) {
client->add_to_save_set(); client->add_to_save_set();
client->notify_xembed();
client->ensure_state(); client->ensure_state();
client->notify_xembed();
m_clients.emplace_back(std::move(client)); m_clients.emplace_back(std::move(client));
} catch (const std::exception& err) { } catch (const std::exception& err) {
m_log.err("tray: Failed to setup tray client removing... (%s)", err.what()); m_log.err("tray: Failed to setup tray client removing... (%s)", err.what());