tray: Remove mutex
This commit is contained in:
parent
d658c07177
commit
de560fe810
@ -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};
|
||||
};
|
||||
|
||||
|
@ -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,8 +184,7 @@ 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<mutex> guard(m_mtx, std::adopt_lock);
|
||||
}
|
||||
|
||||
try {
|
||||
reconfigure_window();
|
||||
@ -197,10 +197,10 @@ void tray_manager::reconfigure() {
|
||||
} catch (const exception& err) {
|
||||
m_log.err("Failed to reconfigure tray clients (%s)", err.what());
|
||||
}
|
||||
guard.unlock();
|
||||
m_connection.flush();
|
||||
}
|
||||
|
||||
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<mutex> lock(m_mtx, std::adopt_lock);
|
||||
|
||||
m_log.trace("tray: Refreshing window");
|
||||
m_log.trace("tray: Refreshing clients");
|
||||
|
||||
for (auto& client : m_clients) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user