X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmain.cpp;h=935063428c739b8b6b1a0336fa71c04d5668727b;hb=8f32cd03059507c6b5bf3d26aaeb851c21d0437e;hp=8081dbc69cae9d10798dbf00395e4d8921a7e832;hpb=59edf2c3a8d4b246f5b06b163a307cfef0a57b25;p=apps%2Fagl-service-windowmanager.git diff --git a/src/main.cpp b/src/main.cpp index 8081dbc..9350634 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,16 +31,16 @@ extern "C" #include } -typedef struct wmClientCtxt +typedef struct WMClientCtxt { std::string name; std::string role; - wmClientCtxt(const char *appName, const char* appRole) + WMClientCtxt(const char *appName, const char* appRole) { name = appName; - role = role; + role = appRole; } -} wmClientCtxt; +} WMClientCtxt; struct afb_instance { @@ -180,13 +180,13 @@ int binding_init() noexcept static bool checkFirstReq(afb_req req) { - wmClientCtxt *ctxt = (wmClientCtxt *)afb_req_context_get(req); + WMClientCtxt *ctxt = (WMClientCtxt *)afb_req_context_get(req); return (ctxt) ? false : true; } static void cbRemoveClientCtxt(void *data) { - wmClientCtxt *ctxt = (wmClientCtxt *)data; + WMClientCtxt *ctxt = (WMClientCtxt *)data; if (ctxt == nullptr) { return; @@ -197,6 +197,18 @@ static void cbRemoveClientCtxt(void *data) if (pSid) { auto sid = *pSid; + auto o_state = *g_afb_instance->app.layers.get_layout_state(sid); + if (o_state != nullptr) + { + if (o_state->main == sid) + { + o_state->main = -1; + } + else if (o_state->sub == sid) + { + o_state->sub = -1; + } + } g_afb_instance->app.id_alloc.remove_id(sid); g_afb_instance->app.layers.remove_surface(sid); g_afb_instance->app.controller->sprops.erase(sid); @@ -232,7 +244,7 @@ void windowmanager_requestsurface(afb_req req) noexcept bool isFirstReq = checkFirstReq(req); if (!isFirstReq) { - wmClientCtxt *ctxt = (wmClientCtxt *)afb_req_context_get(req); + WMClientCtxt *ctxt = (WMClientCtxt *)afb_req_context_get(req); HMI_DEBUG("wm", "You're %s.", ctxt->name.c_str()); if (ctxt->name != std::string(a_drawing_name)) { @@ -247,7 +259,7 @@ void windowmanager_requestsurface(afb_req req) noexcept if (isFirstReq) { - wmClientCtxt *ctxt = new wmClientCtxt(afb_req_get_application_id(req), a_drawing_name); + WMClientCtxt *ctxt = new WMClientCtxt(afb_req_get_application_id(req), a_drawing_name); HMI_DEBUG("wm", "create session for %s", ctxt->name.c_str()); afb_req_session_set_LOA(req, 1); afb_req_context_set(req, ctxt, cbRemoveClientCtxt); @@ -364,7 +376,8 @@ void windowmanager_activatesurface(afb_req req) noexcept } catch (std::exception &e) { - HMI_WARNING("wm", "failed", "Uncaught exception while calling activatesurface: %s", e.what()); + HMI_WARNING("wm", "failed: Uncaught exception while calling activatesurface: %s", e.what()); + g_afb_instance->app.exeptionProcessForTransition(); return; } } @@ -404,7 +417,8 @@ void windowmanager_deactivatesurface(afb_req req) noexcept } catch (std::exception &e) { - HMI_WARNING("wm", "Uncaught exception while calling deactivatesurface: %s", e.what()); + HMI_WARNING("wm", "failed: Uncaught exception while calling deactivatesurface: %s", e.what()); + g_afb_instance->app.exeptionProcessForTransition(); return; } } @@ -436,7 +450,8 @@ 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("wm", "failed: Uncaught exception while calling enddraw: %s", e.what()); + g_afb_instance->app.exeptionProcessForTransition(); return; } } @@ -542,8 +557,6 @@ void windowmanager_wm_subscribe(afb_req req) noexcept return; } afb_req_success(req, NULL, "success"); - - g_afb_instance->app.subscribeEventForApp(afb_req_get_application_id(req), req, event_name); } catch (std::exception &e) {