fix: Use defined event sink priority

This commit is contained in:
Michael Carlberg 2016-12-03 13:00:40 +01:00
parent a1ad4de470
commit 4776ec49df
9 changed files with 21 additions and 19 deletions

View File

@ -29,6 +29,11 @@
#cmakedefine VERBOSE_TRACELOG
#cmakedefine DEBUG_HINTS
static const int SINK_PRIORITY_BAR{1};
static const int SINK_PRIORITY_SCREEN{2};
static const int SINK_PRIORITY_TRAY{3};
static const int SINK_PRIORITY_MODULE{4};
#ifdef DEBUG_HINTS
static const int DEBUG_HINTS_OFFSET_X{@DEBUG_HINTS_OFFSET_X@};
static const int DEBUG_HINTS_OFFSET_Y{@DEBUG_HINTS_OFFSET_Y@};

View File

@ -45,7 +45,6 @@ namespace modules {
xworkspaces_module(const bar_settings& bar, const logger& logger, const config& config, string name);
void setup();
void start();
void teardown();
void handle(const evt::property_notify& evt);
void update();

View File

@ -53,7 +53,7 @@ bar::bar(connection& conn, const config& config, const logger& logger, unique_pt
bar::~bar() {
std::lock_guard<std::mutex> guard(m_mutex);
g_signals::tray::report_slotcount = nullptr;
m_connection.detach_sink(this, 1);
m_connection.detach_sink(this, SINK_PRIORITY_BAR);
m_tray.reset();
}
@ -148,7 +148,7 @@ void bar::bootstrap(bool nodraw) {
}
m_log.trace("bar: Attaching sink to registry");
m_connection.attach_sink(this, 1);
m_connection.attach_sink(this, SINK_PRIORITY_BAR);
configure_geom();

View File

@ -60,14 +60,14 @@ screen::screen(connection& conn, const logger& logger, const config& conf)
m_connection.clear_event_mask(m_root);
// Finally attach the sink the process randr events
m_connection.attach_sink(this, 1);
m_connection.attach_sink(this, SINK_PRIORITY_SCREEN);
}
/**
* Deconstruct screen instance
*/
screen::~screen() {
m_connection.detach_sink(this, 1);
m_connection.detach_sink(this, SINK_PRIORITY_SCREEN);
if (m_proxy != XCB_NONE) {
m_connection.destroy_window(m_proxy);

View File

@ -65,7 +65,7 @@ namespace modules {
// Connect with the event registry and make sure we get
// notified when a RandR output property gets modified
m_connection.attach_sink(this, 1);
m_connection.attach_sink(this, SINK_PRIORITY_MODULE);
m_connection.select_input_checked(m_proxy, XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY);
// Add formats and elements
@ -89,7 +89,7 @@ namespace modules {
* Disconnect from the event registry
*/
void xbacklight_module::teardown() {
m_connection.detach_sink(this, 1);
m_connection.detach_sink(this, SINK_PRIORITY_MODULE);
}
/**

View File

@ -38,7 +38,7 @@ namespace modules {
}
// Connect to the event registry
m_connection.attach_sink(this, 3);
m_connection.attach_sink(this, SINK_PRIORITY_MODULE);
// Setup extension
m_connection.xkb().select_events_checked(XCB_XKB_ID_USE_CORE_KBD,
@ -55,7 +55,7 @@ namespace modules {
* Disconnect from the event registry
*/
void xkeyboard_module::teardown() {
m_connection.detach_sink(this, 3);
m_connection.detach_sink(this, SINK_PRIORITY_MODULE);
}
/**

View File

@ -98,7 +98,7 @@ namespace modules {
m_connection.ensure_event_mask(m_connection.root(), XCB_EVENT_MASK_PROPERTY_CHANGE);
// Connect with the event registry
m_connection.attach_sink(this, 1);
m_connection.attach_sink(this, SINK_PRIORITY_MODULE);
// Trigger the initial draw event
update();
@ -108,7 +108,7 @@ namespace modules {
* Disconnect from the event registry
*/
void xwindow_module::teardown() {
m_connection.detach_sink(this, 1);
m_connection.detach_sink(this, SINK_PRIORITY_MODULE);
}
/**

View File

@ -83,19 +83,17 @@ namespace modules {
// Make sure we get notified when root properties change
window{m_connection, m_connection.root()}.ensure_event_mask(XCB_EVENT_MASK_PROPERTY_CHANGE);
// Connect with the event registry
m_connection.attach_sink(this, SINK_PRIORITY_MODULE);
update();
}
void xworkspaces_module::start() {
// Connect with the event registry
m_connection.attach_sink(this, 3);
static_module::start();
}
/**
* Disconnect from the event registry
*/
void xworkspaces_module::teardown() {
m_connection.detach_sink(this, 3);
m_connection.detach_sink(this, SINK_PRIORITY_MODULE);
}
/**

View File

@ -139,11 +139,11 @@ void tray_client::configure_notify(int16_t x, int16_t y) const { // {{{
// implementation : tray_manager {{{
tray_manager::tray_manager(connection& conn, const logger& logger) : m_connection(conn), m_log(logger) {
m_connection.attach_sink(this, 2);
m_connection.attach_sink(this, SINK_PRIORITY_TRAY);
}
tray_manager::~tray_manager() {
m_connection.detach_sink(this, 2);
m_connection.detach_sink(this, SINK_PRIORITY_TRAY);
if (m_delaythread.joinable()) {
m_delaythread.join();