refactor(bar): onRealize, onMap

This commit is contained in:
Alex
2019-05-25 17:50:45 +02:00
parent 07147878a9
commit 2a9fa1a4b9
4 changed files with 99 additions and 86 deletions

View File

@ -38,13 +38,13 @@ class Bar {
bool vertical = false;
private:
static constexpr const char* MIN_HEIGHT_MSG =
static constexpr const char *MIN_HEIGHT_MSG =
"Requested height: {} exceeds the minimum height: {} required by the modules";
static constexpr const char* MIN_WIDTH_MSG =
static constexpr const char *MIN_WIDTH_MSG =
"Requested width: {} exceeds the minimum width: {} required by the modules";
static constexpr const char* BAR_SIZE_MSG =
static constexpr const char *BAR_SIZE_MSG =
"Bar configured (width: {}, height: {}) for output: {}";
static constexpr const char* SIZE_DEFINED =
static constexpr const char *SIZE_DEFINED =
"{} size is defined in the config file so it will stay like that";
static void layerSurfaceHandleConfigure(void *, struct zwlr_layer_surface_v1 *, uint32_t,
uint32_t, uint32_t);
@ -52,6 +52,8 @@ class Bar {
void destroyOutput();
void onConfigure(GdkEventConfigure *ev);
void onRealize();
void onMap(GdkEventAny *ev);
void setMarginsAndZone(uint32_t height, uint32_t width);
auto setupWidgets() -> void;
void getModules(const Factory &, const std::string &);
@ -66,6 +68,7 @@ class Bar {
} margins_;
uint32_t width_ = 0;
uint32_t height_ = 1;
uint8_t anchor_;
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;

View File

@ -26,4 +26,4 @@ class Mode : public ALabel, public sigc::trackable {
util::JsonParser parser_;
};
} // namespace waybar::modules::sway
} // namespace waybar::modules::sway

View File

@ -37,9 +37,9 @@ class Workspaces : public IModule, public sigc::trackable {
std::vector<Json::Value> workspaces_;
std::vector<std::string> workspaces_order_;
waybar::util::SleeperThread thread_;
Ipc ipc_;
std::mutex mutex_;
Gtk::Box box_;
Ipc ipc_;
util::JsonParser parser_;
bool scrolling_;
std::unordered_map<std::string, Gtk::Button> buttons_;