On the way to adding attach service surface
[apps/agl-service-windowmanager.git] / src / window_manager.hpp
index 189d249..7bd0802 100644 (file)
 #include <memory>
 #include <unordered_map>
 #include <experimental/optional>
-#include "controller_hooks.hpp"
-//#include "layers.hpp"
-// #include "layout.hpp"
-//#include "wayland_ivi_wm.hpp"
 #include "result.hpp"
 #include "pm_wrapper.hpp"
 #include "util.hpp"
@@ -38,16 +34,6 @@ extern "C"
 
 struct json_object;
 
-namespace wl
-{
-struct display;
-}
-
-namespace compositor
-{
-struct controller;
-}
-
 namespace wm
 {
 
@@ -143,6 +129,12 @@ struct id_allocator
     }
 };
 
+struct TmpClient
+{
+    std::string   appid;
+    unsigned pid;
+};
+
 class WindowManager
 {
   public:
@@ -181,20 +173,20 @@ class WindowManager
 
     result<int> api_request_surface(char const *appid, char const *role);
     char const *api_request_surface(char const *appid, char const *role, char const *ivi_id);
-    bool api_set_role(char const *appid, char const *role, unsigned pid);
+    bool api_set_role(char const *appid, char const *role);
     void api_activate_surface(char const *appid, char const *role, char const *drawing_area, const reply_func &reply);
     void api_deactivate_surface(char const *appid, char const *role, const reply_func &reply);
     void api_enddraw(char const *appid, char const *role);
+    bool api_client_set_render_order(const char *appid, const std::vector<std::string> &render_order);
+    std::string api_client_attach_service_surface(const char* appid, const char* dest, const char* service_surface);
     result<json_object *> api_get_display_info();
     result<json_object *> api_get_area_info(char const *role);
-    void api_ping();
     void send_event(char const *evname, char const *label);
     void send_event(char const *evname, char const *label, char const *area, int x, int y, int w, int h);
 
     // Events from the compositor we are interested in
-    void surface_created(uint32_t surface_id);
-    void surface_removed(uint32_t surface_id);
-    void surface_properties(uint32_t surface_id, uint32_t pid);
+    void surface_created(unsigned pid, unsigned surface_id);
+    void surface_removed(unsigned surface_id);
 
     void removeClient(const std::string &appid);
     void exceptionProcessForTransition();
@@ -217,10 +209,6 @@ class WindowManager
     std::map<const char *, struct afb_event> map_afb_event;
 
   private:
-    int init_layers();
-    void surface_set_layout(int surface_id, const std::string& area = "");
-    void layout_commit();
-
     // WM Events to clients
     void emit_activated(char const *label);
     void emit_deactivated(char const *label);
@@ -239,9 +227,6 @@ class WindowManager
     WMError startTransition(unsigned req_num);
 
     WMError doEndDraw(unsigned req_num);
-    WMError layoutChange(const WMAction &action);
-    WMError visibilityChange(const WMAction &action);
-    WMError setSurfaceSize(unsigned surface, const std::string& area);
     void    emitScreenUpdated(unsigned req_num);
 
     void setTimer();
@@ -253,21 +238,18 @@ class WindowManager
     const char *check_surface_exist(const char *role);
 
   private:
-    std::unordered_map<std::string, struct rect> area2size;
     std::unordered_map<std::string, std::string> roleold2new;
     std::unordered_map<std::string, std::string> rolenew2old;
     std::shared_ptr<LayerControl> lc;
     PMWrapper pmw;
 
-    struct controller_hooks chooks;
     // ID allocation and proxy methods for lookup
     struct id_allocator id_alloc;
     // Surface are info (x, y, w, h)
     rect_map area_info;
     // FOR CES DEMO
-    std::vector<int> surface_bg;
-    std::unordered_map<unsigned, std::string> tmp_surface2app;
-
+    std::unordered_map<unsigned, struct TmpClient> tmp_surface2app;
+    std::vector<struct TmpClient> tmp_apps;
     static const char* kDefaultOldRoleDb;
 };