#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"
struct json_object;
-namespace wl
-{
-struct display;
-}
-
-namespace compositor
-{
-struct controller;
-}
-
namespace wm
{
}
};
+struct TmpClient
+{
+ std::string appid;
+ unsigned pid;
+};
+
class WindowManager
{
public:
Event_Val_Max = Event_Error,
};
- const std::vector<const char *> kListEventName{
- "active",
- "inactive",
- "visible",
- "invisible",
- "syncDraw",
- "flushDraw",
- "screenUpdated",
- "error"};
-
- struct controller_hooks chooks;
-
- // ID allocation and proxy methods for lookup
- struct id_allocator id_alloc;
-
- std::map<const char *, struct afb_event> map_afb_event;
-
- // Surface are info (x, y, w, h)
- rect_map area_info;
-
- // FOR CES DEMO
- std::vector<int> surface_bg;
-
explicit WindowManager();
~WindowManager() = default;
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();
void startTransitionWrapper(std::vector<WMAction> &actions);
void processError(WMError error);
- private:
- optional<int> lookup_id(char const *name);
- optional<std::string> lookup_name(int id);
- int init_layers();
- void surface_set_layout(int surface_id, const std::string& area = "");
- void layout_commit();
+ const std::vector<const char *> kListEventName{
+ "active",
+ "inactive",
+ "visible",
+ "invisible",
+ "syncDraw",
+ "flushDraw",
+ "screenUpdated",
+ "error"};
+ std::map<const char *, struct afb_event> map_afb_event;
+ private:
// WM Events to clients
void emit_activated(char const *label);
void emit_deactivated(char const *label);
void deactivate(int id);
WMError setRequest(const std::string &appid, const std::string &role, const std::string &area,
Task task, unsigned *req_num);
- WMError doTransition(unsigned sequence_number);
WMError checkPolicy(unsigned req_num);
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();
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;
+ // 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::unordered_map<unsigned, struct TmpClient> tmp_surface2app;
+ std::vector<struct TmpClient> tmp_apps;
static const char* kDefaultOldRoleDb;
};