X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=sample%2Fapp%2Feventhandler.cpp;h=3a618871b02de3cd96aafdabab90187acaaed97f;hb=831dc2946ce773ce2ed944ea9253350e5dd081bb;hp=388291fc54fd9bd8bb2077eb77437bdde7f03d28;hpb=85a1f5f0305fda98d7077bab78070456bcd680ac;p=apps%2Fonscreenapp.git diff --git a/sample/app/eventhandler.cpp b/sample/app/eventhandler.cpp index 388291f..3a61887 100644 --- a/sample/app/eventhandler.cpp +++ b/sample/app/eventhandler.cpp @@ -137,6 +137,11 @@ void EventHandler::init(int port, const char *token) if (shell_desktop) agl_shell_desktop_add_listener(shell_desktop, &agl_shell_desk_listener, this); + + m_launcher = new Launcher(DEFAULT_AFM_UNIX_SOCK, nullptr); + if (m_launcher->setup_pws_connection() != 0) + HMI_DEBUG("onscreen", "EventHandler::init failed to set-up connection to afm-system-daemon"); + #if 0 myThis = this; mp_wm = new QLibWindowmanager(); @@ -217,3 +222,34 @@ void EventHandler::hideWindow(QString id) mp_hs->hideWindow(id.toStdString().c_str()); #endif } + +int +EventHandler::start(const QString &app_id) +{ + int pid = -1; + + if (m_launcher && m_launcher->connection_is_set()) + pid = m_launcher->start(app_id); + + return pid; +} + +bool +EventHandler::is_running(const QString &app_id) +{ + if (m_launcher && m_launcher->connection_is_set()) + return m_launcher->is_running(app_id); + + return false; +} + +void +EventHandler::set_window_popup(const QString &app_id, int x, int y) +{ + struct wl_output *output = getWlOutput(qApp->screens().first()); + + if (shell_desktop) + agl_shell_desktop_set_app_property(shell_desktop, + app_id.toStdString().c_str(), + AGL_SHELL_DESKTOP_APP_ROLE_POPUP, x, y, output); +}