From 11746455ee43ca43e2373b4e2be2200e543cc918 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sat, 25 Mar 2023 19:55:30 +0100
Subject: [PATCH] tray: Cleanup & documentation
---
include/x11/tray_manager.hpp | 9 +-------
src/x11/tray_manager.cpp | 42 +++++++++++++++---------------------
2 files changed, 18 insertions(+), 33 deletions(-)
diff --git a/include/x11/tray_manager.hpp b/include/x11/tray_manager.hpp
index 578d2bd2..5469af86 100644
--- a/include/x11/tray_manager.hpp
+++ b/include/x11/tray_manager.hpp
@@ -84,7 +84,7 @@ class manager : public xpp::event::sink(
- m_log, m_connection, m_opts.selection_owner, win, m_opts.client_size, m_opts.background);
+ auto cl =
+ make_unique(m_log, m_connection, m_opts.selection_owner, win, m_opts.client_size, m_opts.background);
try {
cl->query_xembed();
@@ -425,17 +419,15 @@ void manager::process_docking_request(xcb_window_t win) {
}
}
-/**
- * Calculate x position of tray window
- */
int manager::calculate_x() const {
return m_bar_opts.inner_area(false).x + m_pos.x;
}
-int manager::calculate_y() const {
- return m_bar_opts.inner_area(false).y + m_pos.y;
-}
-
+/**
+ * Calculates the entire width taken up by the tray area in pixels
+ *
+ * This many pixels need to be reserved on the bar in order to draw the tray.
+ */
unsigned manager::calculate_w() const {
unsigned width = m_opts.spacing;
unsigned count{0};
@@ -494,7 +486,7 @@ void manager::remove_client(xcb_window_t win) {
std::remove_if(m_clients.begin(), m_clients.end(), [win](const auto& client) { return client->match(win); }));
if (old_size != m_clients.size()) {
- manager::reconfigure();
+ reconfigure();
}
}