From 3bac0dd37d62c1bed0a9205c94573d98ce1d49f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Wed, 11 Oct 2023 22:31:24 +0300 Subject: [PATCH 1/5] Don't include timestamp in build, breaks reproducability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- CMakeLists.txt | 6 ------ src/ipc.cpp | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11fbf30..cd1d378 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(i3ipc++) -string(TIMESTAMP I3IPCppBUILD_DATETIME "%Y-%m-%d %H:%M:%S") - option(I3IPCpp_WITH_TESTS "Build unit tests executables" OFF) option(I3IPCpp_BUILD_EXAMPLES "Build example executables" OFF) @@ -60,10 +58,6 @@ target_compile_options(i3ipc++ PRIVATE -std=c++17 -Wall -Wextra -Wno-unused-parameter ) -target_compile_definitions(i3ipc++ - PRIVATE I3IPC_BUILD_DATETIME="${I3IPCppBUILD_DATETIME}" -) - if (CMAKE_BUILD_TYPE STREQUAL "DEBUG") target_compile_options(i3ipc++ PUBLIC -g3 diff --git a/src/ipc.cpp b/src/ipc.cpp index afd0aca..3da4e0c 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -661,7 +661,7 @@ const version_t& get_version() { #define I3IPC_VERSION_MINOR 5 #define I3IPC_VERSION_PATCH 0 static version_t version = { - .human_readable = auss_t() << I3IPC_VERSION_MAJOR << '.' << I3IPC_VERSION_MINOR << '.' << I3IPC_VERSION_PATCH << " (built on " << I3IPC_BUILD_DATETIME << ")", + .human_readable = auss_t() << I3IPC_VERSION_MAJOR << '.' << I3IPC_VERSION_MINOR << '.' << I3IPC_VERSION_PATCH, .loaded_config_file_name = std::string(), .major = I3IPC_VERSION_MAJOR, .minor = I3IPC_VERSION_MINOR, From 58e316c65b4fcbd0898a7d8e4e6a99beb8542342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Wed, 11 Oct 2023 22:33:23 +0300 Subject: [PATCH 2/5] Document that i3/ipc.h is needed for building MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 76000c6..f760e62 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ An implementation of i3 IPC in C++11. * C++11 compiler * sigc++ 2.0 * jsoncpp +* i3 (for i3/ipc.h) ## Using Yet the only way of using is to add this repo as a submodule From aa131bd08d04343277999f750e532c568c28f1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Wed, 11 Oct 2023 22:37:03 +0300 Subject: [PATCH 3/5] Ignore more development related files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- .gitignore | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index da0e228..684fd6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ -build -doc +build/ +doc/ *.sublime-workspace *.log + +.ccls* +*.o +compile_commands.* From 9e294ff8c370c3bc9bb98db5e68862a3765f432c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Thu, 12 Oct 2023 01:24:18 +0300 Subject: [PATCH 4/5] Pass buff size correctly inside the tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #41. Fixes: 51a5ba57cc767d61e69fab87234f29d3c1e27008 #41 Signed-off-by: Björn Bidar --- test/test_ipc.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_ipc.hpp b/test/test_ipc.hpp index 1aba72c..8190c9d 100644 --- a/test/test_ipc.hpp +++ b/test/test_ipc.hpp @@ -14,7 +14,7 @@ public: auto buff = i3_pack(ClientMessageType::COMMAND, "exit"); auss_t auss; auss << std::hex; - for (uint32_t i = 0; i < buff->size; i++) { + for (uint32_t i = 0; i < buff->data.size(); i++) { if (buff->data[i] < 0x10) { auss << '0'; } From 50ae7287c2ddb57fb81381d0e0d3775b77bd5f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Wed, 11 Oct 2023 23:16:57 +0300 Subject: [PATCH 5/5] Optionally support sig-c++-3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fall back to sig-c++2.0 if not found Signed-off-by: Björn Bidar --- CMakeLists.txt | 18 +++++++++++++----- include/i3ipc++/ipc.hpp | 15 +++++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd1d378..7b7d8e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,20 @@ project(i3ipc++) option(I3IPCpp_WITH_TESTS "Build unit tests executables" OFF) option(I3IPCpp_BUILD_EXAMPLES "Build example executables" OFF) -find_package(PkgConfig) -pkg_check_modules(SIGCPP REQUIRED sigc++-2.0) -pkg_check_modules(JSONCPP REQUIRED jsoncpp) +file(GLOB_RECURSE SRC src/*.cpp) +add_library(i3ipc++ ${SRC}) + +find_package(PkgConfig) +pkg_check_modules(JSONCPP REQUIRED jsoncpp) +pkg_check_modules(SIGCPP sigc++-3.0) +if(SIGCPP_FOUND) + target_compile_definitions(i3ipc++ + PUBLIC I3CPP_IPC_SIGCPP3=${SIGCPP_FOUND} + ) +else() +pkg_check_modules(SIGCPP REQUIRED sigc++-2.0) +endif() set(I3IPCpp_INCLUDE_DIRS ${SIGCPP_INCLUDE_DIRS} @@ -31,8 +41,6 @@ set(I3IPCpp_LIBRARIES # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG") # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") -file(GLOB_RECURSE SRC src/*.cpp) -add_library(i3ipc++ ${SRC}) target_include_directories(i3ipc++ PUBLIC diff --git a/include/i3ipc++/ipc.hpp b/include/i3ipc++/ipc.hpp index 86f6c47..105aef1 100644 --- a/include/i3ipc++/ipc.hpp +++ b/include/i3ipc++/ipc.hpp @@ -369,14 +369,21 @@ public: * Disconnect the event socket */ void disconnect_event_socket(); - - sigc::signal signal_workspace_event; ///< Workspace event signal +#ifdef I3CPP_IPC_SIGCPP3 + sigc::signal signal_workspace_event; ///< Workspace event signal + sigc::signal signal_output_event; ///< Output event signal + sigc::signal signal_mode_event; ///< Output mode event signal + sigc::signal signal_window_event; ///< Window event signal + sigc::signal signal_barconfig_update_event; ///< Barconfig update event signal + sigc::signal signal_binding_event; ///< Binding event signal + sigc::signal&)> signal_event; ///< i3 event signal @note Default handler routes event to signal according to type +#else + sigc::signal signal_workspace_event; ///< Workspace event signal sigc::signal signal_output_event; ///< Output event signal sigc::signal signal_mode_event; ///< Output mode event signal sigc::signal signal_window_event; ///< Window event signal sigc::signal signal_barconfig_update_event; ///< Barconfig update event signal - sigc::signal signal_binding_event; ///< Binding event signal - sigc::signal&> signal_event; ///< i3 event signal @note Default handler routes event to signal according to type +#endif private: const int32_t m_main_socket; int32_t m_event_socket;