Incorporate Reviews
This commit is contained in:
parent
57d364a2fc
commit
211b0bbfd8
11 changed files with 55 additions and 71 deletions
|
@ -13,7 +13,7 @@ using std::map;
|
|||
namespace drawtypes {
|
||||
class label;
|
||||
using label_t = shared_ptr<label>;
|
||||
}
|
||||
} // namespace drawtypes
|
||||
using namespace drawtypes;
|
||||
|
||||
class builder {
|
||||
|
|
|
@ -29,12 +29,12 @@ class parser {
|
|||
void codeblock(string&& data, const bar_settings& bar);
|
||||
size_t text(string&& data);
|
||||
|
||||
unsigned int parse_color(const string& s, unsigned int fallback = 0);
|
||||
int parse_fontindex(const string& s);
|
||||
attribute parse_attr(const char attr);
|
||||
static unsigned int parse_color(const string& s, unsigned int fallback = 0);
|
||||
static int parse_fontindex(const string& s);
|
||||
static attribute parse_attr(const char attr);
|
||||
mousebtn parse_action_btn(const string& data);
|
||||
string parse_action_cmd(string&& data);
|
||||
controltag parse_control(const string& data);
|
||||
static string parse_action_cmd(string&& data);
|
||||
static controltag parse_control(const string& data);
|
||||
|
||||
private:
|
||||
signal_emitter& m_sig;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <bitset>
|
||||
#include <cairo/cairo.h>
|
||||
#include <bitset>
|
||||
#include <memory>
|
||||
|
||||
#include "cairo/fwd.hpp"
|
||||
|
@ -41,8 +41,8 @@ class renderer
|
|||
using make_type = unique_ptr<renderer>;
|
||||
static make_type make(const bar_settings& bar);
|
||||
|
||||
explicit renderer(
|
||||
connection& conn, signal_emitter& sig, const config&, const logger& logger, const bar_settings& bar, background_manager& background_manager);
|
||||
explicit renderer(connection& conn, signal_emitter& sig, const config&, const logger& logger, const bar_settings& bar,
|
||||
background_manager& background_manager);
|
||||
~renderer();
|
||||
|
||||
xcb_window_t window() const;
|
||||
|
|
|
@ -9,13 +9,6 @@
|
|||
|
||||
POLYBAR_NS
|
||||
|
||||
// fwd
|
||||
enum class mousebtn;
|
||||
enum class syntaxtag;
|
||||
enum class controltag;
|
||||
enum class alignment;
|
||||
enum class attribute;
|
||||
|
||||
namespace signals {
|
||||
namespace detail {
|
||||
class signal {
|
||||
|
@ -55,7 +48,7 @@ namespace signals {
|
|||
private:
|
||||
void* m_ptr;
|
||||
};
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
namespace eventqueue {
|
||||
struct start : public detail::base_signal<start> {
|
||||
|
@ -76,7 +69,7 @@ namespace signals {
|
|||
struct check_state : public detail::base_signal<check_state> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
}
|
||||
} // namespace eventqueue
|
||||
|
||||
namespace ipc {
|
||||
struct command : public detail::value_signal<command, string> {
|
||||
|
@ -88,7 +81,7 @@ namespace signals {
|
|||
struct action : public detail::value_signal<action, string> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
}
|
||||
} // namespace ipc
|
||||
|
||||
namespace ui {
|
||||
struct ready : public detail::base_signal<ready> {
|
||||
|
@ -129,13 +122,13 @@ namespace signals {
|
|||
struct update_geometry : public detail::base_signal<update_geometry> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
}
|
||||
} // namespace ui
|
||||
|
||||
namespace ui_tray {
|
||||
struct mapped_clients : public detail::value_signal<mapped_clients, unsigned int> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
}
|
||||
} // namespace ui_tray
|
||||
|
||||
namespace parser {
|
||||
struct change_background : public detail::value_signal<change_background, unsigned int> {
|
||||
|
@ -183,7 +176,7 @@ namespace signals {
|
|||
struct control : public detail::value_signal<control, controltag> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace parser
|
||||
} // namespace signals
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -21,12 +21,12 @@ namespace signals {
|
|||
struct notify_change;
|
||||
struct notify_forcechange;
|
||||
struct check_state;
|
||||
}
|
||||
} // namespace eventqueue
|
||||
namespace ipc {
|
||||
struct command;
|
||||
struct hook;
|
||||
struct action;
|
||||
}
|
||||
} // namespace ipc
|
||||
namespace ui {
|
||||
struct ready;
|
||||
struct changed;
|
||||
|
@ -40,7 +40,7 @@ namespace signals {
|
|||
struct request_snapshot;
|
||||
struct update_background;
|
||||
struct update_geometry;
|
||||
}
|
||||
} // namespace ui
|
||||
namespace ui_tray {
|
||||
struct mapped_clients;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ namespace signals {
|
|||
struct action_end;
|
||||
struct text;
|
||||
struct control;
|
||||
}
|
||||
}
|
||||
} // namespace parser
|
||||
} // namespace signals
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "modules/meta/base.hpp"
|
||||
#include "components/builder.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/logger.hpp"
|
||||
#include "events/signal.hpp"
|
||||
#include "events/signal_emitter.hpp"
|
||||
#include "modules/meta/base.hpp"
|
||||
|
||||
POLYBAR_NS
|
||||
|
||||
|
@ -178,6 +178,6 @@ namespace modules {
|
|||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
} // namespace modules
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "components/builder.hpp"
|
||||
#include "drawtypes/label.hpp"
|
||||
#include "utils/color.hpp"
|
||||
#include "utils/math.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/time.hpp"
|
||||
POLYBAR_NS
|
||||
|
@ -488,8 +487,7 @@ string builder::get_label_text(const label_t& label) {
|
|||
if (maxlen > 0 && string_util::char_len(text) > maxlen) {
|
||||
if (label->m_ellipsis) {
|
||||
text = string_util::utf8_truncate(std::move(text), maxlen - 3) + "...";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
text = string_util::utf8_truncate(std::move(text), maxlen);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "settings.hpp"
|
||||
#include "utils/color.hpp"
|
||||
#include "utils/factory.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/math.hpp"
|
||||
#include "utils/memory.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
|
@ -160,8 +158,7 @@ void parser::codeblock(string&& data, const bar_settings& bar) {
|
|||
m_sig.emit(attribute_toggle{parse_attr(value[0])});
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
{
|
||||
case 'A': {
|
||||
bool has_btn_id = (data[0] != ':');
|
||||
if (isdigit(data[0]) || !has_btn_id) {
|
||||
value = parse_action_cmd(data.substr(has_btn_id ? 1 : 0));
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
#include "events/signal_emitter.hpp"
|
||||
#include "events/signal_receiver.hpp"
|
||||
#include "utils/factory.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/math.hpp"
|
||||
#include "x11/atoms.hpp"
|
||||
#include "x11/background_manager.hpp"
|
||||
#include "x11/connection.hpp"
|
||||
#include "x11/extensions/all.hpp"
|
||||
#include "x11/winspec.hpp"
|
||||
|
||||
POLYBAR_NS
|
||||
|
@ -35,15 +33,14 @@ renderer::make_type renderer::make(const bar_settings& bar) {
|
|||
/**
|
||||
* Construct renderer instance
|
||||
*/
|
||||
renderer::renderer(
|
||||
connection& conn, signal_emitter& sig, const config& conf, const logger& logger, const bar_settings& bar, background_manager& background)
|
||||
renderer::renderer(connection& conn, signal_emitter& sig, const config& conf, const logger& logger,
|
||||
const bar_settings& bar, background_manager& background)
|
||||
: m_connection(conn)
|
||||
, m_sig(sig)
|
||||
, m_conf(conf)
|
||||
, m_log(logger)
|
||||
, m_bar(forward<const bar_settings&>(bar))
|
||||
, m_rect(m_bar.inner_area()) {
|
||||
|
||||
m_sig.attach(this);
|
||||
m_log.trace("renderer: Get TrueColor visual");
|
||||
{
|
||||
|
@ -301,7 +298,6 @@ void renderer::end() {
|
|||
fill_background();
|
||||
}
|
||||
|
||||
|
||||
// For pseudo-transparency, capture the contents of the rendered bar and
|
||||
// composite it against the desktop wallpaper. This way transparent parts of
|
||||
// the bar will be filled by the wallpaper creating illusion of transparency.
|
||||
|
|
|
@ -51,6 +51,6 @@ namespace modules {
|
|||
|
||||
return m_builder->flush();
|
||||
}
|
||||
}
|
||||
} // namespace modules
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
Loading…
Reference in a new issue