mirror of https://github.com/polybar/polybar.git
refactor: Wait with tray initialization until ready
This commit is contained in:
parent
ef6f649579
commit
f33d383726
|
@ -34,7 +34,7 @@ namespace sig_ev = signals::eventqueue;
|
|||
|
||||
class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::property_notify, evt::enter_notify,
|
||||
evt::leave_notify, evt::destroy_notify, evt::client_message>,
|
||||
public signal_receiver<SIGN_PRIORITY_BAR, sig_ui::tick, sig_ui::shade_window, sig_ui::unshade_window,
|
||||
public signal_receiver<SIGN_PRIORITY_BAR, sig_ev::start, sig_ui::tick, sig_ui::shade_window, sig_ui::unshade_window,
|
||||
sig_ui::dim_window> {
|
||||
public:
|
||||
using make_type = unique_ptr<bar>;
|
||||
|
@ -63,6 +63,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
void handle(const evt::expose& evt);
|
||||
void handle(const evt::property_notify& evt);
|
||||
|
||||
bool on(const sig_ev::start&);
|
||||
bool on(const sig_ui::unshade_window&);
|
||||
bool on(const sig_ui::shade_window&);
|
||||
bool on(const sig_ui::tick&);
|
||||
|
|
|
@ -57,6 +57,9 @@ namespace signals {
|
|||
}
|
||||
|
||||
namespace eventqueue {
|
||||
struct start : public detail::base_signal<start> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct exit_terminate : public detail::base_signal<exit_terminate> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace signals {
|
|||
}
|
||||
|
||||
namespace eventqueue {
|
||||
struct start;
|
||||
struct exit_terminate;
|
||||
struct exit_reload;
|
||||
struct notify_change;
|
||||
|
|
|
@ -281,11 +281,6 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const
|
|||
m_renderer->fill_background();
|
||||
m_renderer->end();
|
||||
|
||||
m_log.trace("bar: Setup tray manager");
|
||||
m_tray->setup(static_cast<const bar_settings&>(m_opts));
|
||||
|
||||
broadcast_visibility();
|
||||
|
||||
m_sig.attach(this);
|
||||
}
|
||||
|
||||
|
@ -619,6 +614,13 @@ void bar::handle(const evt::property_notify& evt) {
|
|||
}
|
||||
}
|
||||
|
||||
bool bar::on(const sig_ev::start&) {
|
||||
m_log.trace("bar: Setup tray manager");
|
||||
m_tray->setup(static_cast<const bar_settings&>(m_opts));
|
||||
broadcast_visibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bar::on(const sig_ui::unshade_window&) {
|
||||
m_opts.shaded = false;
|
||||
m_opts.shade_size.w = m_opts.size.w;
|
||||
|
|
|
@ -183,6 +183,8 @@ bool controller::run(bool writeback) {
|
|||
throw application_error("No modules started");
|
||||
}
|
||||
|
||||
m_sig.emit(signals::eventqueue::start{});
|
||||
|
||||
m_connection.flush();
|
||||
|
||||
m_event_thread = thread(&controller::process_eventqueue, this);
|
||||
|
@ -531,7 +533,7 @@ bool controller::on(const sig_ev::check_state&) {
|
|||
}
|
||||
}
|
||||
m_log.warn("No running modules...");
|
||||
on(exit_terminate{});
|
||||
on(sig_ev::exit_terminate{});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue