ipc: Remove unused global setting

None of the payload fields seem to be used. They were the only place
where EVENT_SIZE was used and why it had to be a macro (no variable
length arrays).
This commit is contained in:
patrick96 2019-10-28 09:57:02 +01:00 committed by Patrick Ziegler
parent 3ea7600412
commit 51184c7ead
4 changed files with 9 additions and 22 deletions

View File

@ -13,18 +13,9 @@ class signal_emitter;
/**
* Message types
*/
struct ipc_command {
static constexpr const char* prefix{"cmd:"};
char payload[EVENT_SIZE]{'\0'};
};
struct ipc_hook {
static constexpr const char* prefix{"hook:"};
char payload[EVENT_SIZE]{'\0'};
};
struct ipc_action {
static constexpr const char* prefix{"action:"};
char payload[EVENT_SIZE]{'\0'};
};
static constexpr const char* ipc_command_prefix{"cmd:"};
static constexpr const char* ipc_hook_prefix{"hook:"};
static constexpr const char* ipc_action_prefix{"action:"};
/**
* Component used for inter-process communication.

View File

@ -5,8 +5,6 @@
POLYBAR_NS
struct ipc_hook; // fwd
namespace modules {
/**
* Module that allow users to configure hooks on

View File

@ -45,8 +45,6 @@ extern const char* const APP_VERSION;
#cmakedefine DEBUG_FONTCONFIG
#endif
static const size_t EVENT_SIZE = 64;
static const int SIGN_PRIORITY_CONTROLLER{1};
static const int SIGN_PRIORITY_SCREEN{2};
static const int SIGN_PRIORITY_BAR{3};

View File

@ -61,12 +61,12 @@ void ipc::receive_message() {
} else if (bytes_read > 0) {
string payload{string_util::trim(string{buffer}, '\n')};
if (payload.find(ipc_command::prefix) == 0) {
m_sig.emit(signals::ipc::command{payload.substr(strlen(ipc_command::prefix))});
} else if (payload.find(ipc_hook::prefix) == 0) {
m_sig.emit(signals::ipc::hook{payload.substr(strlen(ipc_hook::prefix))});
} else if (payload.find(ipc_action::prefix) == 0) {
m_sig.emit(signals::ipc::action{payload.substr(strlen(ipc_action::prefix))});
if (payload.find(ipc_command_prefix) == 0) {
m_sig.emit(signals::ipc::command{payload.substr(strlen(ipc_command_prefix))});
} else if (payload.find(ipc_hook_prefix) == 0) {
m_sig.emit(signals::ipc::hook{payload.substr(strlen(ipc_hook_prefix))});
} else if (payload.find(ipc_action_prefix) == 0) {
m_sig.emit(signals::ipc::action{payload.substr(strlen(ipc_action_prefix))});
} else if (!payload.empty()) {
m_log.warn("Received unknown ipc message: (payload=%s)", payload);
}