From d6997659fafe1329cb426d928cdde9e5a727d300 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sun, 9 Oct 2022 18:07:01 +0200
Subject: [PATCH] cleanup
---
include/x11/tray_manager.hpp | 2 +-
src/components/renderer.cpp | 2 --
src/x11/tray_client.cpp | 5 +++++
src/x11/tray_manager.cpp | 10 ++++++----
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/include/x11/tray_manager.hpp b/include/x11/tray_manager.hpp
index be453da4..9d3a7805 100644
--- a/include/x11/tray_manager.hpp
+++ b/include/x11/tray_manager.hpp
@@ -69,7 +69,7 @@ class tray_manager : public xpp::event::sinkflush();
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();
if (!m_snapshot_dst.empty()) {
diff --git a/src/x11/tray_client.cpp b/src/x11/tray_client.cpp
index b3f3757b..30b3d706 100644
--- a/src/x11/tray_client.cpp
+++ b/src/x11/tray_client.cpp
@@ -130,6 +130,10 @@ unsigned int tray_client::height() const {
}
void tray_client::clear_window() const {
+ if (!mapped()) {
+ return;
+ }
+
// 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(1, client(), 0, 0, width(), height());
@@ -327,6 +331,7 @@ void tray_client::update_bg() const {
m_log.trace("%s: Update background", name());
// 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 << CAIRO_OPERATOR_SOURCE << *m_bg_slice->get_surface();
m_context->paint();
diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp
index 7d1f5b3d..dbb34b42 100644
--- a/src/x11/tray_manager.cpp
+++ b/src/x11/tray_manager.cpp
@@ -77,6 +77,7 @@ void tray_manager::setup(const config& conf, const string& section_name) {
}
// Apply user-defined scaling
+ // TODO maybe remove
auto scale = conf.get(section_name, "tray-scale", 1.0);
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.
// 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.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();
}
-int tray_manager::get_width() const {
+unsigned tray_manager::get_width() const {
return m_tray_width;
}
@@ -331,7 +333,7 @@ void tray_manager::query_atom() {
* Set color atom used by clients when determing icon theme
*/
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 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->notify_xembed();
-
client->ensure_state();
+ client->notify_xembed();
+
m_clients.emplace_back(std::move(client));
} catch (const std::exception& err) {
m_log.err("tray: Failed to setup tray client removing... (%s)", err.what());