From c3291c967516a188789a860821471d8c872fbb47 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Wed, 22 Aug 2018 13:43:42 +0900 Subject: Fix util function HMI_* To reduce coding, change HMI_* Change-Id: Ib28b6a3c2756253e665498e459f5e1e165095941 Signed-off-by: Kazumasa Mitsunari --- src/applist.cpp | 12 ++--- src/layers.cpp | 6 +-- src/main.cpp | 34 ++++++------- src/pm_wrapper.cpp | 24 ++++----- src/util.hpp | 10 ++-- src/wayland_ivi_wm.cpp | 71 +++++++++++++-------------- src/window_manager.cpp | 130 ++++++++++++++++++++++++------------------------- src/window_manager.hpp | 10 ++-- src/wm_client.cpp | 16 +++--- src/wm_layer.cpp | 8 +-- 10 files changed, 162 insertions(+), 159 deletions(-) diff --git a/src/applist.cpp b/src/applist.cpp index 0267eb7..391a3ce 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -82,7 +82,7 @@ void AppList::removeClient(const string &appid) { std::lock_guard lock(this->mtx); this->app2client.erase(appid); - HMI_INFO("wm", "Remove client %s", appid.c_str()); + HMI_INFO("Remove client %s", appid.c_str()); } /** @@ -111,7 +111,7 @@ void AppList::removeSurface(unsigned surface){ { ret = x.second->removeSurfaceIfExist(surface); if(ret){ - HMI_DEBUG("wm", "remove surface %d from Client %s finish", + HMI_DEBUG("remove surface %d from Client %s finish", surface, x.second->appID().c_str()); break; } @@ -189,7 +189,7 @@ WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface) }); if (fwd_itr != this->floating_surfaces.cend()) { - HMI_INFO("wm", "pop floating surface: %d", *surface); + HMI_INFO("pop floating surface: %d", *surface); } this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end()); return ret; @@ -199,7 +199,7 @@ WMError AppList::popFloatingSurface(unsigned pid, unsigned *surface) WMError AppList::popFloatingSurface(const string &appid, unsigned *surface) { - HMI_ERROR("wm", "This function is not implemented"); + HMI_ERROR("This function is not implemented"); return WMError::SUCCESS; } @@ -223,7 +223,7 @@ void AppList::removeFloatingSurface(unsigned surface) return x.surface_id == surface; }); if(fwd_itr != this->floating_surfaces.cend()){ - HMI_INFO("wm", "remove floating surface: %d", surface); + HMI_INFO("remove floating surface: %d", surface); } this->floating_surfaces.erase(fwd_itr, this->floating_surfaces.end()); } @@ -231,7 +231,7 @@ void AppList::removeFloatingSurface(unsigned surface) WMError AppList::appendRole(const string &id, const string &role, unsigned surface) { WMError wm_err = WMError::NO_ENTRY; - HMI_ERROR("wm", "This function is disabled"); + HMI_ERROR("This function is disabled"); /* if (this->contains(id)) { auto x = this->lookUpClient(id); diff --git a/src/layers.cpp b/src/layers.cpp index db1588b..05d404d 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -58,7 +58,7 @@ layer::layer(nlohmann::json const &j) return l; }); } - HMI_DEBUG("wm", "layer_id:%d is_normal_layout_only:%d\n", + HMI_DEBUG("layer_id:%d is_normal_layout_only:%d\n", this->layer_id, this->is_normal_layout_only); } @@ -136,11 +136,11 @@ optional layer_map::get_layer_id(std::string const &role) auto re = std::regex(r.first); if (std::regex_match(role, re)) { - HMI_DEBUG("wm", "role %s matches layer %d", role.c_str(), r.second); + HMI_DEBUG("role %s matches layer %d", role.c_str(), r.second); return optional(r.second); } } - HMI_DEBUG("wm", "role %s does NOT match any layer", role.c_str()); + HMI_DEBUG("role %s does NOT match any layer", role.c_str()); return nullopt; } diff --git a/src/main.cpp b/src/main.cpp index 7677f14..91dd622 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -65,7 +65,7 @@ int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events, if ((events & EPOLLHUP) != 0) { - HMI_ERROR("wm", "The compositor hung up, dying now."); + HMI_ERROR("The compositor hung up, dying now."); delete g_afb_instance; g_afb_instance = nullptr; goto error; @@ -98,17 +98,17 @@ error: int _binding_init() { - HMI_NOTICE("wm", "WinMan ver. %s", WINMAN_VERSION_STRING); + HMI_NOTICE("WinMan ver. %s", WINMAN_VERSION_STRING); if (g_afb_instance != nullptr) { - HMI_ERROR("wm", "Wayland context already initialized?"); + HMI_ERROR("Wayland context already initialized?"); return 0; } if (getenv("XDG_RUNTIME_DIR") == nullptr) { - HMI_ERROR("wm", "Environment variable XDG_RUNTIME_DIR not set"); + HMI_ERROR("Environment variable XDG_RUNTIME_DIR not set"); goto error; } @@ -121,10 +121,10 @@ int _binding_init() cnt++; if (20 <= cnt) { - HMI_ERROR("wm", "Could not connect to compositor"); + HMI_ERROR("Could not connect to compositor"); goto error; } - HMI_ERROR("wm", "Wait to start weston ..."); + HMI_ERROR("Wait to start weston ..."); sleep(1); delete g_afb_instance; g_afb_instance = new afb_instance; @@ -133,7 +133,7 @@ int _binding_init() if (g_afb_instance->init() == -1) { - HMI_ERROR("wm", "Could not connect to compositor"); + HMI_ERROR("Could not connect to compositor"); goto error; } @@ -143,7 +143,7 @@ int _binding_init() display_event_callback, g_afb_instance); if (ret < 0) { - HMI_ERROR("wm", "Could not initialize afb_instance event handler: %d", -ret); + HMI_ERROR("Could not initialize afb_instance event handler: %d", -ret); goto error; } } @@ -166,7 +166,7 @@ int binding_init() noexcept } catch (std::exception &e) { - HMI_ERROR("wm", "Uncaught exception in binding_init(): %s", e.what()); + HMI_ERROR("Uncaught exception in binding_init(): %s", e.what()); } return -1; } @@ -178,7 +178,7 @@ static void cbRemoveClientCtxt(void *data) { return; } - HMI_DEBUG("wm", "remove app %s", ctxt->name.c_str()); + HMI_DEBUG("remove app %s", ctxt->name.c_str()); // Policy Manager does not know this app was killed, // so notify it by deactivate request. @@ -198,7 +198,7 @@ static void createSecurityContext(afb_req req, const char* appid, const char* ro // Create Security Context at first time const char *new_role = g_afb_instance->wmgr.convertRoleOldToNew(role); WMClientCtxt *ctxt = new WMClientCtxt(appid, new_role); - HMI_DEBUG("wm", "create session for %s", ctxt->name.c_str()); + HMI_DEBUG("create session for %s", ctxt->name.c_str()); afb_req_session_set_LOA(req, 1); afb_req_context_set(req, ctxt, cbRemoveClientCtxt); } @@ -318,7 +318,7 @@ void windowmanager_setrole(afb_req req) noexcept json_object *j_pid = nullptr; if (json_object_object_get_ex(jreq, "pid", &j_pid)) { - HMI_DEBUG("wm", "PID is set"); + HMI_DEBUG("PID is set"); char const *a_pid = json_object_get_string(j_pid); pid = std::stol(a_pid); } @@ -373,7 +373,7 @@ void windowmanager_activatewindow(afb_req req) noexcept [&req](const char *errmsg) { if (errmsg != nullptr) { - HMI_ERROR("wm", errmsg); + HMI_ERROR(errmsg); afb_req_fail(req, "failed", errmsg); return; } @@ -382,7 +382,7 @@ void windowmanager_activatewindow(afb_req req) noexcept } catch (std::exception &e) { - HMI_WARNING("wm", "failed: Uncaught exception while calling activatesurface: %s", e.what()); + HMI_WARNING("failed: Uncaught exception while calling activatesurface: %s", e.what()); g_afb_instance->wmgr.exceptionProcessForTransition(); return; } @@ -412,7 +412,7 @@ void windowmanager_deactivatewindow(afb_req req) noexcept [&req](const char *errmsg) { if (errmsg != nullptr) { - HMI_ERROR("wm", errmsg); + HMI_ERROR(errmsg); afb_req_fail(req, "failed", errmsg); return; } @@ -421,7 +421,7 @@ void windowmanager_deactivatewindow(afb_req req) noexcept } catch (std::exception &e) { - HMI_WARNING("wm", "failed: Uncaught exception while calling deactivatesurface: %s", e.what()); + HMI_WARNING("failed: Uncaught exception while calling deactivatesurface: %s", e.what()); g_afb_instance->wmgr.exceptionProcessForTransition(); return; } @@ -452,7 +452,7 @@ void windowmanager_enddraw(afb_req req) noexcept } catch (std::exception &e) { - HMI_WARNING("wm", "failed: Uncaught exception while calling enddraw: %s", e.what()); + HMI_WARNING("failed: Uncaught exception while calling enddraw: %s", e.what()); g_afb_instance->wmgr.exceptionProcessForTransition(); return; } diff --git a/src/pm_wrapper.cpp b/src/pm_wrapper.cpp index 69b6a16..efc6c64 100644 --- a/src/pm_wrapper.cpp +++ b/src/pm_wrapper.cpp @@ -33,7 +33,7 @@ static void onStateTransitioned(json_object *json_out) static void onError(json_object *json_out) { - HMI_DEBUG("wm", "error message from PolicyManager:%s", + HMI_DEBUG("error message from PolicyManager:%s", json_object_get_string(json_out)); g_context->processError(); @@ -125,7 +125,7 @@ void PMWrapper::updateStates(json_object *json_out) { std::vector actions; - HMI_DEBUG("wm", "json_out dump:%s", json_object_get_string(json_out)); + HMI_DEBUG("json_out dump:%s", json_object_get_string(json_out)); this->createLayoutChangeAction(json_out, actions); @@ -138,12 +138,12 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vectorprvlayer2rolestate[layer_name] = this->crrlayer2rolestate[layer_name]; @@ -180,13 +180,13 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vectorfirst.c_str(), i_prv->second.c_str()); // If current role exists in previous and area is different with previous if (area_name != i_prv->second) { - HMI_DEBUG("wm", "current role exists in previous and area is different with previous"); + HMI_DEBUG("current role exists in previous and area is different with previous"); // Set activate action bool end_draw_finished = false; @@ -232,7 +232,7 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vectorsecond(this->proxy.get(), name, v); } - HMI_DEBUG("wm", "wl::registry @ %p global n %u i %s v %u", this->proxy.get(), name, + HMI_DEBUG("wl::registry @ %p global n %u i %s v %u", this->proxy.get(), name, iface, v); } @@ -172,7 +171,7 @@ void output::geometry(int32_t x, int32_t y, int32_t pw, int32_t ph, void output::mode(uint32_t flags, int32_t w, int32_t h, int32_t r) { - HMI_DEBUG("wm", "wl::output %s @ %p f %x w %i h %i r %i", __func__, + HMI_DEBUG("wl::output %s @ %p f %x w %i h %i r %i", __func__, this->proxy.get(), flags, w, h, r); if ((flags & WL_OUTPUT_MODE_CURRENT) != 0u) { @@ -184,7 +183,7 @@ void output::mode(uint32_t flags, int32_t w, int32_t h, int32_t r) void output::done() { - HMI_DEBUG("wm", "wl::output %s @ %p done", __func__, this->proxy.get()); + HMI_DEBUG("wl::output %s @ %p done", __func__, this->proxy.get()); // Pivot and flipped if (this->transform == WL_OUTPUT_TRANSFORM_90 || this->transform == WL_OUTPUT_TRANSFORM_270 || @@ -198,7 +197,7 @@ void output::done() void output::scale(int32_t factor) { - HMI_DEBUG("wm", "wl::output %s @ %p f %i", __func__, this->proxy.get(), factor); + HMI_DEBUG("wl::output %s @ %p f %i", __func__, this->proxy.get(), factor); } } // namespace wl @@ -362,14 +361,14 @@ void layer_added(void *data, struct ivi_wm_screen *ivi_wm_screen, uint32_t layer_id) { - HMI_DEBUG("wm", "added layer_id:%d", layer_id); + HMI_DEBUG("added layer_id:%d", layer_id); } void connector_name(void *data, struct ivi_wm_screen *ivi_wm_screen, const char *process_name) { - HMI_DEBUG("wm", "process_name:%s", process_name); + HMI_DEBUG("process_name:%s", process_name); } void screen_error(void *data, @@ -377,7 +376,7 @@ void screen_error(void *data, uint32_t error, const char *message) { - HMI_DEBUG("wm", "screen error:%d message:%s", error, message); + HMI_DEBUG("screen error:%d message:%s", error, message); } constexpr struct ivi_wm_screen_listener screen_listener = { @@ -399,7 +398,7 @@ surface::surface(uint32_t i, struct controller *c) void surface::set_visibility(uint32_t visibility) { - HMI_DEBUG("wm", "compositor::surface id:%d v:%d", this->id, visibility); + HMI_DEBUG("compositor::surface id:%d v:%d", this->id, visibility); ivi_wm_set_surface_visibility(this->parent->proxy.get(), this->id, visibility); } @@ -458,7 +457,7 @@ screen::screen(uint32_t i, struct controller *c, struct wl_output *o) : wayland_proxy(ivi_wm_create_screen(c->proxy.get(), o)), controller_child(c, i) { - HMI_DEBUG("wm", "compositor::screen @ %p id %u o %p", this->proxy.get(), i, o); + HMI_DEBUG("compositor::screen @ %p id %u o %p", this->proxy.get(), i, o); // Add listener for screen ivi_wm_screen_add_listener(this->proxy.get(), &screen_listener, this); @@ -468,7 +467,7 @@ void screen::clear() { ivi_wm_screen_clear(this->proxy.get()); } void screen::screen_created(struct screen *screen, uint32_t id) { - HMI_DEBUG("wm", "compositor::screen @ %p screen %u (%x) @ %p", this->proxy.get(), + HMI_DEBUG("compositor::screen @ %p screen %u (%x) @ %p", this->proxy.get(), id, id, screen); this->id = id; this->parent->screens[id] = screen; @@ -483,7 +482,7 @@ void screen::set_render_order(std::vector const &ro) for (i = 0; i < ro.size(); i++) { - HMI_DEBUG("wm", "compositor::screen @ %p add layer %u", this->proxy.get(), ro[i]); + HMI_DEBUG("compositor::screen @ %p add layer %u", this->proxy.get(), ro[i]); // Add the layer to screen render order at nearest z-position ivi_wm_screen_add_layer(this->proxy.get(), ro[i]); } @@ -537,10 +536,10 @@ void controller::get_surface_properties(uint32_t surface_id, int param) void controller::layer_created(uint32_t id) { - HMI_DEBUG("wm", "compositor::controller @ %p layer %u (%x)", this->proxy.get(), id, id); + HMI_DEBUG("compositor::controller @ %p layer %u (%x)", this->proxy.get(), id, id); if (this->layers.find(id) != this->layers.end()) { - HMI_DEBUG("wm", "WindowManager has created layer %u (%x) already", id, id); + HMI_DEBUG("WindowManager has created layer %u (%x) already", id, id); } else { @@ -551,13 +550,13 @@ void controller::layer_created(uint32_t id) void controller::layer_error_detected(uint32_t object_id, uint32_t error_code, const char *error_text) { - HMI_DEBUG("wm", "compositor::controller @ %p error o %d c %d text %s", + HMI_DEBUG("compositor::controller @ %p error o %d c %d text %s", this->proxy.get(), object_id, error_code, error_text); } void controller::surface_visibility_changed(uint32_t id, int32_t visibility) { - HMI_DEBUG("wm", "compositor::surface %s @ %d v %i", __func__, id, + HMI_DEBUG("compositor::surface %s @ %d v %i", __func__, id, visibility); this->sprops[id].visibility = visibility; this->chooks->surface_visibility(id, visibility); @@ -565,7 +564,7 @@ void controller::surface_visibility_changed(uint32_t id, int32_t visibility) void controller::surface_opacity_changed(uint32_t id, float opacity) { - HMI_DEBUG("wm", "compositor::surface %s @ %d o %f", + HMI_DEBUG("compositor::surface %s @ %d o %f", __func__, id, opacity); this->sprops[id].opacity = opacity; } @@ -574,7 +573,7 @@ void controller::surface_source_rectangle_changed(uint32_t id, int32_t x, int32_t y, int32_t width, int32_t height) { - HMI_DEBUG("wm", "compositor::surface %s @ %d x %i y %i w %i h %i", __func__, + HMI_DEBUG("compositor::surface %s @ %d x %i y %i w %i h %i", __func__, id, x, y, width, height); this->sprops[id].src_rect = rect{width, height, x, y}; } @@ -583,7 +582,7 @@ void controller::surface_destination_rectangle_changed(uint32_t id, int32_t x, int32_t y, int32_t width, int32_t height) { - HMI_DEBUG("wm", "compositor::surface %s @ %d x %i y %i w %i h %i", __func__, + HMI_DEBUG("compositor::surface %s @ %d x %i y %i w %i h %i", __func__, id, x, y, width, height); this->sprops[id].dst_rect = rect{width, height, x, y}; this->chooks->surface_destination_rectangle(id, x, y, width, height); @@ -592,7 +591,7 @@ void controller::surface_destination_rectangle_changed(uint32_t id, int32_t x, void controller::surface_size_changed(uint32_t id, int32_t width, int32_t height) { - HMI_DEBUG("wm", "compositor::surface %s @ %d w %i h %i", __func__, id, + HMI_DEBUG("compositor::surface %s @ %d w %i h %i", __func__, id, width, height); this->sprops[id].size = size{uint32_t(width), uint32_t(height)}; this->surfaces[id]->set_source_rectangle(0, 0, width, height); @@ -600,21 +599,21 @@ void controller::surface_size_changed(uint32_t id, int32_t width, void controller::surface_added_to_layer(uint32_t layer_id, uint32_t surface_id) { - HMI_DEBUG("wm", "compositor::surface %s @ %d l %u", + HMI_DEBUG("compositor::surface %s @ %d l %u", __func__, layer_id, surface_id); } void controller::surface_stats_received(uint32_t surface_id, uint32_t frame_count, uint32_t pid) { - HMI_DEBUG("wm", "compositor::surface %s @ %d f %u pid %u", + HMI_DEBUG("compositor::surface %s @ %d f %u pid %u", __func__, surface_id, frame_count, pid); this->sprops[surface_id].pid = pid; } void controller::surface_created(uint32_t id) { - HMI_DEBUG("wm", "compositor::controller @ %p surface %u (%x)", this->proxy.get(), id, + HMI_DEBUG("compositor::controller @ %p surface %u (%x)", this->proxy.get(), id, id); if (this->surfaces.find(id) == this->surfaces.end()) { @@ -632,7 +631,7 @@ void controller::surface_created(uint32_t id) void controller::surface_destroyed(uint32_t surface_id) { - HMI_DEBUG("wm", "compositor::surface %s @ %d", __func__, surface_id); + HMI_DEBUG("compositor::surface %s @ %d", __func__, surface_id); this->chooks->surface_removed(surface_id); this->sprops.erase(surface_id); this->surfaces.erase(surface_id); @@ -641,19 +640,19 @@ void controller::surface_destroyed(uint32_t surface_id) void controller::surface_error_detected(uint32_t object_id, uint32_t error_code, const char *error_text) { - HMI_DEBUG("wm", "compositor::controller @ %p error o %d c %d text %s", + HMI_DEBUG("compositor::controller @ %p error o %d c %d text %s", this->proxy.get(), object_id, error_code, error_text); } void controller::layer_visibility_changed(uint32_t layer_id, int32_t visibility) { - HMI_DEBUG("wm", "compositor::layer %s @ %d v %i", __func__, layer_id, visibility); + HMI_DEBUG("compositor::layer %s @ %d v %i", __func__, layer_id, visibility); this->lprops[layer_id].visibility = visibility; } void controller::layer_opacity_changed(uint32_t layer_id, float opacity) { - HMI_DEBUG("wm", "compositor::layer %s @ %d o %f", __func__, layer_id, opacity); + HMI_DEBUG("compositor::layer %s @ %d o %f", __func__, layer_id, opacity); this->lprops[layer_id].opacity = opacity; } @@ -661,7 +660,7 @@ void controller::layer_source_rectangle_changed(uint32_t layer_id, int32_t x, int32_t y, int32_t width, int32_t height) { - HMI_DEBUG("wm", "compositor::layer %s @ %d x %i y %i w %i h %i", + HMI_DEBUG("compositor::layer %s @ %d x %i y %i w %i h %i", __func__, layer_id, x, y, width, height); this->lprops[layer_id].src_rect = rect{width, height, x, y}; } @@ -670,14 +669,14 @@ void controller::layer_destination_rectangle_changed(uint32_t layer_id, int32_t x, int32_t y, int32_t width, int32_t height) { - HMI_DEBUG("wm", "compositor::layer %s @ %d x %i y %i w %i h %i", + HMI_DEBUG("compositor::layer %s @ %d x %i y %i w %i h %i", __func__, layer_id, x, y, width, height); this->lprops[layer_id].dst_rect = rect{width, height, x, y}; } void controller::layer_destroyed(uint32_t layer_id) { - HMI_DEBUG("wm", "compositor::layer %s @ %d", __func__, layer_id); + HMI_DEBUG("compositor::layer %s @ %d", __func__, layer_id); this->lprops.erase(layer_id); this->layers.erase(layer_id); } @@ -685,40 +684,40 @@ void controller::layer_destroyed(uint32_t layer_id) void controller::add_proxy_to_sid_mapping(struct ivi_wm *p, uint32_t id) { - HMI_DEBUG("wm", "Add surface proxy mapping for %p (%u)", p, id); + HMI_DEBUG("Add surface proxy mapping for %p (%u)", p, id); this->surface_proxy_to_id[uintptr_t(p)] = id; this->sprops[id].id = id; } void controller::remove_proxy_to_sid_mapping(struct ivi_wm *p) { - HMI_DEBUG("wm", "Remove surface proxy mapping for %p", p); + HMI_DEBUG("Remove surface proxy mapping for %p", p); this->surface_proxy_to_id.erase(uintptr_t(p)); } void controller::add_proxy_to_lid_mapping(struct ivi_wm *p, uint32_t id) { - HMI_DEBUG("wm", "Add layer proxy mapping for %p (%u)", p, id); + HMI_DEBUG("Add layer proxy mapping for %p (%u)", p, id); this->layer_proxy_to_id[uintptr_t(p)] = id; this->lprops[id].id = id; } void controller::remove_proxy_to_lid_mapping(struct ivi_wm *p) { - HMI_DEBUG("wm", "Remove layer proxy mapping for %p", p); + HMI_DEBUG("Remove layer proxy mapping for %p", p); this->layer_proxy_to_id.erase(uintptr_t(p)); } void controller::add_proxy_to_id_mapping(struct wl_output *p, uint32_t id) { - HMI_DEBUG("wm", "Add screen proxy mapping for %p (%u)", p, id); + HMI_DEBUG("Add screen proxy mapping for %p (%u)", p, id); this->screen_proxy_to_id[uintptr_t(p)] = id; } void controller::remove_proxy_to_id_mapping(struct wl_output *p) { - HMI_DEBUG("wm", "Remove screen proxy mapping for %p", p); + HMI_DEBUG("Remove screen proxy mapping for %p", p); this->screen_proxy_to_id.erase(uintptr_t(p)); } diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 8f3236f..38541bd 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -71,7 +71,7 @@ result file_to_json(char const *filename) std::ifstream i(filename); if (i.fail()) { - HMI_DEBUG("wm", "Could not open config file, so use default layer information"); + HMI_DEBUG("Could not open config file, so use default layer information"); j = default_layers_json; } else @@ -84,7 +84,7 @@ result file_to_json(char const *filename) struct result load_layer_map(char const *filename) { - HMI_DEBUG("wm", "loading IDs from %s", filename); + HMI_DEBUG("loading IDs from %s", filename); auto j = file_to_json(filename); if (j.is_err()) @@ -98,7 +98,7 @@ struct result load_layer_map(char const *filename) static int processTimerHandler(sd_event_source *s, uint64_t usec, void *userdata) { - HMI_NOTICE("wm", "Time out occurs because the client replys endDraw slow, so revert the request"); + HMI_NOTICE("Time out occurs because the client replys endDraw slow, so revert the request"); reinterpret_cast(userdata)->timerHandler(); return 0; } @@ -130,7 +130,7 @@ WindowManager::WindowManager(wl::display *d) string lm_setting_path = path; if (!path) { - HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined"); + HMI_ERROR("AFM_APP_INSTALL_DIR is not defined"); } else { @@ -148,13 +148,13 @@ WindowManager::WindowManager(wl::display *d) } else { - HMI_ERROR("wm", "%s", l.err().value()); + HMI_ERROR("%s", l.err().value()); } } } catch (std::exception &e) { - HMI_ERROR("wm", "Loading of configuration failed: %s", e.what()); + HMI_ERROR("Loading of configuration failed: %s", e.what()); } */ } @@ -167,7 +167,7 @@ int WindowManager::init() if (this->layers.mapping.empty()) { - HMI_ERROR("wm", "No surface -> layer mapping loaded"); + HMI_ERROR("No surface -> layer mapping loaded"); return -1; } @@ -257,7 +257,7 @@ result WindowManager::api_request_surface(char const *appid, char const *dr */ lid = this->layers.get_layer_id(string("fallback")); l_id = this->lm->getNewLayerID("fallback"); - HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", role); + HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role); if (!lid) { return Err("Drawing name does not match any role, fallback is disabled"); @@ -278,7 +278,7 @@ result WindowManager::api_request_surface(char const *appid, char const *dr // this->layers.main_surface_name == drawing_name) // { // this->layers.main_surface = id; - // HMI_DEBUG("wm", "Set main_surface id to %u", id); + // HMI_DEBUG("Set main_surface id to %u", id); // } // add client into the db @@ -322,7 +322,7 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr * register drawing_name as fallback and make it displayed. */ lid = this->layers.get_layer_id(string("fallback")); - HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", role); + HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role); if (!lid) { return "Drawing name does not match any role, fallback is disabled"; @@ -341,7 +341,7 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr this->layers.add_surface(sid, *lid); // this surface is already created - HMI_DEBUG("wm", "surface_id is %u, layer_id is %u", sid, *lid); + HMI_DEBUG("surface_id is %u, layer_id is %u", sid, *lid); this->controller->layers[*lid]->add_surface(sid); this->layout_commit(); @@ -382,10 +382,10 @@ bool WindowManager::api_set_role(char const *appid, char const *drawing_name, un * register drawing_name as fallback and make it displayed. */ lid = this->layers.get_layer_id(string("fallback")); - HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", role.c_str()); + HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role.c_str()); if (!lid) { - HMI_ERROR("wm", "Drawing name does not match any role, fallback is disabled"); + HMI_ERROR("Drawing name does not match any role, fallback is disabled"); return ret; } } @@ -401,24 +401,24 @@ bool WindowManager::api_set_role(char const *appid, char const *drawing_name, un //wm_err = g_app_list.popFloatingSurface(id); } if(wm_err != WMError::SUCCESS){ - HMI_ERROR("wm", "No floating surface for app: %s", id.c_str()); + HMI_ERROR("No floating surface for app: %s", id.c_str()); g_app_list.addFloatingClient(id, *lid, role); - HMI_NOTICE("wm", "%s : Waiting for surface creation", id.c_str()); + HMI_NOTICE("%s : Waiting for surface creation", id.c_str()); return ret; } ret = true; if (g_app_list.contains(id)) { - HMI_INFO("wm", "Add role: %s with surface: %d. Client %s has multi surfaces.", + HMI_INFO("Add role: %s with surface: %d. Client %s has multi surfaces.", role.c_str(), surface, id.c_str()); wm_err = g_app_list.appendRole(id, role, surface); if(wm_err != WMError::SUCCESS){ - HMI_INFO("wm", errorDescription(wm_err)); + HMI_INFO(errorDescription(wm_err)); } } else{ - HMI_INFO("wm", "Create new client: %s, surface: %d into layer: %d with role: %s", + HMI_INFO("Create new client: %s, surface: %d into layer: %d with role: %s", id.c_str(), surface, *lid, role.c_str()); g_app_list.addClient(id, *lid, surface, role); } @@ -428,7 +428,7 @@ bool WindowManager::api_set_role(char const *appid, char const *drawing_name, un this->layers.add_surface(surface, *lid); // this surface is already created - HMI_DEBUG("wm", "surface_id is %u, layer_id is %u", surface, *lid); + HMI_DEBUG("surface_id is %u, layer_id is %u", surface, *lid); const auto &o_layer = this->layers.get_layer(*lid); auto rect = o_layer.value().rect; @@ -470,7 +470,7 @@ void WindowManager::api_activate_surface(char const *appid, char const *drawing_ unsigned srfc = client->surfaceID(role); if(srfc == 0) { - HMI_ERROR("wm", "role sould be set with surface"); + HMI_ERROR("role sould be set with surface"); reply("role sould be set with surface"); return; } @@ -484,7 +484,7 @@ void WindowManager::api_activate_surface(char const *appid, char const *drawing_ if(ret != WMError::SUCCESS) { - HMI_ERROR("wm", errorDescription(ret)); + HMI_ERROR(errorDescription(ret)); reply("Failed to set request"); return; } @@ -534,7 +534,7 @@ void WindowManager::api_deactivate_surface(char const *appid, char const *drawin if (ret != WMError::SUCCESS) { - HMI_ERROR("wm", errorDescription(ret)); + HMI_ERROR(errorDescription(ret)); reply("Failed to set request"); return; } @@ -574,7 +574,7 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name) if (!result) { - HMI_ERROR("wm", "%s is not in transition state", id.c_str()); + HMI_ERROR("%s is not in transition state", id.c_str()); return; } @@ -628,7 +628,7 @@ result WindowManager::api_get_display_info() result WindowManager::api_get_area_info(char const *drawing_name) { - HMI_DEBUG("wm", "called"); + HMI_DEBUG("called"); // TODO: application requests by old role, // so convert role old to new @@ -667,7 +667,7 @@ void WindowManager::api_ping() { this->dispatch_pending_events(); } void WindowManager::send_event(char const *evname, char const *label) { - HMI_DEBUG("wm", "%s: %s(%s)", __func__, evname, label); + HMI_DEBUG("%s: %s(%s)", __func__, evname, label); json_object *j = json_object_new_object(); json_object_object_add(j, kKeyDrawingName, json_object_new_string(label)); @@ -675,14 +675,14 @@ void WindowManager::send_event(char const *evname, char const *label) int ret = afb_event_push(this->map_afb_event[evname], j); if (ret != 0) { - HMI_DEBUG("wm", "afb_event_push failed: %m"); + HMI_DEBUG("afb_event_push failed: %m"); } } void WindowManager::send_event(char const *evname, char const *label, char const *area, int x, int y, int w, int h) { - HMI_DEBUG("wm", "%s: %s(%s, %s) x:%d y:%d w:%d h:%d", + HMI_DEBUG("%s: %s(%s, %s) x:%d y:%d w:%d h:%d", __func__, evname, label, area, x, y, w, h); json_object *j_rect = json_object_new_object(); @@ -699,7 +699,7 @@ void WindowManager::send_event(char const *evname, char const *label, char const int ret = afb_event_push(this->map_afb_event[evname], j); if (ret != 0) { - HMI_DEBUG("wm", "afb_event_push failed: %m"); + HMI_DEBUG("afb_event_push failed: %m"); } } @@ -713,12 +713,12 @@ void WindowManager::surface_created(uint32_t surface_id) auto layer_id = this->layers.get_layer_id(surface_id); if (!layer_id) { - HMI_DEBUG("wm", "Newly created surfce %d is not associated with any layer!", + HMI_DEBUG("Newly created surfce %d is not associated with any layer!", surface_id); return; } - HMI_DEBUG("wm", "surface_id is %u, layer_id is %u", surface_id, *layer_id); + HMI_DEBUG("surface_id is %u, layer_id is %u", surface_id, *layer_id); this->controller->layers[*layer_id]->add_surface(surface_id); this->layout_commit(); @@ -726,7 +726,7 @@ void WindowManager::surface_created(uint32_t surface_id) void WindowManager::surface_removed(uint32_t surface_id) { - HMI_DEBUG("wm", "Delete surface_id %u", surface_id); + HMI_DEBUG("Delete surface_id %u", surface_id); this->id_alloc.remove_id(surface_id); this->layers.remove_surface(surface_id); g_app_list.removeSurface(surface_id); @@ -734,7 +734,7 @@ void WindowManager::surface_removed(uint32_t surface_id) void WindowManager::surface_properties(unsigned surface_id, unsigned pid) { - HMI_DEBUG("wm", "get surface properties"); + HMI_DEBUG("get surface properties"); // search pid from surfaceID /*json_object *response; @@ -744,12 +744,12 @@ void WindowManager::surface_properties(unsigned surface_id, unsigned pid) string appid = ""; if(response == nullptr) { - HMI_ERROR("wm", "No runners"); + HMI_ERROR("No runners"); } else { // check appid then add it to the client - HMI_INFO("wm", "Runners:%s", json_object_get_string(response)); + HMI_INFO("Runners:%s", json_object_get_string(response)); int size = json_object_array_length(response); for(int i = 0; i < size; i++) { @@ -773,7 +773,7 @@ void WindowManager::surface_properties(unsigned surface_id, unsigned pid) void WindowManager::removeClient(const string &appid) { - HMI_DEBUG("wm", "Remove clinet %s from list", appid.c_str()); + HMI_DEBUG("Remove clinet %s from list", appid.c_str()); g_app_list.removeClient(appid); } @@ -910,13 +910,13 @@ int WindowManager::init_layers() { if (!this->controller) { - HMI_ERROR("wm", "ivi_controller global not available"); + HMI_ERROR("ivi_controller global not available"); return -1; } if (this->outputs.empty()) { - HMI_ERROR("wm", "no output was set up!"); + HMI_ERROR("no output was set up!"); return -1; } @@ -932,7 +932,7 @@ int WindowManager::init_layers() uint32_t(o->physical_height)}; - HMI_DEBUG("wm", "SCALING: screen (%dx%d), physical (%dx%d)", + HMI_DEBUG("SCALING: screen (%dx%d), physical (%dx%d)", o->width, o->height, o->physical_width, o->physical_height); this->layers.loadAreaDb(); @@ -943,7 +943,7 @@ int WindowManager::init_layers() dp_bg.set_aspect(static_cast(css_bg.w) / css_bg.h); dp_bg.fit(o->width, o->height); dp_bg.center(o->width, o->height); - HMI_DEBUG("wm", "SCALING: CSS BG(%dx%d) -> DDP %dx%d,(%dx%d)", + HMI_DEBUG("SCALING: CSS BG(%dx%d) -> DDP %dx%d,(%dx%d)", css_bg.w, css_bg.h, dp_bg.left(), dp_bg.top(), dp_bg.width(), dp_bg.height()); // Clear scene @@ -959,7 +959,7 @@ int WindowManager::init_layers() auto &l = layers[i.second.layer_id]; l->set_destination_rectangle(dp_bg.left(), dp_bg.top(), dp_bg.width(), dp_bg.height()); l->set_visibility(1); - HMI_DEBUG("wm", "Setting up layer %s (%d) for surface role match \"%s\"", + HMI_DEBUG("Setting up layer %s (%d) for surface role match \"%s\"", i.second.name.c_str(), i.second.layer_id, i.second.role.c_str()); } @@ -978,7 +978,7 @@ void WindowManager::surface_set_layout(int surface_id, const string& area) { if (!this->controller->surface_exists(surface_id)) { - HMI_ERROR("wm", "Surface %d does not exist", surface_id); + HMI_ERROR("Surface %d does not exist", surface_id); return; } @@ -986,7 +986,7 @@ void WindowManager::surface_set_layout(int surface_id, const string& area) if (!o_layer_id) { - HMI_ERROR("wm", "Surface %d is not associated with any layer!", surface_id); + HMI_ERROR("Surface %d is not associated with any layer!", surface_id); return; } @@ -1003,7 +1003,7 @@ void WindowManager::surface_set_layout(int surface_id, const string& area) int w = rect.w; int h = rect.h; - HMI_DEBUG("wm", "surface_set_layout for surface %u on layer %u", surface_id, + HMI_DEBUG("surface_set_layout for surface %u on layer %u", surface_id, layer_id); // set destination to the display rectangle @@ -1015,7 +1015,7 @@ void WindowManager::surface_set_layout(int surface_id, const string& area) this->area_info[surface_id].w = w; this->area_info[surface_id].h = h; - HMI_DEBUG("wm", "Surface %u now on layer %u with rect { %d, %d, %d, %d }", + HMI_DEBUG("Surface %u now on layer %u with rect { %d, %d, %d, %d }", surface_id, layer_id, x, y, w, h); } @@ -1087,16 +1087,16 @@ void WindowManager::activate(int id) this->surface_bg.erase(i); // Remove from BG layer (999) - HMI_DEBUG("wm", "Remove %s(%d) from BG layer", label, id); + HMI_DEBUG("Remove %s(%d) from BG layer", label, id); this->controller->layers[999]->remove_surface(id); // Add to FG layer (1001) - HMI_DEBUG("wm", "Add %s(%d) to FG layer", label, id); + HMI_DEBUG("Add %s(%d) to FG layer", label, id); this->controller->layers[1001]->add_surface(id); for (int j : this->surface_bg) { - HMI_DEBUG("wm", "Stored id:%d", j); + HMI_DEBUG("Stored id:%d", j); } break; } @@ -1134,16 +1134,16 @@ void WindowManager::deactivate(int id) this->surface_bg.push_back(id); // Remove from FG layer (1001) - HMI_DEBUG("wm", "Remove %s(%d) from FG layer", label, id); + HMI_DEBUG("Remove %s(%d) from FG layer", label, id); this->controller->layers[1001]->remove_surface(id); // Add to BG layer (999) - HMI_DEBUG("wm", "Add %s(%d) to BG layer", label, id); + HMI_DEBUG("Add %s(%d) to BG layer", label, id); this->controller->layers[999]->add_surface(id); for (int j : surface_bg) { - HMI_DEBUG("wm", "Stored id:%d", j); + HMI_DEBUG("Stored id:%d", j); } } else @@ -1440,7 +1440,7 @@ void WindowManager::emitScreenUpdated(unsigned req_num) this->map_afb_event[kListEventName[Event_ScreenUpdated]], j); if (ret != 0) { - HMI_DEBUG("wm", "afb_event_push failed: %m"); + HMI_DEBUG("afb_event_push failed: %m"); } } @@ -1448,7 +1448,7 @@ void WindowManager::setTimer() { struct timespec ts; if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0) { - HMI_ERROR("wm", "Could't set time (clock_gettime() returns with error"); + HMI_ERROR("Could't set time (clock_gettime() returns with error"); return; } @@ -1460,7 +1460,7 @@ void WindowManager::setTimer() CLOCK_BOOTTIME, (uint64_t)(ts.tv_sec + kTimeOut) * 1000000ULL, 1, processTimerHandler, this); if (ret < 0) { - HMI_ERROR("wm", "Could't set timer"); + HMI_ERROR("Could't set timer"); } } else @@ -1523,7 +1523,7 @@ const char* WindowManager::convertRoleOldToNew(char const *old_role) new_role = old_role; } - HMI_DEBUG("wm", "old:%s -> new:%s", old_role, new_role); + HMI_DEBUG("old:%s -> new:%s", old_role, new_role); return new_role; } @@ -1532,12 +1532,12 @@ int WindowManager::loadOldRoleDb() { // Get afm application installed dir char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR"); - HMI_DEBUG("wm", "afm_app_install_dir:%s", afm_app_install_dir); + HMI_DEBUG("afm_app_install_dir:%s", afm_app_install_dir); string file_name; if (!afm_app_install_dir) { - HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined"); + HMI_ERROR("AFM_APP_INSTALL_DIR is not defined"); } else { @@ -1549,22 +1549,22 @@ int WindowManager::loadOldRoleDb() int ret = jh::inputJsonFilie(file_name.c_str(), &json_obj); if (0 > ret) { - HMI_ERROR("wm", "Could not open old_role.db, so use default old_role information"); + HMI_ERROR("Could not open old_role.db, so use default old_role information"); json_obj = json_tokener_parse(kDefaultOldRoleDb); } - HMI_DEBUG("wm", "json_obj dump:%s", json_object_get_string(json_obj)); + HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj)); // Perse apps json_object* json_cfg; if (!json_object_object_get_ex(json_obj, "old_roles", &json_cfg)) { - HMI_ERROR("wm", "Parse Error!!"); + HMI_ERROR("Parse Error!!"); return -1; } int len = json_object_array_length(json_cfg); - HMI_DEBUG("wm", "json_cfg len:%d", len); - HMI_DEBUG("wm", "json_cfg dump:%s", json_object_get_string(json_cfg)); + HMI_DEBUG("json_cfg len:%d", len); + HMI_DEBUG("json_cfg dump:%s", json_object_get_string(json_cfg)); for (int i=0; iroleold2new.begin(); itr != this->roleold2new.end(); ++itr) { - HMI_DEBUG("wm", ">>> role old:%s new:%s", + HMI_DEBUG(">>> role old:%s new:%s", itr->first.c_str(), itr->second.c_str()); } @@ -1621,7 +1621,7 @@ const char *WindowManager::check_surface_exist(const char *drawing_name) return "Surface is not on any layer!"; } - HMI_DEBUG("wm", "surface %d is detected", *surface_id); + HMI_DEBUG("surface %d is detected", *surface_id); return nullptr; } diff --git a/src/window_manager.hpp b/src/window_manager.hpp index bd9d134..7591357 100644 --- a/src/window_manager.hpp +++ b/src/window_manager.hpp @@ -30,9 +30,13 @@ #include "request.hpp" #include "wm_error.hpp" #include "wm_layer_control.hpp" +extern "C" +{ +#include +} struct json_object; -struct afb_event; + namespace wl { struct display; @@ -89,7 +93,7 @@ struct id_allocator unsigned sid = this->next++; this->id2name[sid] = name; this->name2id[name] = sid; - HMI_DEBUG("wm", "allocated new id %u with name %s", sid, name.c_str()); + HMI_DEBUG("allocated new id %u with name %s", sid, name.c_str()); return sid; } @@ -98,7 +102,7 @@ struct id_allocator { this->id2name[sid] = name; this->name2id[name] = sid; - HMI_DEBUG("wm", "register id %u with name %s", sid, name.c_str()); + HMI_DEBUG("register id %u with name %s", sid, name.c_str()); return; } diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 757d691..4aecbf4 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -148,10 +148,10 @@ void WMClient::registerLayer(unsigned layer) */ bool WMClient::addSurface(const string &role, unsigned surface) { - HMI_DEBUG("wm", "Add role %s with surface %d", role.c_str(), surface); + HMI_DEBUG("Add role %s with surface %d", role.c_str(), surface); if (0 != this->role2surface.count(role)) { - HMI_NOTICE("wm", "override surfaceID %d with %d", this->role2surface[role], surface); + HMI_NOTICE("override surfaceID %d with %d", this->role2surface[role], surface); } this->role2surface[role] = surface; return true; @@ -164,7 +164,7 @@ bool WMClient::removeSurfaceIfExist(unsigned surface) { if (surface == x.second) { - HMI_INFO("wm", "Remove surface from client %s: role %s, surface: %d", + HMI_INFO("Remove surface from client %s: role %s, surface: %d", this->id.c_str(), x.first.c_str(), x.second); this->role2surface.erase(x.first); ret = true; @@ -189,13 +189,13 @@ bool WMClient::removeRole(const string &role) bool WMClient::subscribe(afb_req req, const string &evname) { if(evname != kKeyError){ - HMI_DEBUG("wm", "error is only enabeled for now"); + HMI_DEBUG("error is only enabeled for now"); return false; } int ret = afb_req_subscribe(req, this->evname2afb_event[evname]); if (ret) { - HMI_DEBUG("wm", "Failed to subscribe %s", evname.c_str()); + HMI_DEBUG("Failed to subscribe %s", evname.c_str()); return false; } return true; @@ -204,18 +204,18 @@ bool WMClient::subscribe(afb_req req, const string &evname) void WMClient::emitError(WM_CLIENT_ERROR_EVENT ev) { if (!afb_event_is_valid(this->evname2afb_event[kKeyError])){ - HMI_ERROR("wm", "event err is not valid"); + HMI_ERROR("event err is not valid"); return; } json_object *j = json_object_new_object(); json_object_object_add(j, kKeyError, json_object_new_int(ev)); json_object_object_add(j, kKeyErrorDesc, json_object_new_string(kErrorDescription[ev].c_str())); - HMI_DEBUG("wm", "error: %d, description:%s", ev, kErrorDescription[ev].c_str()); + HMI_DEBUG("error: %d, description:%s", ev, kErrorDescription[ev].c_str()); int ret = afb_event_push(this->evname2afb_event[kKeyError], j); if (ret != 0) { - HMI_DEBUG("wm", "afb_event_push failed: %m"); + HMI_DEBUG("afb_event_push failed: %m"); } } #endif diff --git a/src/wm_layer.cpp b/src/wm_layer.cpp index 7b67042..07b41e1 100644 --- a/src/wm_layer.cpp +++ b/src/wm_layer.cpp @@ -58,19 +58,19 @@ unsigned LayerSetting::getNewLayerID(const string& role) } // generate new ivi layer id ret = id_list.back() + 1; - HMI_INFO("wm", "generate ivi_layer_id : %d on the layer: %s", ret, this->name.c_str()); + HMI_INFO("generate ivi_layer_id : %d on the layer: %s", ret, this->name.c_str()); auto id_found = std::find(id_list.begin(), id_list.end(), ret); if( (ret > this->idEnd()) || (id_found != id_list.cend()) ) { - HMI_NOTICE("wm", "id %d is not available then generate new id", ret); + HMI_NOTICE("id %d is not available then generate new id", ret); ret = 0; for(unsigned i = this->idBegin(); i < this->idEnd(); i++) { auto ret_found = std::find(id_list.begin(), id_list.end(), i); if(ret_found == id_list.cend()) { - HMI_INFO("wm", "set new id: %d", i); + HMI_INFO("set new id: %d", i); ret = i; break; } @@ -83,7 +83,7 @@ unsigned LayerSetting::getNewLayerID(const string& role) } else { - HMI_ERROR("wm", "failed to get New ID"); + HMI_ERROR("failed to get New ID"); } return ret; } -- cgit 1.2.3-korg