Added alterntive API that exposes the JSON event objects in the signals.

This commit is contained in:
mox
2016-04-22 10:39:01 +02:00
parent 54ba4205e6
commit 8882c4f436
2 changed files with 23 additions and 4 deletions

View File

@@ -78,9 +78,12 @@ I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_c
signal_event.connect([this](EventType event_type, const std::shared_ptr<const buf_t>& buf) {
switch (event_type) {
case ET_WORKSPACE: {
WorkspaceEventType type;
Json::Value root;
IPC_JSON_READ(root);
#ifdef USE_FULL_SIGNALS
signal_workspace_event.emit(root);
#else
WorkspaceEventType type;
std::string change = root["change"].asString();
if (change == "focus") {
type = WorkspaceEventType::FOCUS;
@@ -97,6 +100,7 @@ I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_c
I3IPC_DEBUG("WORKSPACE " << change)
signal_workspace_event.emit(type);
#endif
break;
}
case ET_OUTPUT:
@@ -108,9 +112,12 @@ I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_c
signal_mode_event.emit();
break;
case ET_WINDOW: {
WindowEventType type;
Json::Value root;
IPC_JSON_READ(root);
#ifdef USE_FULL_SIGNALS
signal_window_event.emit(root);
#else
WindowEventType type;
std::string change = root["change"].asString();
if (change == "new") {
type = WindowEventType::NEW;
@@ -132,6 +139,7 @@ I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_c
I3IPC_DEBUG("WINDOW " << change)
signal_window_event.emit(type);
#endif
break;
}
case ET_BARCONFIG_UPDATE: