Skip to content

Commit 409b47d

Browse files
committed
add support for newer functionality of workspace protocol
1 parent ee64e85 commit 409b47d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

plugins/single_plugins/wlr-workspaces.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class wlr_ext_workspaces_intergration : public plugin_interface_t
3030
public:
3131
wlr_ext_workspace_group_handle_v1 *group;
3232
std::vector<std::vector<wlr_ext_workspace_handle_v1*>> workspaces;
33-
std::vector<std::vector<wl_listener_wrapper>> on_ws_remove;
33+
std::vector<std::vector<std::unique_ptr<wl_listener_wrapper>>> on_ws_remove;
3434

3535
wf::wl_listener_wrapper on_commit;
3636
wf::wl_listener_wrapper on_ws_create;
@@ -54,8 +54,7 @@ class wlr_ext_workspaces_intergration : public plugin_interface_t
5454
dimensions_t ws_dim = output->workspace->get_workspace_grid_size();
5555
workspaces.resize(ws_dim.height,
5656
std::vector<wlr_ext_workspace_handle_v1*>(ws_dim.width));
57-
on_ws_remove.resize(ws_dim.height,
58-
std::vector<wl_listener_wrapper>(ws_dim.width));
57+
on_ws_remove.resize(ws_dim.height);
5958
for (int i = 0; i < ws_dim.height; i++)
6059
{
6160
for (int j = 0; j < ws_dim.width; j++)
@@ -75,13 +74,16 @@ class wlr_ext_workspaces_intergration : public plugin_interface_t
7574
workspaces[i][j], &coordinates);
7675
wl_array_release(&coordinates);
7776

78-
on_ws_remove[i][j].set_callback([&] (void*)
77+
on_ws_remove[i].emplace_back(
78+
std::make_unique<wf::wl_listener_wrapper>());
79+
on_ws_remove[i][j] = std::make_unique<wf::wl_listener_wrapper>();
80+
on_ws_remove[i][j]->set_callback([=] (void*)
7981
{
8082
LOGD("Application requested removal of workspace (",
8183
i, ", ", j, ")");
8284
});
8385

84-
on_ws_remove[i][j].connect(&workspaces[i][j]->events.remove_request);
86+
on_ws_remove[i][j]->connect(&workspaces[i][j]->events.remove_request);
8587
}
8688
}
8789

0 commit comments

Comments
 (0)