Shipping all payload in workspace event
This commit is contained in:
@@ -153,6 +153,17 @@ struct container_t {
|
|||||||
std::list< std::shared_ptr<container_t> > nodes;
|
std::list< std::shared_ptr<container_t> > nodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A workspace event
|
||||||
|
*/
|
||||||
|
struct workspace_event_t {
|
||||||
|
WorkspaceEventType type;
|
||||||
|
std::shared_ptr<workspace_t> current; ///< Current focused workspace
|
||||||
|
std::shared_ptr<workspace_t> old; ///< Old (previous) workspace @note With some WindowEventType could be null
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@@ -231,7 +242,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void handle_event();
|
void handle_event();
|
||||||
|
|
||||||
sigc::signal<void, WorkspaceEventType> signal_workspace_event; ///< Workspace event signal
|
sigc::signal<void, const workspace_event_t&> signal_workspace_event; ///< Workspace event signal
|
||||||
sigc::signal<void> signal_output_event; ///< Output event signal
|
sigc::signal<void> signal_output_event; ///< Output event signal
|
||||||
sigc::signal<void> signal_mode_event; ///< Output mode event signal
|
sigc::signal<void> signal_mode_event; ///< Output mode event signal
|
||||||
sigc::signal<void, WindowEventType> signal_window_event; ///< Window event signal
|
sigc::signal<void, WindowEventType> signal_window_event; ///< Window event signal
|
||||||
|
|||||||
22
src/ipc.cpp
22
src/ipc.cpp
@@ -176,25 +176,35 @@ connection::connection(const std::string& socket_path) : m_main_socket(i3_conne
|
|||||||
signal_event.connect([this](EventType event_type, const std::shared_ptr<const buf_t>& buf) {
|
signal_event.connect([this](EventType event_type, const std::shared_ptr<const buf_t>& buf) {
|
||||||
switch (event_type) {
|
switch (event_type) {
|
||||||
case ET_WORKSPACE: {
|
case ET_WORKSPACE: {
|
||||||
WorkspaceEventType type;
|
workspace_event_t ev;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
IPC_JSON_READ(root);
|
IPC_JSON_READ(root);
|
||||||
std::string change = root["change"].asString();
|
std::string change = root["change"].asString();
|
||||||
if (change == "focus") {
|
if (change == "focus") {
|
||||||
type = WorkspaceEventType::FOCUS;
|
ev.type = WorkspaceEventType::FOCUS;
|
||||||
} else if (change == "init") {
|
} else if (change == "init") {
|
||||||
type = WorkspaceEventType::INIT;
|
ev.type = WorkspaceEventType::INIT;
|
||||||
} else if (change == "empty") {
|
} else if (change == "empty") {
|
||||||
type = WorkspaceEventType::EMPTY;
|
ev.type = WorkspaceEventType::EMPTY;
|
||||||
} else if (change == "urgent") {
|
} else if (change == "urgent") {
|
||||||
type = WorkspaceEventType::URGENT;
|
ev.type = WorkspaceEventType::URGENT;
|
||||||
} else {
|
} else {
|
||||||
I3IPC_WARN("Unknown workspace event type " << change)
|
I3IPC_WARN("Unknown workspace event type " << change)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
I3IPC_DEBUG("WORKSPACE " << change)
|
I3IPC_DEBUG("WORKSPACE " << change)
|
||||||
|
|
||||||
signal_workspace_event.emit(type);
|
Json::Value current = root["current"];
|
||||||
|
Json::Value old = root["current"];
|
||||||
|
|
||||||
|
if (!current.isNull()) {
|
||||||
|
ev.current = parse_workspace_from_json(current);
|
||||||
|
}
|
||||||
|
if (!old.isNull()) {
|
||||||
|
ev.old = parse_workspace_from_json(old);
|
||||||
|
}
|
||||||
|
|
||||||
|
signal_workspace_event.emit(ev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ET_OUTPUT:
|
case ET_OUTPUT:
|
||||||
|
|||||||
Reference in New Issue
Block a user