From ffe76b0556ca50c71ff1939beb6fc8203a90ddb3 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 15 Nov 2016 00:55:40 +0100 Subject: [PATCH] fix(tray): Avoid tray redraw on bar update --- include/components/signals.hpp | 1 - include/x11/tray.hpp | 2 +- src/components/bar.cpp | 4 ---- src/components/signals.cpp | 1 - src/x11/tray.cpp | 15 ++++----------- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/include/components/signals.hpp b/include/components/signals.hpp index 217c2f82..9b3ca2b5 100644 --- a/include/components/signals.hpp +++ b/include/components/signals.hpp @@ -12,7 +12,6 @@ namespace g_signals { namespace bar { extern callback action_click; extern callback visibility_change; - extern callback<> redraw; } namespace parser { diff --git a/include/x11/tray.hpp b/include/x11/tray.hpp index d28c3775..54267841 100644 --- a/include/x11/tray.hpp +++ b/include/x11/tray.hpp @@ -168,7 +168,7 @@ class tray_manager : public xpp::event::sink hint_num{{ {alignment::LEFT, 0}, {alignment::CENTER, 0}, {alignment::RIGHT, 0}, diff --git a/src/components/signals.cpp b/src/components/signals.cpp index 40745f91..736aac5a 100644 --- a/src/components/signals.cpp +++ b/src/components/signals.cpp @@ -7,7 +7,6 @@ LEMONBUDDY_NS */ callback g_signals::bar::action_click = nullptr; callback g_signals::bar::visibility_change = nullptr; -callback<> g_signals::bar::redraw = nullptr; /** * Signals used to communicate with the input parser diff --git a/src/x11/tray.cpp b/src/x11/tray.cpp index 7f372055..cec6c7c4 100644 --- a/src/x11/tray.cpp +++ b/src/x11/tray.cpp @@ -174,11 +174,6 @@ void tray_manager::activate() { // {{{ 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 // notify clients waiting for a manager. acquire_selection(); @@ -217,10 +212,6 @@ void tray_manager::deactivate() { // {{{ 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() == m_tray) { m_log.trace("tray: Unset selection owner"); m_connection.set_selection_owner(XCB_NONE, m_atom, XCB_CURRENT_TIME); @@ -253,6 +244,8 @@ void tray_manager::deactivate() { // {{{ m_pixmap = 0; m_gc = 0; m_rootpixmap.pixmap = 0; + m_prevwidth = 0; + m_prevheight = 0; m_connection.flush(); } // }}} @@ -459,7 +452,7 @@ void tray_manager::refresh_window() { // {{{ std::lock_guard lock(m_mtx, std::adopt_lock); - if (!m_activated || !m_mapped) { + if (!m_activated || !m_mapped || m_hidden) { return; } @@ -1073,7 +1066,7 @@ void tray_manager::handle(const evt::destroy_notify& evt) { // {{{ m_log.trace("tray: Received destroy_notify"); m_log.info("Tray selection available... re-activating"); activate(); - reconfigure_window(); + window{m_connection, m_tray}.redraw(); } else if (m_activated) { auto client = find_client(evt->window); if (client) {