diff options
Diffstat (limited to 'src/wm_client.hpp')
-rw-r--r-- | src/wm_client.hpp | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/wm_client.hpp b/src/wm_client.hpp index 259d504..3ffa786 100644 --- a/src/wm_client.hpp +++ b/src/wm_client.hpp @@ -20,21 +20,17 @@ #include <vector> #include <string> #include <unordered_map> +#include "util.hpp" +#include "wm_error.hpp" extern "C" { -#define AFB_BINDING_VERSION 2 #include <afb/afb-binding.h> } namespace wm { -enum WM_CLIENT_ERROR_EVENT -{ - UNKNOWN_ERROR -}; - class WMClient { public: @@ -42,35 +38,48 @@ class WMClient WMClient(const std::string &appid, unsigned layer, unsigned surface, const std::string &role); WMClient(const std::string &appid, const std::string &role); - virtual ~WMClient(); + WMClient(const std::string &appid, unsigned layer, const std::string &role); + WMClient(const std::string &appid, unsigned layer, + const std::string& layer_name, unsigned surface, const std::string &role); + ~WMClient() = default; std::string appID() const; - unsigned surfaceID(const std::string &role) const; + std::string role() const; unsigned layerID() const; - std::string role(unsigned surface) const; - void registerLayer(unsigned layer); - bool addSurface(const std::string& role, unsigned surface); + unsigned surfaceID() const; + void registerSurface(unsigned surface); + std::string area() const {return this->app_area;}; + void setArea(const std::string area) {this->app_area = area;} + WMError addSurface(unsigned surface); + bool isSourceSizeSet(); + void setSurfaceSizeCorrectly(); bool removeSurfaceIfExist(unsigned surface); - bool removeRole(const std::string& role); -#if GTEST_ENABLED - bool subscribe(afb_req req, const std::string &event_name); - void emitError(WM_CLIENT_ERROR_EVENT ev); -#endif + bool subscribe(afb_req_t req, const std::string &event_name); + void emitActive(bool active); + void emitVisible(bool visible); + void emitSyncDraw(const std::string& area, struct rect& r); + void emitFlushDraw(); + void emitError(WMError error); void dumpInfo(); private: std::string id; unsigned layer; + bool is_source_set; + std::string main_role; + std::string app_area; + unsigned surface; // currently, main application has only one surface. + //std::vector<std::string> role_list; std::unordered_map<std::string, unsigned> role2surface; #if GTEST_ENABLED // This is for unit test. afb_make_event occurs sig11 if call not in afb-binding - std::unordered_map<std::string, std::string> event2list; + std::unordered_map<std::string, std::string> evname2afb_event; #else - std::unordered_map<std::string, struct afb_event> event2list; + std::unordered_map<std::string, afb_event_t> evname2afb_event; #endif }; } // namespace wm -#endif
\ No newline at end of file +#endif |