fix(tray): Handle visibility change

Ref #211
This commit is contained in:
Michael Carlberg 2016-12-03 17:00:18 +01:00
parent 6b51234f23
commit 22f3af96b9

View File

@ -165,6 +165,9 @@ const tray_settings tray_manager::settings() const { // {{{
void tray_manager::bootstrap(tray_settings settings) { // {{{ void tray_manager::bootstrap(tray_settings settings) { // {{{
m_opts = settings; m_opts = settings;
query_atom(); query_atom();
// Listen for visibility change events on the bar window
g_signals::bar::visibility_change = bind(&tray_manager::bar_visibility_change, this, placeholders::_1);
} // }}} } // }}}
/** /**
@ -191,11 +194,6 @@ void tray_manager::activate() { // {{{
return; return;
} }
// Listen for visibility change events on the bar window
if (!m_restacked && !g_signals::bar::visibility_change) {
g_signals::bar::visibility_change = bind(&tray_manager::bar_visibility_change, this, std::placeholders::_1);
}
// Attempt to get control of the systray selection then // Attempt to get control of the systray selection then
// notify clients waiting for a manager. // notify clients waiting for a manager.
acquire_selection(); acquire_selection();
@ -779,7 +777,7 @@ void tray_manager::process_docking_request(xcb_window_t win) { // {{{
* toggle the tray window whenever the visibility of the bar window changes. * toggle the tray window whenever the visibility of the bar window changes.
*/ */
void tray_manager::bar_visibility_change(bool state) { // {{{ void tray_manager::bar_visibility_change(bool state) { // {{{
if (m_hidden == !state) { if (!m_activated || m_restacked || m_hidden == !state) {
return; return;
} }