Skip to content

Commit 2d69c45

Browse files
committed
i3ipc::I3Connection renamed to i3ipc::connection
1 parent b6f819c commit 2d69c45

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

examples/workspaces.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void dump_tree_container(const i3ipc::container_t& c, std::string& prefix) {
2828

2929

3030
int main() {
31-
i3ipc::I3Connection conn;
31+
i3ipc::connection conn;
3232
for (auto& w : conn.get_workspaces()) {
3333
std::cout << '#' << std::hex << w.num << std::dec
3434
<< "\n\tName: " << w.name

include/i3ipc++/ipc.hpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ enum EventType {
7676
ET_OUTPUT = (1 << 1), ///< Output event
7777
ET_MODE = (1 << 2), ///< Output mode event
7878
ET_WINDOW = (1 << 3), ///< Window event
79-
ET_BARCONFIG_UPDATE = (1 << 4), ///< Bar config update event @attention Yet is not implemented as signal in I3Connection
79+
ET_BARCONFIG_UPDATE = (1 << 4), ///< Bar config update event @attention Yet is not implemented as signal in connection
8080
};
8181

8282
/**
@@ -153,18 +153,23 @@ struct container_t {
153153
std::list< std::shared_ptr<container_t> > nodes;
154154
};
155155

156+
/**
157+
* @deprecated
158+
*/
159+
typedef class connection I3Connection;
160+
156161
struct buf_t;
157162
/**
158163
* Connection to the i3
159164
*/
160-
class I3Connection {
165+
class connection {
161166
public:
162167
/**
163168
* Connect to the i3
164169
* @param socket_path path to a i3 IPC socket
165170
*/
166-
I3Connection(const std::string& socket_path = get_socketpath());
167-
~I3Connection();
171+
connection(const std::string& socket_path = get_socketpath());
172+
~connection();
168173

169174
/**
170175
* Send a command to i3
@@ -205,7 +210,7 @@ class I3Connection {
205210
*
206211
* Example:
207212
* @code{.cpp}
208-
* I3Connection conn;
213+
* connection conn;
209214
* conn.subscribe(i3ipc::ipc::ET_WORKSPACE | i3ipc::ipc::ET_WINDOW);
210215
* @endcode
211216
*

src/ipc.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ std::string get_socketpath() {
171171
}
172172

173173

174-
I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_connect(socket_path)), m_event_socket(-1), m_subscriptions(0), m_socket_path(socket_path) {
174+
connection::connection(const std::string& socket_path) : m_main_socket(i3_connect(socket_path)), m_event_socket(-1), m_subscriptions(0), m_socket_path(socket_path) {
175175
#define i3IPC_TYPE_STR "i3's event"
176176
signal_event.connect([this](EventType event_type, const std::shared_ptr<const buf_t>& buf) {
177177
switch (event_type) {
@@ -240,18 +240,18 @@ I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_c
240240
});
241241
#undef i3IPC_TYPE_STR
242242
}
243-
I3Connection::~I3Connection() {
243+
connection::~connection() {
244244
i3_disconnect(m_main_socket);
245245
if (m_event_socket > 0)
246246
i3_disconnect(m_event_socket);
247247
}
248248

249249

250-
void I3Connection::prepare_to_event_handling() {
250+
void connection::prepare_to_event_handling() {
251251
m_event_socket = i3_connect(m_socket_path);
252252
this->subscribe(m_subscriptions);
253253
}
254-
void I3Connection::handle_event() {
254+
void connection::handle_event() {
255255
if (m_event_socket <= 0) {
256256
throw std::runtime_error("event_socket_fd <= 0");
257257
}
@@ -261,7 +261,7 @@ void I3Connection::handle_event() {
261261
}
262262

263263

264-
bool I3Connection::subscribe(const int32_t events) {
264+
bool connection::subscribe(const int32_t events) {
265265
#define i3IPC_TYPE_STR "SUBSCRIBE"
266266
if (m_event_socket <= 0) {
267267
m_subscriptions |= events;
@@ -304,7 +304,7 @@ bool I3Connection::subscribe(const int32_t events) {
304304
}
305305

306306

307-
version_t I3Connection::get_version() const {
307+
version_t connection::get_version() const {
308308
#define i3IPC_TYPE_STR "GET_VERSION"
309309
auto buf = i3_msg(m_main_socket, ClientMessageType::GET_VERSION);
310310
Json::Value root;
@@ -322,7 +322,7 @@ version_t I3Connection::get_version() const {
322322
}
323323

324324

325-
std::shared_ptr<container_t> I3Connection::get_tree() const {
325+
std::shared_ptr<container_t> connection::get_tree() const {
326326
#define i3IPC_TYPE_STR "GET_TREE"
327327
auto buf = i3_msg(m_main_socket, ClientMessageType::GET_TREE);
328328
Json::Value root;
@@ -332,7 +332,7 @@ std::shared_ptr<container_t> I3Connection::get_tree() const {
332332
}
333333

334334

335-
std::vector<output_t> I3Connection::get_outputs() const {
335+
std::vector<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;
@@ -350,7 +350,7 @@ std::vector<output_t> I3Connection::get_outputs() const {
350350
}
351351

352352

353-
std::vector<workspace_t> I3Connection::get_workspaces() const {
353+
std::vector<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;
@@ -368,7 +368,7 @@ std::vector<workspace_t> I3Connection::get_workspaces() const {
368368
}
369369

370370

371-
bool I3Connection::send_command(const std::string& command) const {
371+
bool connection::send_command(const std::string& command) const {
372372
#define i3IPC_TYPE_STR "COMMAND"
373373
auto buf = i3_msg(m_main_socket, ClientMessageType::COMMAND, command);
374374
Json::Value root;

0 commit comments

Comments
 (0)