@@ -113,7 +113,7 @@ static std::shared_ptr<container_t> parse_container_from_json(const Json::Value
113113#undef i3IPC_TYPE_STR
114114}
115115
116- static workspace_t parse_workspace_from_json (const Json::Value& value) {
116+ static std::shared_ptr< workspace_t > parse_workspace_from_json (const Json::Value& value) {
117117 Json::Value num = value[" num" ];
118118 Json::Value name = value[" name" ];
119119 Json::Value visible = value[" visible" ];
@@ -122,29 +122,29 @@ static workspace_t parse_workspace_from_json(const Json::Value& value) {
122122 Json::Value rect = value[" rect" ];
123123 Json::Value output = value[" output" ];
124124
125- return {
126- . num = num.asInt (),
127- . name = name.asString (),
128- . visible = visible.asBool (),
129- . focused = focused.asBool (),
130- . urgent = urgent.asBool (),
131- . rect = parse_rect_from_json (rect),
132- . output = output.asString (),
133- } ;
125+ std::shared_ptr< workspace_t > p;
126+ p-> num = num.asInt ();
127+ p-> name = name.asString ();
128+ p-> visible = visible.asBool ();
129+ p-> focused = focused.asBool ();
130+ p-> urgent = urgent.asBool ();
131+ p-> rect = parse_rect_from_json (rect);
132+ p-> output = output.asString ();
133+ return p ;
134134}
135135
136- static output_t parse_output_from_json (const Json::Value& value) {
136+ static std::shared_ptr< output_t > parse_output_from_json (const Json::Value& value) {
137137 Json::Value name = value[" name" ];
138138 Json::Value active = value[" active" ];
139139 Json::Value current_workspace = value[" current_workspace" ];
140140 Json::Value rect = value[" rect" ];
141141
142- return {
143- . name = name.asString (),
144- . active = active.asBool (),
145- . current_workspace = (current_workspace.isNull () ? std::string () : current_workspace.asString ()),
146- . rect = parse_rect_from_json (rect),
147- } ;
142+ std::shared_ptr< output_t > p;
143+ p-> name = name.asString ();
144+ p-> active = active.asBool ();
145+ p-> current_workspace = (current_workspace.isNull () ? std::string () : current_workspace.asString ());
146+ p-> rect = parse_rect_from_json (rect);
147+ return p ;
148148}
149149
150150
@@ -332,14 +332,14 @@ std::shared_ptr<container_t> connection::get_tree() const {
332332}
333333
334334
335- std::vector<output_t > connection::get_outputs () const {
335+ std::vector< std::shared_ptr< output_t > > connection::get_outputs () const {
336336#define i3IPC_TYPE_STR " GET_OUTPUTS"
337337 auto buf = i3_msg (m_main_socket, ClientMessageType::GET_OUTPUTS);
338338 Json::Value root;
339339 IPC_JSON_READ (root)
340340 IPC_JSON_ASSERT_TYPE_ARRAY (root, " root" )
341341
342- std::vector<output_t > outputs;
342+ std::vector< std::shared_ptr< output_t > > outputs;
343343
344344 for (auto w : root) {
345345 outputs.push_back (parse_output_from_json (w));
@@ -350,14 +350,14 @@ std::vector<output_t> connection::get_outputs() const {
350350}
351351
352352
353- std::vector<workspace_t > connection::get_workspaces () const {
353+ std::vector< std::shared_ptr< workspace_t > > connection::get_workspaces () const {
354354#define i3IPC_TYPE_STR " GET_WORKSPACES"
355355 auto buf = i3_msg (m_main_socket, ClientMessageType::GET_WORKSPACES);
356356 Json::Value root;
357357 IPC_JSON_READ (root)
358358 IPC_JSON_ASSERT_TYPE_ARRAY (root, " root" )
359359
360- std::vector<workspace_t > workspaces;
360+ std::vector< std::shared_ptr< workspace_t > > workspaces;
361361
362362 for (auto w : root) {
363363 workspaces.push_back (parse_workspace_from_json (w));
0 commit comments