diff --git a/include/x11/tray_manager.hpp b/include/x11/tray_manager.hpp index 129cf025..d671d33e 100644 --- a/include/x11/tray_manager.hpp +++ b/include/x11/tray_manager.hpp @@ -157,6 +157,8 @@ class tray_manager /** * Current width of the tray. + * + * Caches the value calculated from all mapped tray clients. */ unsigned m_tray_width{0}; @@ -169,9 +171,6 @@ class tray_manager thread m_delaythread; - // TODO try to remove mutex - mutable mutex m_mtx{}; - bool m_firstactivation{true}; }; diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp index 13d883b5..1064f0bc 100644 --- a/src/x11/tray_manager.cpp +++ b/src/x11/tray_manager.cpp @@ -174,6 +174,7 @@ void tray_manager::deactivate(bool clear_selection) { m_connection.flush(); + // TODO update through module m_sig.emit(signals::eventqueue::notify_forcechange{}); } @@ -183,24 +184,23 @@ void tray_manager::deactivate(bool clear_selection) { void tray_manager::reconfigure() { if (!m_opts.selection_owner) { return; - } else if (m_mtx.try_lock()) { - std::unique_lock guard(m_mtx, std::adopt_lock); - - try { - reconfigure_window(); - } catch (const exception& err) { - m_log.err("Failed to reconfigure tray window (%s)", err.what()); - } - - try { - reconfigure_clients(); - } catch (const exception& err) { - m_log.err("Failed to reconfigure tray clients (%s)", err.what()); - } - guard.unlock(); - m_connection.flush(); } + try { + reconfigure_window(); + } catch (const exception& err) { + m_log.err("Failed to reconfigure tray window (%s)", err.what()); + } + + try { + reconfigure_clients(); + } catch (const exception& err) { + m_log.err("Failed to reconfigure tray clients (%s)", err.what()); + } + + m_connection.flush(); + + // TODO update through module m_sig.emit(signals::eventqueue::notify_forcechange{}); } @@ -240,13 +240,11 @@ void tray_manager::reconfigure_clients() { * Refresh the bar window by clearing it along with each client window */ void tray_manager::refresh_window() { - if (!m_activated || m_hidden || !m_mtx.try_lock()) { + if (!m_activated || m_hidden) { return; } - std::lock_guard lock(m_mtx, std::adopt_lock); - - m_log.trace("tray: Refreshing window"); + m_log.trace("tray: Refreshing clients"); for (auto& client : m_clients) { try {