X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwm_layer_control.hpp;h=db482bf57ecc739fae32b5a345ad8b6a8ddb985b;hb=3ebdf4e37dd3993a48ff73e8ae01325ec033eb1f;hp=18f7359ba7880043dc6d58225559adcf09e2036b;hpb=5d36c79042c3f513392cb765940252acb860b7a9;p=apps%2Fagl-service-windowmanager.git diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp index 18f7359..db482bf 100644 --- a/src/wm_layer_control.hpp +++ b/src/wm_layer_control.hpp @@ -17,39 +17,77 @@ #include #include #include +#include +#include #include #include "wm_error.hpp" #include "util.hpp" namespace wm { -class Screen : public rectangle { +class Screen { + public: + Screen(unsigned w, unsigned h); + ~Screen(); + unsigned width() { return _width; } + unsigned height() { return _height; } + private: + unsigned _width; + unsigned _height; + unsigned _pysical_width = 0; + unsigned _pysical_height = 0; +}; +class LayerControlCallbacks { + public: + LayerControlCallbacks() {}; + virtual ~LayerControlCallbacks() = default; + LayerControlCallbacks(const LayerControlCallbacks &obj) = default; + + // callback functions + virtual void test(unsigned i) { HMI_DEBUG("test %d", i); } + std::function surfaceCreated; + /* std::function surfaceDestroyed; + std::function layerCreated; + std::function layerDestroyed; */ }; class WMLayer; +class LayerState; class LayerControl { public: explicit LayerControl(const std::string& root); ~LayerControl() = default; - WMError init(); - unsigned getNewLayerID(const std::string& role); + WMError init(const LayerControlCallbacks& cb); + void createNewLayer(unsigned id); + unsigned getNewLayerID(const std::string& role, std::string* layer_name); + struct rect getAreaSize(const std::string& area); + void setupArea(double scaling); + Screen getScreenInfo(); + double scale(); // void setRenderOrder(const std::vector layer_render_order); // std::vector getAllRenderOrder(); // std::vector>& getAllLayers(); // std::vector getRenderOrder(const std::string& layer_name); - WMError updateLayer(WMLayer& wm_layer); - void commitChange(); + WMError updateLayer(LayerState& layer_state); + WMError commitChange(); void undoUpdate(); // Don't use this function. - void dispatchILMEvent(ilmObjectType object, t_ilm_uint id, t_ilm_bool created); + void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created); + void dispatchPropertyChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask); + void dispatchPropertyChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask); private: - WMError load(const std::string& path); + WMError loadLayerSetting(const std::string& path); + WMError loadAreaDb(const std::string& path); + std::vector> wm_layers; + std::unordered_map area2size; unsigned screenID; struct ilmScreenProperties screen_prop; + double scaling; + LayerControlCallbacks cb; }; } // namespace wm \ No newline at end of file