Skip to content

Commit 61cd368

Browse files
committed
Shipping all payload in window event
1 parent b94c465 commit 61cd368

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

include/i3ipc++/ipc.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ struct workspace_event_t {
164164
};
165165

166166

167+
/**
168+
* A window event
169+
*/
170+
struct window_event_t {
171+
WindowEventType type;
172+
std::shared_ptr<container_t> container; ///< A container event associated with @note With some WindowEventType could be null
173+
};
174+
175+
167176
/**
168177
* @deprecated
169178
*/
@@ -245,7 +254,7 @@ class connection {
245254
sigc::signal<void, const workspace_event_t&> signal_workspace_event; ///< Workspace event signal
246255
sigc::signal<void> signal_output_event; ///< Output event signal
247256
sigc::signal<void> signal_mode_event; ///< Output mode event signal
248-
sigc::signal<void, WindowEventType> signal_window_event; ///< Window event signal
257+
sigc::signal<void, const window_event_t&> signal_window_event; ///< Window event signal
249258
sigc::signal<void> signal_barconfig_update_event; ///< Barconfig update event signal
250259
sigc::signal<void, EventType, const std::shared_ptr<const buf_t>&> signal_event; ///< i3 event signal @note Default handler routes event to signal according to type
251260
private:

src/ipc.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,30 +216,35 @@ connection::connection(const std::string& socket_path) : m_main_socket(i3_conne
216216
signal_mode_event.emit();
217217
break;
218218
case ET_WINDOW: {
219-
WindowEventType type;
219+
window_event_t ev;
220220
Json::Value root;
221221
IPC_JSON_READ(root);
222222
std::string change = root["change"].asString();
223223
if (change == "new") {
224-
type = WindowEventType::NEW;
224+
ev.type = WindowEventType::NEW;
225225
} else if (change == "close") {
226-
type = WindowEventType::CLOSE;
226+
ev.type = WindowEventType::CLOSE;
227227
} else if (change == "focus") {
228-
type = WindowEventType::FOCUS;
228+
ev.type = WindowEventType::FOCUS;
229229
} else if (change == "title") {
230-
type = WindowEventType::TITLE;
230+
ev.type = WindowEventType::TITLE;
231231
} else if (change == "fullscreen_mode") {
232-
type = WindowEventType::FULLSCREEN_MODE;
232+
ev.type = WindowEventType::FULLSCREEN_MODE;
233233
} else if (change == "move") {
234-
type = WindowEventType::MOVE;
234+
ev.type = WindowEventType::MOVE;
235235
} else if (change == "floating") {
236-
type = WindowEventType::FLOATING;
236+
ev.type = WindowEventType::FLOATING;
237237
} else if (change == "urgent") {
238-
type = WindowEventType::URGENT;
238+
ev.type = WindowEventType::URGENT;
239239
}
240240
I3IPC_DEBUG("WINDOW " << change)
241241

242-
signal_window_event.emit(type);
242+
Json::Value container = root["container"];
243+
if (!container.isNull()) {
244+
ev.container = parse_container_from_json(container);
245+
}
246+
247+
signal_window_event.emit(ev);
243248
break;
244249
}
245250
case ET_BARCONFIG_UPDATE:

0 commit comments

Comments
 (0)