fix(tray): Avoid tray redraw on bar update

This commit is contained in:
Michael Carlberg 2016-11-15 00:55:40 +01:00
parent 7551a7d126
commit ffe76b0556
5 changed files with 5 additions and 18 deletions

View File

@ -12,7 +12,6 @@ namespace g_signals {
namespace bar { namespace bar {
extern callback<string> action_click; extern callback<string> action_click;
extern callback<bool> visibility_change; extern callback<bool> visibility_change;
extern callback<> redraw;
} }
namespace parser { namespace parser {

View File

@ -168,7 +168,7 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify
thread m_delayed_activation; thread m_delayed_activation;
bool m_restacked = false; bool m_restacked{false};
std::mutex m_mtx; std::mutex m_mtx;
}; };

View File

@ -399,10 +399,6 @@ void bar::flush() {
m_connection.copy_area(m_pixmap, m_window, m_gcontexts.at(gc::FG), 0, 0, 0, 0, m_opts.width, m_opts.height); m_connection.copy_area(m_pixmap, m_window, m_gcontexts.at(gc::FG), 0, 0, 0, 0, m_opts.width, m_opts.height);
m_connection.flush(); m_connection.flush();
if (g_signals::bar::redraw) {
g_signals::bar::redraw();
}
#if DEBUG and DRAW_CLICKABLE_AREA_HINTS #if DEBUG and DRAW_CLICKABLE_AREA_HINTS
map<alignment, int> hint_num{{ map<alignment, int> hint_num{{
{alignment::LEFT, 0}, {alignment::CENTER, 0}, {alignment::RIGHT, 0}, {alignment::LEFT, 0}, {alignment::CENTER, 0}, {alignment::RIGHT, 0},

View File

@ -7,7 +7,6 @@ LEMONBUDDY_NS
*/ */
callback<string> g_signals::bar::action_click = nullptr; callback<string> g_signals::bar::action_click = nullptr;
callback<bool> g_signals::bar::visibility_change = nullptr; callback<bool> g_signals::bar::visibility_change = nullptr;
callback<> g_signals::bar::redraw = nullptr;
/** /**
* Signals used to communicate with the input parser * Signals used to communicate with the input parser

View File

@ -174,11 +174,6 @@ void tray_manager::activate() { // {{{
g_signals::bar::visibility_change = bind(&tray_manager::bar_visibility_change, this, std::placeholders::_1); g_signals::bar::visibility_change = bind(&tray_manager::bar_visibility_change, this, std::placeholders::_1);
} }
// Listen for redraw events on the bar window
if (!g_signals::bar::redraw) {
g_signals::bar::redraw = bind(&tray_manager::refresh_window, this);
}
// 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();
@ -217,10 +212,6 @@ void tray_manager::deactivate() { // {{{
g_signals::bar::visibility_change = nullptr; g_signals::bar::visibility_change = nullptr;
} }
if (g_signals::bar::redraw) {
g_signals::bar::redraw = nullptr;
}
if (m_connection.get_selection_owner_unchecked(m_atom).owner<xcb_window_t>() == m_tray) { if (m_connection.get_selection_owner_unchecked(m_atom).owner<xcb_window_t>() == m_tray) {
m_log.trace("tray: Unset selection owner"); m_log.trace("tray: Unset selection owner");
m_connection.set_selection_owner(XCB_NONE, m_atom, XCB_CURRENT_TIME); m_connection.set_selection_owner(XCB_NONE, m_atom, XCB_CURRENT_TIME);
@ -253,6 +244,8 @@ void tray_manager::deactivate() { // {{{
m_pixmap = 0; m_pixmap = 0;
m_gc = 0; m_gc = 0;
m_rootpixmap.pixmap = 0; m_rootpixmap.pixmap = 0;
m_prevwidth = 0;
m_prevheight = 0;
m_connection.flush(); m_connection.flush();
} // }}} } // }}}
@ -459,7 +452,7 @@ void tray_manager::refresh_window() { // {{{
std::lock_guard<std::mutex> lock(m_mtx, std::adopt_lock); std::lock_guard<std::mutex> lock(m_mtx, std::adopt_lock);
if (!m_activated || !m_mapped) { if (!m_activated || !m_mapped || m_hidden) {
return; return;
} }
@ -1073,7 +1066,7 @@ void tray_manager::handle(const evt::destroy_notify& evt) { // {{{
m_log.trace("tray: Received destroy_notify"); m_log.trace("tray: Received destroy_notify");
m_log.info("Tray selection available... re-activating"); m_log.info("Tray selection available... re-activating");
activate(); activate();
reconfigure_window(); window{m_connection, m_tray}.redraw();
} else if (m_activated) { } else if (m_activated) {
auto client = find_client(evt->window); auto client = find_client(evt->window);
if (client) { if (client) {