Compare commits

...

3 Commits

Author SHA1 Message Date
German Lashevich
ae5a2c345d Fix build issues
- `std::copy_n` requires to #include <algorithm>
- `std::optional` requires C++17 or newer
2022-06-27 21:17:21 +02:00
Francesco Galizzi
eaa8a3ff3f Solve issue #35 2022-06-27 21:17:21 +02:00
a66f24888f Handle "move" workspace event 2021-12-04 13:40:29 +01:00
4 changed files with 11 additions and 7 deletions

View File

@@ -57,7 +57,7 @@ target_link_libraries(i3ipc++
)
target_compile_options(i3ipc++
PRIVATE -std=c++11 -Wall -Wextra -Wno-unused-parameter
PRIVATE -std=c++17 -Wall -Wextra -Wno-unused-parameter
)
target_compile_definitions(i3ipc++

View File

@@ -30,8 +30,8 @@ std::string get_socketpath();
* Primitive of rectangle
*/
struct rect_t {
uint32_t x; ///< Position on X axis
uint32_t y; ///< Position on Y axis
int32_t x; ///< Position on X axis
int32_t y; ///< Position on Y axis
uint32_t width; ///< Width of rectangle
uint32_t height; ///< Height of rectangle
};
@@ -95,6 +95,7 @@ enum class WorkspaceEventType : char {
RENAME = 'r', ///< Renamed
RELOAD = 'l', ///< Reloaded
RESTORED = 's', ///< Restored
MOVE = 'm', ///< Moved (to output)
};
/**

View File

@@ -8,6 +8,7 @@ extern "C" {
#include <errno.h>
}
#include <algorithm>
#include <cstring>
#include <ios>

View File

@@ -45,8 +45,8 @@ std::vector<std::ostream*> g_logging_err_outs = {
inline rect_t parse_rect_from_json(const Json::Value& value) {
return {
.x = value["x"].asUInt(),
.y = value["y"].asUInt(),
.x = value["x"].asInt(),
.y = value["y"].asInt(),
.width = value["width"].asUInt(),
.height = value["height"].asUInt(),
};
@@ -355,6 +355,8 @@ connection::connection(const std::string& socket_path) : m_main_socket(i3_conne
ev.type = WorkspaceEventType::RELOAD;
} else if (change == "restored") {
ev.type = WorkspaceEventType::RESTORED;
} else if(change == "move") {
ev.type = WorkspaceEventType::MOVE;
} else {
I3IPC_WARN("Unknown workspace event type " << change)
break;