dwm: Don't use trailing return types
Keep it consistent with the rest of the code.
This commit is contained in:
parent
803fe549c6
commit
fbe05890e0
@ -47,13 +47,13 @@ namespace modules {
|
|||||||
label_t label;
|
label_t label;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto stop() -> void override;
|
void stop() override;
|
||||||
auto has_event() -> bool;
|
bool has_event();
|
||||||
auto update() -> bool;
|
bool update();
|
||||||
auto build(builder* builder, const string& tag) const -> bool;
|
bool build(builder* builder, const string& tag) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
auto input(string&& cmd) -> bool override;
|
bool input(string&& cmd) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr const char* DEFAULT_FORMAT_TAGS{"<label-tags> <label-layout> <label-floating> <label-title>"};
|
static constexpr const char* DEFAULT_FORMAT_TAGS{"<label-tags> <label-layout> <label-floating> <label-title>"};
|
||||||
@ -199,17 +199,17 @@ namespace modules {
|
|||||||
*
|
*
|
||||||
* @return state_t enum value representing the state of the tag
|
* @return state_t enum value representing the state of the tag
|
||||||
*/
|
*/
|
||||||
auto get_state(tag_mask_t bit_mask) const -> state_t;
|
state_t get_state(tag_mask_t bit_mask) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the address to the layout represented by the symbol.
|
* Get the address to the layout represented by the symbol.
|
||||||
*/
|
*/
|
||||||
auto find_layout(const string& sym) const -> const dwmipc::Layout*;
|
const dwmipc::Layout* find_layout(const string& sym) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the address to the layout represented by the address.
|
* Get the address to the layout represented by the address.
|
||||||
*/
|
*/
|
||||||
auto find_layout(uintptr_t addr) const -> const dwmipc::Layout*;
|
const dwmipc::Layout* find_layout(uintptr_t addr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the address of the next layout in m_layouts.
|
* Get the address of the next layout in m_layouts.
|
||||||
@ -218,7 +218,7 @@ namespace modules {
|
|||||||
* @param wrap True to wrap around the array, false to return the same
|
* @param wrap True to wrap around the array, false to return the same
|
||||||
* layout if the next layout does not exist.
|
* layout if the next layout does not exist.
|
||||||
*/
|
*/
|
||||||
auto next_layout(const dwmipc::Layout& layout, bool wrap) const -> const dwmipc::Layout*;
|
const dwmipc::Layout* next_layout(const dwmipc::Layout& layout, bool wrap) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the address of the previous layout in m_layouts.
|
* Get the address of the previous layout in m_layouts.
|
||||||
@ -227,7 +227,7 @@ namespace modules {
|
|||||||
* @param wrap True to wrap around the array, false to return the same
|
* @param wrap True to wrap around the array, false to return the same
|
||||||
* layout if the next layout does not exist.
|
* layout if the next layout does not exist.
|
||||||
*/
|
*/
|
||||||
auto prev_layout(const dwmipc::Layout& layout, bool wrap) const -> const dwmipc::Layout*;
|
const dwmipc::Layout* prev_layout(const dwmipc::Layout& layout, bool wrap) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the command matches the specified IPC command name and if so,
|
* Check if the command matches the specified IPC command name and if so,
|
||||||
@ -239,7 +239,7 @@ namespace modules {
|
|||||||
* @return true if the command matched, was succesfully parsed, and sent to
|
* @return true if the command matched, was succesfully parsed, and sent to
|
||||||
* dwm, false otherwise
|
* dwm, false otherwise
|
||||||
*/
|
*/
|
||||||
auto check_send_cmd(string cmd, const string& ipc_cmd) -> bool;
|
bool check_send_cmd(string cmd, const string& ipc_cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to build cmd string
|
* Helper function to build cmd string
|
||||||
@ -247,12 +247,12 @@ namespace modules {
|
|||||||
* @param ipc_cmd The dwm IPC command name
|
* @param ipc_cmd The dwm IPC command name
|
||||||
* @param arg The argument to the dwm command
|
* @param arg The argument to the dwm command
|
||||||
*/
|
*/
|
||||||
auto static build_cmd(const char* ipc_cmd, const string& arg) -> string;
|
static string build_cmd(const char* ipc_cmd, const string& arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to connect to any disconnected dwm sockets. Catch errors.
|
* Attempt to connect to any disconnected dwm sockets. Catch errors.
|
||||||
*/
|
*/
|
||||||
auto reconnect_dwm() -> bool;
|
bool reconnect_dwm();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, enables the click handlers for the tags
|
* If true, enables the click handlers for the tags
|
||||||
|
@ -155,7 +155,7 @@ namespace modules {
|
|||||||
event_module::stop();
|
event_module::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::has_event() -> bool {
|
bool dwm_module::has_event() {
|
||||||
try {
|
try {
|
||||||
return m_ipc->handle_event();
|
return m_ipc->handle_event();
|
||||||
} catch (const dwmipc::SocketClosedError& err) {
|
} catch (const dwmipc::SocketClosedError& err) {
|
||||||
@ -168,16 +168,16 @@ namespace modules {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::update() -> bool {
|
bool dwm_module::update() {
|
||||||
// All updates are handled in has_event
|
// All updates are handled in has_event
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::build_cmd(const char* ipc_cmd, const string& arg) -> string {
|
string dwm_module::build_cmd(const char* ipc_cmd, const string& arg) {
|
||||||
return EVENT_PREFIX + string(ipc_cmd) + "-" + arg;
|
return EVENT_PREFIX + string(ipc_cmd) + "-" + arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::build(builder* builder, const string& tag) const -> bool {
|
bool dwm_module::build(builder* builder, const string& tag) const {
|
||||||
m_log.info("%s: Building module", name());
|
m_log.info("%s: Building module", name());
|
||||||
if (tag == TAG_LABEL_TITLE) {
|
if (tag == TAG_LABEL_TITLE) {
|
||||||
m_log.info("%s: Building title", name());
|
m_log.info("%s: Building title", name());
|
||||||
@ -242,7 +242,7 @@ namespace modules {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::check_send_cmd(string cmd, const string& ipc_cmd) -> bool {
|
bool dwm_module::check_send_cmd(string cmd, const string& ipc_cmd) {
|
||||||
// cmd = <EVENT_PREFIX><ipc_cmd>-<arg>
|
// cmd = <EVENT_PREFIX><ipc_cmd>-<arg>
|
||||||
cmd.erase(0, strlen(EVENT_PREFIX));
|
cmd.erase(0, strlen(EVENT_PREFIX));
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ namespace modules {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::input(string&& cmd) -> bool {
|
bool dwm_module::input(string&& cmd) {
|
||||||
if (cmd.find(EVENT_PREFIX) != 0) {
|
if (cmd.find(EVENT_PREFIX) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ namespace modules {
|
|||||||
check_send_cmd(cmd, CMD_LAYOUT_SET);
|
check_send_cmd(cmd, CMD_LAYOUT_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::get_state(tag_mask_t bit_mask) const -> state_t {
|
dwm_module::state_t dwm_module::get_state(tag_mask_t bit_mask) const {
|
||||||
/**
|
/**
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
* | Tag | | |
|
* | Tag | | |
|
||||||
@ -330,7 +330,7 @@ namespace modules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::find_layout(const string& sym) const -> const dwmipc::Layout* {
|
const dwmipc::Layout* dwm_module::find_layout(const string& sym) const {
|
||||||
for (const auto& lt : *m_layouts) {
|
for (const auto& lt : *m_layouts) {
|
||||||
if (lt.symbol == sym) {
|
if (lt.symbol == sym) {
|
||||||
return <
|
return <
|
||||||
@ -339,7 +339,7 @@ namespace modules {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::find_layout(const uintptr_t addr) const -> const dwmipc::Layout* {
|
const dwmipc::Layout* dwm_module::find_layout(const uintptr_t addr) const {
|
||||||
for (const auto& lt : *m_layouts) {
|
for (const auto& lt : *m_layouts) {
|
||||||
if (lt.address == addr) {
|
if (lt.address == addr) {
|
||||||
return <
|
return <
|
||||||
@ -348,7 +348,7 @@ namespace modules {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::next_layout(const dwmipc::Layout& layout, bool wrap) const -> const dwmipc::Layout* {
|
const dwmipc::Layout* dwm_module::next_layout(const dwmipc::Layout& layout, bool wrap) const {
|
||||||
const auto* next = &layout + 1;
|
const auto* next = &layout + 1;
|
||||||
const auto* first = m_layouts->begin().base();
|
const auto* first = m_layouts->begin().base();
|
||||||
if (next < m_layouts->end().base()) {
|
if (next < m_layouts->end().base()) {
|
||||||
@ -360,7 +360,7 @@ namespace modules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::prev_layout(const dwmipc::Layout& layout, bool wrap) const -> const dwmipc::Layout* {
|
const dwmipc::Layout* dwm_module::prev_layout(const dwmipc::Layout& layout, bool wrap) const {
|
||||||
const auto* prev = &layout - 1;
|
const auto* prev = &layout - 1;
|
||||||
const auto* last = m_layouts->end().base() - 1;
|
const auto* last = m_layouts->end().base() - 1;
|
||||||
if (prev >= m_layouts->begin().base()) {
|
if (prev >= m_layouts->begin().base()) {
|
||||||
@ -423,7 +423,7 @@ namespace modules {
|
|||||||
m_layout_label->replace_token("%symbol%", symbol);
|
m_layout_label->replace_token("%symbol%", symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dwm_module::reconnect_dwm() -> bool {
|
bool dwm_module::reconnect_dwm() {
|
||||||
try {
|
try {
|
||||||
if (!m_ipc->is_main_socket_connected()) {
|
if (!m_ipc->is_main_socket_connected()) {
|
||||||
m_log.notice("%s: Attempting to reconnect to main socket", name());
|
m_log.notice("%s: Attempting to reconnect to main socket", name());
|
||||||
|
Loading…
Reference in New Issue
Block a user