refactor(Workspaces, IPC): no more mutex in the workspaces modules, moved to the IPC client for a proper handling

This commit is contained in:
Alex
2019-04-19 16:48:02 +02:00
parent e77c155ede
commit cbb6f2a307
4 changed files with 131 additions and 174 deletions

View File

@ -21,25 +21,24 @@ class Workspaces : public IModule {
private:
void onCmd(const struct Ipc::ipc_response);
void onEvent(const struct Ipc::ipc_response);
void worker();
void addWorkspace(const Json::Value&);
bool filterButtons();
Gtk::Button& addButton(const Json::Value&);
void onButtonReady(const Json::Value&, Gtk::Button&);
std::string getIcon(const std::string&, const Json::Value&);
bool handleScroll(GdkEventScroll*);
const std::string getCycleWorkspace(const Json::Value& workspaces, uint8_t current,
bool prev) const;
uint16_t getWorkspaceIndex(const Json::Value& workspaces, const std::string& name) const;
const std::string getCycleWorkspace(std::vector<Json::Value>::iterator, bool prev) const;
uint16_t getWorkspaceIndex(const std::string& name) const;
std::string trimWorkspaceName(std::string);
const Json::Value getWorkspaces();
const Bar& bar_;
const Json::Value& config_;
Json::Value workspaces_;
std::vector<Json::Value> workspaces_;
waybar::util::SleeperThread thread_;
Gtk::Box box_;
util::JsonParser parser_;
Ipc ipc_;
std::mutex mutex_;
bool scrolling_;
std::unordered_map<std::string, Gtk::Button> buttons_;
};