Added the neccessary CMake magic to optionally change the API.
This commit is contained in:
@@ -3,6 +3,7 @@ project(i3ipc++)
|
||||
|
||||
option(I3IPCpp_WITH_TESTS "Build unit tests executables" OFF)
|
||||
option(I3IPCpp_BUILD_EXAMPLES "Build example executables" OFF)
|
||||
option(I3IPCpp_USE_FULL_SIGNALS "Provide full JSON event object with the signals for workspace_event and window_event. !!CHANGES API!!" OFF)
|
||||
|
||||
set(BUILD_STATIC_LIBS ON)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
@@ -13,7 +14,14 @@ UNSET(BUILD_SHARED_LIBS)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(SIGCPP REQUIRED sigc++-2.0)
|
||||
|
||||
# configure a header file to pass some settings to the source code
|
||||
configure_file (
|
||||
"${PROJECT_SOURCE_DIR}/include/i3ipc++/i3ipc++_config.hpp.in"
|
||||
"${PROJECT_BINARY_DIR}/include/i3ipc++_config.hpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_BINARY_DIR}/include
|
||||
${SIGCPP_INCLUDE_DIRS}
|
||||
3rd/jsoncpp/include
|
||||
3rd/auss/include
|
||||
@@ -40,7 +48,8 @@ set(I3IPCpp_INCLUDE_DIRS
|
||||
set(I3IPCpp_LIBRARIES i3ipc++_static ${SIGCPP_LIBRARIES} jsoncpp_lib_static)
|
||||
|
||||
set(I3IPCpp_LIBRARY_DIRS ${I3IPCpp_LIBRARY_DIRS} PARENT_SCOPE)
|
||||
set(I3IPCpp_INCLUDE_DIRS ${I3IPCpp_INCLUDE_DIRS} PARENT_SCOPE)
|
||||
set(I3IPCpp_INCLUDE_DIRS ${I3IPCpp_INCLUDE_DIRS})
|
||||
set(I3IPCpp_INCLUDE_DIRS ${I3IPCpp_INCLUDE_DIRS} ${PROJECT_BINARY_DIR}/include PARENT_SCOPE)
|
||||
set(I3IPCpp_LIBRARIES ${I3IPCpp_LIBRARIES} PARENT_SCOPE)
|
||||
|
||||
if(I3IPCpp_BUILD_EXAMPLES)
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#ifdef USE_FULL_SIGNALS
|
||||
#include "i3ipc++_config.hpp"
|
||||
|
||||
#ifdef I3IPCpp_USE_FULL_SIGNALS
|
||||
#include <json/json.h>
|
||||
#endif
|
||||
|
||||
@@ -82,7 +84,7 @@ enum EventType {
|
||||
ET_BARCONFIG_UPDATE = (1 << 4), /**< Bar config update event @attention Yet is not implemented as signal in I3Connection */
|
||||
};
|
||||
|
||||
#ifndef USE_FULL_SIGNALS
|
||||
#ifndef I3IPCpp_USE_FULL_SIGNALS
|
||||
/**
|
||||
* Types of workspace events
|
||||
*/
|
||||
@@ -178,7 +180,7 @@ public:
|
||||
sigc::signal<void> signal_output_event; /**< Output event signal */
|
||||
sigc::signal<void> signal_mode_event; /**< Output mode event signal */
|
||||
sigc::signal<void> signal_barconfig_update_event; /**< Barconfig update event signal */
|
||||
#ifdef USE_FULL_SIGNALS
|
||||
#ifdef I3IPCpp_USE_FULL_SIGNALS
|
||||
sigc::signal<void, const Json::Value&> signal_workspace_event; /**< Workspace event signal */
|
||||
sigc::signal<void, const Json::Value&> signal_window_event; /**< Window event signal */
|
||||
#else
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <auss.hpp>
|
||||
#ifndef I3IPCpp_USE_FULL_SIGNALS
|
||||
#include <json/json.h>
|
||||
#endif
|
||||
|
||||
#include "log.hpp"
|
||||
#include "ipc-util.hpp"
|
||||
@@ -80,7 +82,7 @@ I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_c
|
||||
case ET_WORKSPACE: {
|
||||
Json::Value root;
|
||||
IPC_JSON_READ(root);
|
||||
#ifdef USE_FULL_SIGNALS
|
||||
#ifdef I3IPCpp_USE_FULL_SIGNALS
|
||||
signal_workspace_event.emit(root);
|
||||
#else
|
||||
WorkspaceEventType type;
|
||||
@@ -114,7 +116,7 @@ I3Connection::I3Connection(const std::string& socket_path) : m_main_socket(i3_c
|
||||
case ET_WINDOW: {
|
||||
Json::Value root;
|
||||
IPC_JSON_READ(root);
|
||||
#ifdef USE_FULL_SIGNALS
|
||||
#ifdef I3IPCpp_USE_FULL_SIGNALS
|
||||
signal_window_event.emit(root);
|
||||
#else
|
||||
WindowEventType type;
|
||||
|
||||
Reference in New Issue
Block a user