+ if (!onscreen_role_set) {
+ console.log("onscreen_role_set is not set")
+ eventHandler.set_window_popup(onsId, x, y)
+ console.log("setting for popup for " + onsId)
+ onscreen_role_set = true
+ }
+
+ // if the application is not already started, start it
+ if (pid === -1) {
+ // if the application is not started, then the first time
+ // we start we also display it using the default policy engine
+ pid = eventHandler.start(onsId, postmsg)
+ console.log("calling eventHandler.start for " + onsId + " with pid " + pid)
+
+ // this is necessary jus the first time as we don't queue the
+ // 'activate_app' event and pass it over once onscreenapp is
+ // started. It is implementation detail in case it is required
+ console.log("calling armTimer for " + onsId)
+ armTimer(onsId, postmsg)
+ } else {
+ // onscreenapp is already start we just need to activate + pass the data
+ if (!eventHandler.is_running(onsId) && pid > 0) {
+ // this is mostly for testing, in case onscreenapp died
+ // unexpectedly
+ eventHandler.set_window_popup(onsId, x, y)
+ pid = eventHandler.start(onsId, postmsg)
+ armTimer(onsId, postmsg)
+ } else {
+ eventHandler.showWindow(onsId, postmsg)
+ }
+ }
+