tray: Remove mutex
This commit is contained in:
parent
d658c07177
commit
de560fe810
@ -157,6 +157,8 @@ class tray_manager
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Current width of the tray.
|
* Current width of the tray.
|
||||||
|
*
|
||||||
|
* Caches the value calculated from all mapped tray clients.
|
||||||
*/
|
*/
|
||||||
unsigned m_tray_width{0};
|
unsigned m_tray_width{0};
|
||||||
|
|
||||||
@ -169,9 +171,6 @@ class tray_manager
|
|||||||
|
|
||||||
thread m_delaythread;
|
thread m_delaythread;
|
||||||
|
|
||||||
// TODO try to remove mutex
|
|
||||||
mutable mutex m_mtx{};
|
|
||||||
|
|
||||||
bool m_firstactivation{true};
|
bool m_firstactivation{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,6 +174,7 @@ void tray_manager::deactivate(bool clear_selection) {
|
|||||||
|
|
||||||
m_connection.flush();
|
m_connection.flush();
|
||||||
|
|
||||||
|
// TODO update through module
|
||||||
m_sig.emit(signals::eventqueue::notify_forcechange{});
|
m_sig.emit(signals::eventqueue::notify_forcechange{});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,24 +184,23 @@ void tray_manager::deactivate(bool clear_selection) {
|
|||||||
void tray_manager::reconfigure() {
|
void tray_manager::reconfigure() {
|
||||||
if (!m_opts.selection_owner) {
|
if (!m_opts.selection_owner) {
|
||||||
return;
|
return;
|
||||||
} else if (m_mtx.try_lock()) {
|
|
||||||
std::unique_lock<mutex> 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{});
|
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
|
* Refresh the bar window by clearing it along with each client window
|
||||||
*/
|
*/
|
||||||
void tray_manager::refresh_window() {
|
void tray_manager::refresh_window() {
|
||||||
if (!m_activated || m_hidden || !m_mtx.try_lock()) {
|
if (!m_activated || m_hidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<mutex> lock(m_mtx, std::adopt_lock);
|
m_log.trace("tray: Refreshing clients");
|
||||||
|
|
||||||
m_log.trace("tray: Refreshing window");
|
|
||||||
|
|
||||||
for (auto& client : m_clients) {
|
for (auto& client : m_clients) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user