feat(Bar): handle widget size changes

This commit is contained in:
Alex
2019-04-24 12:37:24 +02:00
parent 90d89fe974
commit 311c34ecbc
28 changed files with 175 additions and 137 deletions

View File

@ -10,7 +10,7 @@ namespace waybar {
class ALabel : public IModule {
public:
ALabel(const Json::Value &, const std::string format, uint16_t interval = 0);
ALabel(const Json::Value &, const std::string &format, uint16_t interval = 0);
virtual ~ALabel();
virtual auto update() -> void;
virtual std::string getIcon(uint16_t, const std::string &alt = "");

View File

@ -56,7 +56,7 @@ class Bar {
void setupAltFormatKeyForModuleList(const char *module_list_name);
uint32_t width_ = 0;
uint32_t height_ = 30;
uint32_t height_ = 1;
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;

View File

@ -25,10 +25,10 @@ class Client {
std::vector<std::unique_ptr<Bar>> bars;
private:
Client();
Client() = default;
void setupConfigs(const std::string &config, const std::string &style);
void bindInterfaces();
const std::string getValidPath(std::vector<std::string> paths);
const std::string getValidPath(const std::vector<std::string> &paths);
void handleOutput(std::unique_ptr<struct waybar_output> &output);
bool isValidOutput(const Json::Value &config, std::unique_ptr<struct waybar_output> &output);
auto setupConfig() -> void;

View File

@ -20,7 +20,7 @@ namespace waybar::modules::SNI {
class Item : public sigc::trackable {
public:
Item(std::string, std::string, const Json::Value&);
Item(const std::string&, const std::string&, const Json::Value&);
~Item() = default;
std::string bus_name;
@ -58,7 +58,7 @@ class Item : public sigc::trackable {
void updateImage();
Glib::RefPtr<Gdk::Pixbuf> extractPixBuf(GVariant* variant);
Glib::RefPtr<Gdk::Pixbuf> getIconByName(std::string name, int size);
Glib::RefPtr<Gdk::Pixbuf> getIconByName(const std::string& name, int size);
static void onMenuDestroyed(Item* self);
bool makeMenu(GdkEventButton* const& ev);
bool handleClick(GdkEventButton* const& /*ev*/);

View File

@ -24,8 +24,8 @@ class Ipc {
Json::Value payload;
};
sigc::signal<void, const struct ipc_response> signal_event;
sigc::signal<void, const struct ipc_response> signal_cmd;
sigc::signal<void, const struct ipc_response&> signal_event;
sigc::signal<void, const struct ipc_response&> signal_cmd;
void sendCmd(uint32_t type, const std::string &payload = "");
void subscribe(const std::string &payload);

View File

@ -16,7 +16,7 @@ class Mode : public ALabel {
auto update() -> void;
private:
void onEvent(const struct Ipc::ipc_response);
void onEvent(const struct Ipc::ipc_response&);
void worker();
const Bar& bar_;

View File

@ -17,10 +17,10 @@ class Window : public ALabel {
auto update() -> void;
private:
void onEvent(const struct Ipc::ipc_response);
void onCmd(const struct Ipc::ipc_response);
void onEvent(const struct Ipc::ipc_response&);
void onCmd(const struct Ipc::ipc_response&);
void worker();
std::tuple<int, std::string> getFocusedNode(Json::Value nodes);
std::tuple<int, std::string> getFocusedNode(const Json::Value& nodes);
void getFocusedWindow();
const Bar& bar_;

View File

@ -19,8 +19,8 @@ class Workspaces : public IModule {
operator Gtk::Widget&();
private:
void onCmd(const struct Ipc::ipc_response);
void onEvent(const struct Ipc::ipc_response);
void onCmd(const struct Ipc::ipc_response&);
void onEvent(const struct Ipc::ipc_response&);
void worker();
bool filterButtons();
Gtk::Button& addButton(const Json::Value&);